harness-everything 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +15 -0
- package/benchmarks/results/live-host/agy-2026-11-26-516-read-only/README.md +12 -0
- package/benchmarks/results/live-host/agy-2026-11-26-516-read-only/capture.sanitized.jsonl +5 -0
- package/benchmarks/results/live-host/codex-2026-11-26-488-post-tool-use/README.md +25 -0
- package/benchmarks/results/live-host/codex-2026-11-26-488-post-tool-use/capture.sanitized.jsonl +10 -0
- package/ci/mechanism-2am-observations-session-import.test.js +1 -0
- package/ci/mechanism-2w-platform-compatibility.test.js +1 -2
- package/ci/mechanism-34-observations.test.js +37 -1
- package/ci/mechanism-397-opencode-observations.test.js +4 -3
- package/ci/mechanism-496-local-error-store.test.js +188 -5
- package/ci/mechanism-498-local-store-scan.test.js +13 -1
- package/ci/mechanism-516-windows-verify-and-shell.test.js +74 -19
- package/ci/mechanism-report-writer.test.js +2 -1
- package/ci/mechanism-system-one-cycle.test.js +47 -2
- package/ci/openai-plugin-submission.test.js +26 -8
- package/docs/openai-plugin.md +6 -10
- package/docs/platform-capabilities.md +15 -0
- package/docs/routing.md +2 -0
- package/harness-everything/SKILL.md +1 -1
- package/harness-everything/scripts/kernel-router.js +3 -2
- package/hooks/scripts/lib/local-errors.js +24 -7
- package/hooks/scripts/state-persist.js +6 -1
- package/opencode-plugin/plugin.json +1 -1
- package/package.json +1 -1
- package/plugins/harness-everything/.antigravity-plugin/plugin.json +1 -1
- package/plugins/harness-everything/.codex-plugin/plugin.json +1 -1
- package/plugins/harness-everything/hooks/scripts/lib/local-errors.js +24 -7
- package/plugins/harness-everything/hooks/scripts/state-persist.js +6 -1
- package/plugins/harness-everything/plugin.json +1 -1
- package/plugins/harness-everything/skills/harness-everything/SKILL.md +1 -1
- package/plugins/harness-everything/skills/harness-everything/scripts/kernel-router.js +3 -2
- package/sbom.cdx.json +7 -7
- package/scripts/build-openai-submission.js +8 -4
- package/submission/openai/README.md +9 -14
- package/submission/openai/listing.json +1 -1
- package/submission/openai/test-cases.json +1 -1
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"name": "harness-everything",
|
|
11
11
|
"source": "./",
|
|
12
12
|
"description": "Harness OS: an orchestrated agent operating system — tier routing, circuit breaker guardrails, verification gates, WAL session memory, and self-evolving workspace rules.",
|
|
13
|
-
"version": "1.2.
|
|
13
|
+
"version": "1.2.2",
|
|
14
14
|
"author": {
|
|
15
15
|
"name": "Miya Daniel"
|
|
16
16
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "harness-everything",
|
|
3
3
|
"description": "Harness OS: an orchestrated agent operating system — tier routing, circuit breaker guardrails, verification gates, WAL session memory, and self-evolving workspace rules.",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.2",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Miya Daniel"
|
|
7
7
|
},
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project are documented in this file.
|
|
4
4
|
|
|
5
|
+
## [1.2.2](https://github.com/dyphn1/Harness-everything/compare/v1.2.1...v1.2.2) (2026-11-26)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
* **agy:** avoid false windows shell edit tracking ([8e611ce](https://github.com/dyphn1/Harness-everything/commit/8e611ce288719729d6de1dc08b1ffe46aee87478))
|
|
10
|
+
* **distribution:** include the portable manifest in the public skills bundle ([b52d1da](https://github.com/dyphn1/Harness-everything/commit/b52d1daa59eb91ff9218853be9858e5ccc977bc3))
|
|
11
|
+
* **router:** explain null workflow labels for deferred routing ([a6339a5](https://github.com/dyphn1/Harness-everything/commit/a6339a5d3e6219c588ccab50dbc9f146c3ef3462))
|
|
12
|
+
|
|
13
|
+
## [1.2.1](https://github.com/dyphn1/Harness-everything/compare/v1.2.0...v1.2.1) (2026-11-26)
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **errors:** drop the claude exit-code wrapper from generic signatures ([#527](https://github.com/dyphn1/Harness-everything/issues/527)) ([c221b73](https://github.com/dyphn1/Harness-everything/commit/c221b73ac0fb819b4da9a5120ecf16db00ddeae0)), closes [#526](https://github.com/dyphn1/Harness-everything/issues/526)
|
|
18
|
+
* **errors:** reject cross-kind provisional ids and unscoped store reads ([#527](https://github.com/dyphn1/Harness-everything/issues/527)) ([e33ce07](https://github.com/dyphn1/Harness-everything/commit/e33ce07e817a6598bb93af371316656af7ce5f7f)), closes [#498](https://github.com/dyphn1/Harness-everything/issues/498)
|
|
19
|
+
|
|
5
20
|
## [1.2.0](https://github.com/dyphn1/Harness-everything/compare/v1.1.1...v1.2.0) (2026-11-25)
|
|
6
21
|
|
|
7
22
|
### Features
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Windows AGY read-only handoff for #516 (2026-11-26)
|
|
2
|
+
|
|
3
|
+
AGY CLI 1.5.17 with Gemini 4 Hydrogen (High) ran the two reported commands separately in a clean disposable Git workspace on Windows PowerShell 5.1.26100.9818 with Node 24.18.0 and no pwsh. A project-scope capture hook forwarded the live payloads to the PR's packaged PostToolUse and Stop scripts with a dedicated Harness state directory. The pre-existing global plugin used its own state and also ran.
|
|
4
|
+
|
|
5
|
+
| Live command | Result reported by AGY |
|
|
6
|
+
|---|---|
|
|
7
|
+
| `git grep -n "mechanism-516"` | Exit 0, matched the seeded README |
|
|
8
|
+
| `$PSVersionTable.PSVersion; Get-Command pwsh -ErrorAction SilentlyContinue` | Exit 1, printed the PowerShell version and found no pwsh |
|
|
9
|
+
|
|
10
|
+
[Sanitized capture](capture.sanitized.jsonl) records the event keys, allowlisted probe commands, and packaged hook decisions. Both PostToolUse events had an empty error string and omitted a response and numeric exit status. The isolated handoff finished idle with neither `lastEditAt` nor `lastVerifyAt`. The patched Stop hook returned `allow` on both deliveries. The older global plugin requested one continuation from its separate state.
|
|
11
|
+
|
|
12
|
+
This trace covers these two shell outcomes and normal Stop delivery. Async launch/completion, wait markers, subdirectory workspace behavior, and installation of the patched global plugin remain outside this trace. The missing structured status leaves automatic verification credit unavailable for these payloads.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
{"phase":"post","deliveryKeys":["artifactDirectoryPath","conversationId","cwd","error","hookEventName","lastUserInput","modelName","stepIdx","toolCall","transcriptPath","workspacePaths"],"tool":"run_command","command":"git grep -n \"mechanism-516\"","resultType":"undefined","hookExit":0,"errorType":"string","hasError":false}
|
|
2
|
+
{"phase":"post","deliveryKeys":["artifactDirectoryPath","conversationId","cwd","error","hookEventName","lastUserInput","modelName","stepIdx","toolCall","transcriptPath","workspacePaths"],"tool":"run_command","command":"$PSVersionTable.PSVersion; Get-Command pwsh -ErrorAction SilentlyContinue","resultType":"undefined","hookExit":0,"errorType":"string","hasError":false}
|
|
3
|
+
{"phase":"stop","deliveryKeys":["artifactDirectoryPath","continuationActive","conversationId","cwd","error","executionNum","fullyIdle","hookEventName","lastUserInput","modelName","terminationReason","transcriptPath","workspacePaths"],"resultType":"undefined","terminationReason":"NO_TOOL_CALL","hookExit":0,"errorType":"string","hasError":false,"decision":"allow"}
|
|
4
|
+
{"phase":"stop","deliveryKeys":["artifactDirectoryPath","continuationActive","conversationId","cwd","error","executionNum","fullyIdle","hookEventName","lastUserInput","modelName","terminationReason","transcriptPath","workspacePaths"],"resultType":"undefined","terminationReason":"NO_TOOL_CALL","hookExit":0,"errorType":"string","hasError":false,"decision":"allow"}
|
|
5
|
+
{"phase":"final_state","status":"idle","lastEditAtSet":false,"lastVerifyAtSet":false,"gitClean":true}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Codex CLI shell outcomes for #488 (2026-11-26)
|
|
2
|
+
|
|
3
|
+
Codex CLI `0.172.0` on Windows build `10.0.26200` ran UnifiedExec `exec_command` with Windows PowerShell and Git Bash. Each run used an isolated profile, a user-level `PostToolUse` capture hook, and a loopback Responses fixture that issued fixed shell calls. The CLI executed the commands and delivered hook stdin. The fixture supplied only tool calls and a final message.
|
|
4
|
+
|
|
5
|
+
[Sanitized capture](capture.sanitized.jsonl) pairs each hook payload excerpt with the corresponding `codex exec --json` command completion event. It retains the full top-level key names and the probe's command and output. It omits paths and session, turn, and tool identifiers.
|
|
6
|
+
|
|
7
|
+
| Probe | CLI event exit code (PowerShell / Git Bash) | Hook `tool_response` | Harness outcome |
|
|
8
|
+
|---|---|---|---|
|
|
9
|
+
| Exit zero | `0` / `0` | Output string | `unknown` |
|
|
10
|
+
| Exit nonzero | `1` / `7` | Output string | `unknown` |
|
|
11
|
+
| Exit nonzero after printing `Process exited with code 0` | `1` / `9` | Output string containing that line | `unknown` |
|
|
12
|
+
| Delayed exit zero | `0` / `0` | Output string | `unknown` |
|
|
13
|
+
|
|
14
|
+
The documented hook schema exposes tool-specific output without guaranteeing a shell status field. In this release, UnifiedExec serializes the command output as a JSON string for `PostToolUse`. The structured `item.exit_code` belongs to the separate CLI event stream, outside the hook payload. [Hook schema](https://learn.chatgpt.com/docs/hooks#posttooluse) · [UnifiedExec source](https://github.com/openai/codex/blob/3d86e43b075adeba2193ec5c22ac92f55afd82e6/codex-rs/core/src/tools/context.rs#L506-L514) · [CLI event source](https://github.com/openai/codex/blob/3d86e43b075adeba2193ec5c22ac92f55afd82e6/codex-rs/exec/src/exec_events.rs#L160-L166)
|
|
15
|
+
|
|
16
|
+
## Async completion follow-up
|
|
17
|
+
|
|
18
|
+
The same CLI and Windows build reproduced the synchronous results on both shells from checkout `a534e549`. The temporary capture hook invoked the installed Harness 1.2.1 outcome adapter, whose SHA-256 matched the checkout. The `async_failure` rows in the capture record one additional run per shell with a 12-second command and a `write_stdin` poll.
|
|
19
|
+
|
|
20
|
+
| Tool result | PostToolUse delivery for the delayed command |
|
|
21
|
+
|---|---|
|
|
22
|
+
| `exec_command` returned a running session | No delivery by the time the fixture received the running result |
|
|
23
|
+
| `write_stdin` returned the completed process | One `Bash` hook for the original command with an empty string response. The installed adapter returned `unknown`. The CLI completion event reported exit `1` in PowerShell and `7` in Git Bash. |
|
|
24
|
+
|
|
25
|
+
Automatic verification credit for these shell results depends on Codex exposing machine-readable status in `PostToolUse`. Source and packaged regression tests independently cover structured zero, nonzero, and ambiguous results through `state-persist` and `contract-test`. Native plugin mounting is tracked in [#122](https://github.com/dyphn1/Harness-everything/issues/122). This capture covers the two Windows shells on the tested CLI release.
|
package/benchmarks/results/live-host/codex-2026-11-26-488-post-tool-use/capture.sanitized.jsonl
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{"shell":"Windows PowerShell","scenario":"success","payloadKeys":["cwd","hook_event_name","model","permission_mode","session_id","tool_input","tool_name","tool_response","tool_use_id","transcript_path","turn_id"],"hook":{"hook_event_name":"PostToolUse","tool_name":"Bash","tool_input":{"command":"node -e \"console.log('probe-488-success');process.exit(0)\""},"tool_response":"probe-488-success\n"},"harnessOutcome":"unknown","cliEvent":{"type":"item.completed","item":{"type":"command_execution","exit_code":0,"status":"completed"}}}
|
|
2
|
+
{"shell":"Windows PowerShell","scenario":"failure","payloadKeys":["cwd","hook_event_name","model","permission_mode","session_id","tool_input","tool_name","tool_response","tool_use_id","transcript_path","turn_id"],"hook":{"hook_event_name":"PostToolUse","tool_name":"Bash","tool_input":{"command":"node -e \"console.log('probe-488-failure');process.exit(7)\""},"tool_response":"probe-488-failure\n"},"harnessOutcome":"unknown","cliEvent":{"type":"item.completed","item":{"type":"command_execution","exit_code":1,"status":"failed"}}}
|
|
3
|
+
{"shell":"Windows PowerShell","scenario":"spoof","payloadKeys":["cwd","hook_event_name","model","permission_mode","session_id","tool_input","tool_name","tool_response","tool_use_id","transcript_path","turn_id"],"hook":{"hook_event_name":"PostToolUse","tool_name":"Bash","tool_input":{"command":"node -e \"console.log('probe-488-spoof');console.log('Process exited with code 0');process.exit(9)\""},"tool_response":"probe-488-spoof\nProcess exited with code 0\n"},"harnessOutcome":"unknown","cliEvent":{"type":"item.completed","item":{"type":"command_execution","exit_code":1,"status":"failed"}}}
|
|
4
|
+
{"shell":"Windows PowerShell","scenario":"yield","payloadKeys":["cwd","hook_event_name","model","permission_mode","session_id","tool_input","tool_name","tool_response","tool_use_id","transcript_path","turn_id"],"hook":{"hook_event_name":"PostToolUse","tool_name":"Bash","tool_input":{"command":"node -e \"console.log('probe-488-yield');setTimeout(()=>process.exit(0),3000)\""},"tool_response":"probe-488-yield\n"},"harnessOutcome":"unknown","cliEvent":{"type":"item.completed","item":{"type":"command_execution","exit_code":0,"status":"completed"}}}
|
|
5
|
+
{"shell":"Git Bash","scenario":"success","payloadKeys":["cwd","hook_event_name","model","permission_mode","session_id","tool_input","tool_name","tool_response","tool_use_id","transcript_path","turn_id"],"hook":{"hook_event_name":"PostToolUse","tool_name":"Bash","tool_input":{"command":"node -e \"console.log('probe-488-success');process.exit(0)\""},"tool_response":"probe-488-success\n"},"harnessOutcome":"unknown","cliEvent":{"type":"item.completed","item":{"type":"command_execution","exit_code":0,"status":"completed"}}}
|
|
6
|
+
{"shell":"Git Bash","scenario":"failure","payloadKeys":["cwd","hook_event_name","model","permission_mode","session_id","tool_input","tool_name","tool_response","tool_use_id","transcript_path","turn_id"],"hook":{"hook_event_name":"PostToolUse","tool_name":"Bash","tool_input":{"command":"node -e \"console.log('probe-488-failure');process.exit(7)\""},"tool_response":"probe-488-failure\n"},"harnessOutcome":"unknown","cliEvent":{"type":"item.completed","item":{"type":"command_execution","exit_code":7,"status":"failed"}}}
|
|
7
|
+
{"shell":"Git Bash","scenario":"spoof","payloadKeys":["cwd","hook_event_name","model","permission_mode","session_id","tool_input","tool_name","tool_response","tool_use_id","transcript_path","turn_id"],"hook":{"hook_event_name":"PostToolUse","tool_name":"Bash","tool_input":{"command":"node -e \"console.log('probe-488-spoof');console.log('Process exited with code 0');process.exit(9)\""},"tool_response":"probe-488-spoof\nProcess exited with code 0\n"},"harnessOutcome":"unknown","cliEvent":{"type":"item.completed","item":{"type":"command_execution","exit_code":9,"status":"failed"}}}
|
|
8
|
+
{"shell":"Git Bash","scenario":"yield","payloadKeys":["cwd","hook_event_name","model","permission_mode","session_id","tool_input","tool_name","tool_response","tool_use_id","transcript_path","turn_id"],"hook":{"hook_event_name":"PostToolUse","tool_name":"Bash","tool_input":{"command":"node -e \"console.log('probe-488-yield');setTimeout(()=>process.exit(0),3000)\""},"tool_response":"probe-488-yield\n"},"harnessOutcome":"unknown","cliEvent":{"type":"item.completed","item":{"type":"command_execution","exit_code":0,"status":"completed"}}}
|
|
9
|
+
{"shell":"Windows PowerShell","scenario":"async_failure","payloadKeys":["cwd","hook_event_name","model","permission_mode","session_id","tool_input","tool_name","tool_response","tool_use_id","transcript_path","turn_id"],"hook":{"hook_event_name":"PostToolUse","tool_name":"Bash","tool_input":{"command":"node -e \"console.log('probe-488-yield');setTimeout(()=>process.exit(7),12000)\""},"tool_response":""},"harnessOutcome":"unknown","cliEvent":{"type":"item.completed","item":{"type":"command_execution","exit_code":1,"status":"failed"}},"asyncToolResults":[{"tool":"exec_command","running":true,"hookScenarios":["success","failure","spoof"]},{"tool":"write_stdin","running":false,"hookScenarios":["success","failure","spoof","yield"]}]}
|
|
10
|
+
{"shell":"Git Bash","scenario":"async_failure","payloadKeys":["cwd","hook_event_name","model","permission_mode","session_id","tool_input","tool_name","tool_response","tool_use_id","transcript_path","turn_id"],"hook":{"hook_event_name":"PostToolUse","tool_name":"Bash","tool_input":{"command":"node -e \"console.log('probe-488-yield');setTimeout(()=>process.exit(7),12000)\""},"tool_response":""},"harnessOutcome":"unknown","cliEvent":{"type":"item.completed","item":{"type":"command_execution","exit_code":7,"status":"failed"}},"asyncToolResults":[{"tool":"exec_command","running":true,"hookScenarios":["success","failure","spoof"]},{"tool":"write_stdin","running":false,"hookScenarios":["success","failure","spoof","yield"]}]}
|
|
@@ -117,6 +117,7 @@ try {
|
|
|
117
117
|
|
|
118
118
|
const fallbackRecord = index.records.find(entry => entry.captureMethod === 'session-backfill' && entry.turn === 3);
|
|
119
119
|
assert(fallbackRecord, 'the response_item assistant label is recovered when task_complete omits it');
|
|
120
|
+
assert.strictEqual(fallbackRecord.selfReport.workflow, null);
|
|
120
121
|
const fallbackText = JSON.parse(fs.readFileSync(path.join(store, 'text', fallbackRecord.contentSha256 + '.json'), 'utf8'));
|
|
121
122
|
assert.strictEqual(fallbackText.prompt, 'fallback prompt from the rollout message');
|
|
122
123
|
const backfilledTier1 = index.records.find(entry => entry.captureMethod === 'session-backfill' && entry.selfReport.tier === 'tier1');
|
|
@@ -180,8 +180,7 @@ try {
|
|
|
180
180
|
const result = build(tempOutput);
|
|
181
181
|
const publicManifest = JSON.parse(fs.readFileSync(result.manifestPath, 'utf8'));
|
|
182
182
|
const packagedFiles = filesUnder(path.join(ROOT, 'plugins', 'harness-everything', 'skills')).map(file => `skills/${file}`);
|
|
183
|
-
assert.deepStrictEqual(publicManifest.files.map(file => file.path), packagedFiles);
|
|
184
|
-
assert.ok(publicManifest.files.every(file => file.path.startsWith('skills/')));
|
|
183
|
+
assert.deepStrictEqual(publicManifest.files.map(file => file.path), ['plugin.json', ...packagedFiles]);
|
|
185
184
|
assert.ok(publicManifest.files.every(file => !/(^|\/)(hooks|\.codex-plugin)(\/|$)/.test(file.path)));
|
|
186
185
|
assert.strictEqual(publicManifest.bundle_sha256, sha256(tempOutput));
|
|
187
186
|
} finally {
|
|
@@ -639,7 +639,7 @@ test('the label contract is the router output\'s last section and covers every t
|
|
|
639
639
|
const sections = out.split(/\n(?==> )/);
|
|
640
640
|
const last = sections[sections.length - 1];
|
|
641
641
|
assert(/^=> TURN LABEL LINE/.test(last) && last.includes('harness-label'), 'the label contract is printed last');
|
|
642
|
-
assert(/EVERY TURN/.test(last) && /null only when validity is invalid/.test(last));
|
|
642
|
+
assert(/EVERY TURN/.test(last) && /null tier only when validity is invalid/.test(last));
|
|
643
643
|
assert(/cannot be understood from its own text and needs conversation context/.test(last));
|
|
644
644
|
assert(/agent-written dispatches and worker instructions are ordinary prompts/.test(last));
|
|
645
645
|
const status = sections.find(x => x.startsWith('=> USER-VISIBLE HARNESS STATUS CONTRACT'));
|
|
@@ -647,6 +647,41 @@ test('the label contract is the router output\'s last section and covers every t
|
|
|
647
647
|
assert(/^14\. \*\*The turn label line is mandatory on every turn/m.test(fs.readFileSync(path.join(ROOT, 'AGENTS.md'), 'utf8')));
|
|
648
648
|
});
|
|
649
649
|
|
|
650
|
+
test('deferred routing instructs an actionable turn to report a null workflow', () => {
|
|
651
|
+
const s = sandbox();
|
|
652
|
+
s.env.HARNESS_SYSTEM_ONE_MODE = 'off';
|
|
653
|
+
const base = { session_id: 'deferred-label', cwd: s.repo };
|
|
654
|
+
const promptEvent = { ...base, hook_event_name: 'UserPromptSubmit', prompt: 'git status' };
|
|
655
|
+
const result = spawnSync(process.execPath, [ROUTER], {
|
|
656
|
+
input: JSON.stringify(promptEvent), cwd: s.repo, encoding: 'utf8', env: s.env,
|
|
657
|
+
});
|
|
658
|
+
assert.strictEqual(result.status, 0, result.stderr);
|
|
659
|
+
assert.match(result.stdout, /=> WORKFLOW STRATEGY: deferred/);
|
|
660
|
+
const contract = result.stdout.slice(result.stdout.indexOf('=> TURN LABEL LINE'));
|
|
661
|
+
assert.match(contract, /Use JSON null for workflow when the strategy is deferred/);
|
|
662
|
+
|
|
663
|
+
const [, example] = contract.match(/<!-- harness-label (.*) -->/);
|
|
664
|
+
const nullWorkflow = LABEL.replace('"iterative-single"', JSON.stringify(JSON.parse(example).workflow));
|
|
665
|
+
assert.strictEqual(lib.parseLabelLine(nullWorkflow).label.workflow, null);
|
|
666
|
+
hook(s.env, promptEvent);
|
|
667
|
+
hook(s.env, { ...base, hook_event_name: 'Stop', last_assistant_message: `done\n${nullWorkflow}` });
|
|
668
|
+
const [report] = records(s.store);
|
|
669
|
+
assert.strictEqual(report.selfReport.workflow, null);
|
|
670
|
+
const out = path.join(s.dir, 'deferred-export');
|
|
671
|
+
const exported = spawnSync(process.execPath, [EXPORTER, '--store', s.store, '--out', out, '--self-report-only'], {
|
|
672
|
+
encoding: 'utf8', env: s.env,
|
|
673
|
+
});
|
|
674
|
+
assert.strictEqual(exported.status, 0, exported.stderr);
|
|
675
|
+
assert.strictEqual(JSON.parse(fs.readFileSync(path.join(out, 'labels-observed.jsonl'), 'utf8')).workflow, null);
|
|
676
|
+
|
|
677
|
+
const witness = { v: 1, validity: 'actionable', tier: 'tier1', intents: [], workflow: 'deferred', skills: [] };
|
|
678
|
+
assert.strictEqual(lib.parseLabelLine(`<!-- harness-label ${JSON.stringify(witness)} -->`).reason, 'label-invalid');
|
|
679
|
+
assert.strictEqual(lib.validLabel({ ...witness, workflow: 'unknown' }), false);
|
|
680
|
+
for (const workflow of ['direct-single', 'iterative-single', 'fable-staged', 'fable-parallel', 'fable-multi-agent-workspace']) {
|
|
681
|
+
assert.strictEqual(lib.validLabel({ ...witness, workflow }), true, workflow);
|
|
682
|
+
}
|
|
683
|
+
});
|
|
684
|
+
|
|
650
685
|
test('router/self agreement counts only turns where the router chose a tier', () => {
|
|
651
686
|
const s = sandbox();
|
|
652
687
|
fs.mkdirSync(path.join(s.store, 'text'), { recursive: true });
|
|
@@ -692,6 +727,7 @@ test('Codex router hook returns its contract as JSON additionalContext', () => {
|
|
|
692
727
|
const out = JSON.parse(r.stdout);
|
|
693
728
|
assert.strictEqual(out.hookSpecificOutput.hookEventName, 'UserPromptSubmit', script);
|
|
694
729
|
assert(out.hookSpecificOutput.additionalContext.includes('TURN LABEL LINE'), script);
|
|
730
|
+
assert.match(out.hookSpecificOutput.additionalContext, /Use JSON null for workflow when the strategy is deferred/, script);
|
|
695
731
|
}
|
|
696
732
|
});
|
|
697
733
|
|
|
@@ -253,13 +253,14 @@ test('inject: the documented OpenCode hooks deliver the kernel router output and
|
|
|
253
253
|
dispose = await install(f);
|
|
254
254
|
assert.ok(f.sessionHooks.has('prompt'), 'setup registers prompt admission');
|
|
255
255
|
assert.ok(f.sessionHooks.has('context'), 'setup registers the system context transform');
|
|
256
|
-
const prompt = { sessionID: 'inject-session', messageID: 'inject-turn', prompt: { text: '
|
|
256
|
+
const prompt = { sessionID: 'inject-session', messageID: 'inject-turn', prompt: { text: 'git status' } };
|
|
257
257
|
await f.sessionHooks.get('prompt')(prompt);
|
|
258
258
|
const context = { sessionID: 'inject-session', kind: 'primary', system: [], messages: [] };
|
|
259
259
|
await f.sessionHooks.get('context')(context);
|
|
260
|
-
assert.equal(prompt.prompt.text, '
|
|
260
|
+
assert.equal(prompt.prompt.text, 'git status', 'injection leaves the persisted user prompt unchanged');
|
|
261
261
|
const injected = context.system.map(part => part.text || '').join('\n');
|
|
262
|
-
assert.match(injected, /=>
|
|
262
|
+
assert.match(injected, /=> WORKFLOW STRATEGY: deferred/);
|
|
263
|
+
assert.match(injected, /Use JSON null for workflow when the strategy is deferred/);
|
|
263
264
|
|
|
264
265
|
const expectedRun = spawnSync(process.execPath, [path.join(ROOT, 'harness-everything/scripts/kernel-router.js')], {
|
|
265
266
|
cwd: f.workspace,
|
|
@@ -214,10 +214,98 @@ test('per-workspace and total retention/size bounds are enforced', () => {
|
|
|
214
214
|
}, { env: s.env, limits });
|
|
215
215
|
assert.strictEqual(r.status, 'appended');
|
|
216
216
|
}
|
|
217
|
-
const all =
|
|
217
|
+
const all = [
|
|
218
|
+
...localErrors.listRecords({ env: s.env, workspaceRoot: s.repoA }),
|
|
219
|
+
...localErrors.listRecords({ env: s.env, workspaceRoot: s.repoB }),
|
|
220
|
+
];
|
|
218
221
|
assert.strictEqual(all.length, 3, 'total cap keeps at most 3 records across workspaces');
|
|
219
222
|
});
|
|
220
223
|
|
|
224
|
+
test('same-workspace cross-kind IDs reject the lesson and preserve retries', () => {
|
|
225
|
+
const s = makeSandbox();
|
|
226
|
+
const occurrenceInput = {
|
|
227
|
+
workspaceRoot: s.repoA,
|
|
228
|
+
host: 'claude',
|
|
229
|
+
sessionKey: 'cross-kind-session',
|
|
230
|
+
toolUseId: 'cross-kind-tool-use',
|
|
231
|
+
command: 'npm test',
|
|
232
|
+
exitCode: 1,
|
|
233
|
+
output: 'npm ERR! code 1',
|
|
234
|
+
};
|
|
235
|
+
const occurrence = localErrors.appendOccurrence(occurrenceInput, { env: s.env });
|
|
236
|
+
assert.strictEqual(occurrence.status, 'appended');
|
|
237
|
+
|
|
238
|
+
const indexPath = path.join(s.store, localErrors.INDEX_FILE);
|
|
239
|
+
const before = fs.readFileSync(indexPath);
|
|
240
|
+
assert.throws(() => localErrors.addProvisionalLesson({
|
|
241
|
+
workspaceRoot: s.repoA,
|
|
242
|
+
provisionalId: occurrence.record.provisionalId,
|
|
243
|
+
signature: 'v1-git-cross-kind-lesson',
|
|
244
|
+
match: { actions: [{ tool: 'shell', executable: 'git', subcommand: 'commit' }] },
|
|
245
|
+
lesson: 'Keep failure IDs unique within their workspace.',
|
|
246
|
+
}, { env: s.env }), /invalid provisionalId: already in use in this workspace/);
|
|
247
|
+
assert.deepStrictEqual(fs.readFileSync(indexPath), before,
|
|
248
|
+
'rejecting a lesson collision leaves the store bytes unchanged');
|
|
249
|
+
|
|
250
|
+
const occurrenceRetry = localErrors.appendOccurrence(occurrenceInput, { env: s.env });
|
|
251
|
+
assert.strictEqual(occurrenceRetry.status, 'duplicate', 'same-kind occurrence retries still dedupe');
|
|
252
|
+
const lessonInput = {
|
|
253
|
+
workspaceRoot: s.repoA,
|
|
254
|
+
provisionalId: 'same-kind-lesson',
|
|
255
|
+
signature: 'v1-git-same-kind-lesson',
|
|
256
|
+
match: { actions: [{ tool: 'shell', executable: 'git', subcommand: 'commit' }] },
|
|
257
|
+
lesson: 'A same-kind lesson retry stays idempotent.',
|
|
258
|
+
};
|
|
259
|
+
assert.strictEqual(localErrors.addProvisionalLesson(lessonInput, { env: s.env }).status, 'appended');
|
|
260
|
+
assert.strictEqual(localErrors.addProvisionalLesson(lessonInput, { env: s.env }).status, 'duplicate',
|
|
261
|
+
'same-kind lesson retries still dedupe');
|
|
262
|
+
|
|
263
|
+
const sameIdOtherWorkspace = localErrors.addProvisionalLesson({
|
|
264
|
+
...lessonInput,
|
|
265
|
+
workspaceRoot: s.repoB,
|
|
266
|
+
provisionalId: occurrence.record.provisionalId,
|
|
267
|
+
}, { env: s.env });
|
|
268
|
+
assert.strictEqual(sameIdOtherWorkspace.status, 'appended',
|
|
269
|
+
'the same raw ID remains available in another workspace');
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
test('same-workspace cross-kind IDs reject the occurrence using its deterministic writer ID', () => {
|
|
273
|
+
const s = makeSandbox();
|
|
274
|
+
const occurrenceInput = {
|
|
275
|
+
workspaceRoot: s.repoA,
|
|
276
|
+
host: 'claude',
|
|
277
|
+
sessionKey: 'reverse-cross-kind-session',
|
|
278
|
+
toolUseId: 'reverse-cross-kind-tool-use',
|
|
279
|
+
command: 'npm test',
|
|
280
|
+
exitCode: 1,
|
|
281
|
+
output: 'npm ERR! code 1',
|
|
282
|
+
};
|
|
283
|
+
const probeStore = path.join(s.dir, 'probe-store');
|
|
284
|
+
fs.mkdirSync(probeStore);
|
|
285
|
+
const deterministicOccurrence = localErrors.appendOccurrence(occurrenceInput, {
|
|
286
|
+
env: s.env,
|
|
287
|
+
root: probeStore,
|
|
288
|
+
});
|
|
289
|
+
assert.strictEqual(deterministicOccurrence.status, 'appended');
|
|
290
|
+
|
|
291
|
+
const lesson = localErrors.addProvisionalLesson({
|
|
292
|
+
workspaceRoot: s.repoA,
|
|
293
|
+
provisionalId: deterministicOccurrence.record.provisionalId,
|
|
294
|
+
signature: 'v1-git-reverse-cross-kind-lesson',
|
|
295
|
+
match: { actions: [{ tool: 'shell', executable: 'git', subcommand: 'commit' }] },
|
|
296
|
+
lesson: 'A lesson may not claim a future occurrence ID.',
|
|
297
|
+
}, { env: s.env });
|
|
298
|
+
assert.strictEqual(lesson.status, 'appended');
|
|
299
|
+
|
|
300
|
+
const indexPath = path.join(s.store, localErrors.INDEX_FILE);
|
|
301
|
+
const before = fs.readFileSync(indexPath);
|
|
302
|
+
const rejected = localErrors.appendOccurrence(occurrenceInput, { env: s.env });
|
|
303
|
+
assert.strictEqual(rejected.status, 'invalid');
|
|
304
|
+
assert.strictEqual(rejected.error, 'provisional-id-in-use');
|
|
305
|
+
assert.deepStrictEqual(fs.readFileSync(indexPath), before,
|
|
306
|
+
'rejecting an occurrence collision leaves the store bytes unchanged');
|
|
307
|
+
});
|
|
308
|
+
|
|
221
309
|
test('lock contention returns fail-open without throwing and leaves index untouched', () => {
|
|
222
310
|
const s = makeSandbox();
|
|
223
311
|
const lockFile = path.join(s.store, '.index.lock');
|
|
@@ -443,6 +531,82 @@ test('real failure signature fixtures are stable across volatile details and div
|
|
|
443
531
|
assert.notStrictEqual(multiA, npm1, 'multi-family output must not collapse to first single-family match');
|
|
444
532
|
});
|
|
445
533
|
|
|
534
|
+
test('Claude exit-code wrapper preserves the shared v1 signature and stored excerpts', () => {
|
|
535
|
+
const s = makeSandbox();
|
|
536
|
+
const captureDir = path.join(ROOT, 'benchmarks/results/live-host/multi-host-2026-11-25-496-capture');
|
|
537
|
+
const claudeCapture = JSON.parse(fs.readFileSync(path.join(captureDir, 'claude-records.json'), 'utf8'))[0];
|
|
538
|
+
const opencodeCapture = JSON.parse(fs.readFileSync(path.join(captureDir, 'opencode-records.json'), 'utf8'))[0];
|
|
539
|
+
const expected = 'v1-shell-generic-b6246d9928fe';
|
|
540
|
+
|
|
541
|
+
const appendCapture = (capture, id) => localErrors.appendOccurrence({
|
|
542
|
+
workspaceRoot: s.repoA,
|
|
543
|
+
host: capture.host,
|
|
544
|
+
sessionKey: `session-${id}`,
|
|
545
|
+
toolUseId: `tool-${id}`,
|
|
546
|
+
commandClass: capture.commandClass,
|
|
547
|
+
exitCode: capture.exitCode,
|
|
548
|
+
output: capture.outputExcerpt,
|
|
549
|
+
}, { env: s.env });
|
|
550
|
+
|
|
551
|
+
const claude = appendCapture(claudeCapture, 'claude');
|
|
552
|
+
const opencode = appendCapture(opencodeCapture, 'opencode');
|
|
553
|
+
assert.strictEqual(claude.status, 'appended');
|
|
554
|
+
assert.strictEqual(opencode.status, 'appended');
|
|
555
|
+
assert.strictEqual(claude.record.signature, expected, 'Claude and OpenCode share the existing OpenCode v1 key');
|
|
556
|
+
assert.strictEqual(opencode.record.signature, expected);
|
|
557
|
+
assert.strictEqual(claude.record.outputExcerpt, claudeCapture.outputExcerpt, 'Claude excerpt keeps its wrapper line');
|
|
558
|
+
assert.strictEqual(claude.record.exitCode, null, 'text does not supply a structured exit code');
|
|
559
|
+
assert.strictEqual(opencode.record.outputExcerpt, opencodeCapture.outputExcerpt);
|
|
560
|
+
|
|
561
|
+
const signature = (output, host = 'claude') => localErrors.normalizeSignature(
|
|
562
|
+
{ commandClass: 'shell', output },
|
|
563
|
+
{ host }
|
|
564
|
+
);
|
|
565
|
+
const failure = opencodeCapture.outputExcerpt;
|
|
566
|
+
assert.strictEqual(signature(`Exit code 1\r\n${failure}`), expected, 'CRLF wrapper is removed for Claude');
|
|
567
|
+
assert.notStrictEqual(
|
|
568
|
+
signature(`Exit code 1\nExit code 2\n${failure}`),
|
|
569
|
+
signature(`Exit code 2\n${failure}`),
|
|
570
|
+
'only one leading wrapper line is removed'
|
|
571
|
+
);
|
|
572
|
+
assert.notStrictEqual(
|
|
573
|
+
signature(`${failure}Exit code 2\npermission denied`),
|
|
574
|
+
signature(`${failure}permission denied`),
|
|
575
|
+
'an interior header-like line remains part of the fallback signature'
|
|
576
|
+
);
|
|
577
|
+
|
|
578
|
+
const wrapped = `Exit code 1\n${failure}`;
|
|
579
|
+
assert.strictEqual(
|
|
580
|
+
signature(wrapped, 'opencode'),
|
|
581
|
+
localErrors.normalizeSignature({ commandClass: 'shell', output: wrapped }),
|
|
582
|
+
'non-Claude behavior is unchanged'
|
|
583
|
+
);
|
|
584
|
+
assert.notStrictEqual(signature('command not found: jq'), expected, 'unrelated generic failures stay distinct');
|
|
585
|
+
assert.strictEqual(
|
|
586
|
+
localErrors.normalizeSignature({
|
|
587
|
+
command: 'git commit',
|
|
588
|
+
output: 'Exit code 1\r\n✖ subject must be lower-case [subject-case]',
|
|
589
|
+
}, { host: 'claude' }),
|
|
590
|
+
'v1-git-commitlint-subject-case',
|
|
591
|
+
'named diagnostics are classified before fallback normalization'
|
|
592
|
+
);
|
|
593
|
+
|
|
594
|
+
const legacyInput = {
|
|
595
|
+
workspaceRoot: s.repoA,
|
|
596
|
+
host: 'claude',
|
|
597
|
+
sessionKey: 'legacy-session',
|
|
598
|
+
toolUseId: 'legacy-tool',
|
|
599
|
+
commandClass: 'shell',
|
|
600
|
+
exitCode: null,
|
|
601
|
+
output: claudeCapture.outputExcerpt,
|
|
602
|
+
};
|
|
603
|
+
const legacy = localErrors.appendOccurrence({ ...legacyInput, signature: claudeCapture.signature }, { env: s.env });
|
|
604
|
+
const replay = localErrors.appendOccurrence(legacyInput, { env: s.env });
|
|
605
|
+
assert.strictEqual(legacy.status, 'appended');
|
|
606
|
+
assert.strictEqual(replay.status, 'duplicate');
|
|
607
|
+
assert.strictEqual(replay.record.signature, claudeCapture.signature, 'replay retains the previously stored signature');
|
|
608
|
+
});
|
|
609
|
+
|
|
446
610
|
test('D1b row 1: issueUrl with userinfo is rejected and leaves index bytes unchanged', () => {
|
|
447
611
|
const s = makeSandbox();
|
|
448
612
|
const validMatch = {
|
|
@@ -671,16 +835,35 @@ test('D1b row 6: workspace-scoped reads and matcher-supplied bounded reader look
|
|
|
671
835
|
|
|
672
836
|
const keyA = addedA.record.workspaceKey;
|
|
673
837
|
const keyB = addedB.record.workspaceKey;
|
|
838
|
+
const signatures = (records) => records.map(record => record.signature).sort();
|
|
839
|
+
|
|
840
|
+
// Missing or unrecognized selectors never enumerate the shared store.
|
|
841
|
+
assert.deepStrictEqual(localErrors.listRecords({ env: s.env }), []);
|
|
842
|
+
assert.deepStrictEqual(localErrors.listRecords({ env: s.env, workspacePath: s.repoA }), []);
|
|
843
|
+
assert.deepStrictEqual(localErrors.listRecords({ env: s.env, root: s.store }), []);
|
|
844
|
+
assert.deepStrictEqual(localErrors.listRecords({
|
|
845
|
+
env: { ...s.env, HARNESS_WORKSPACE_ROOT: s.repoA },
|
|
846
|
+
}), [], 'environment-only workspace identity is not a read scope');
|
|
674
847
|
|
|
675
848
|
// Normal workspace-scoped read works.
|
|
676
849
|
const byRoot = localErrors.listRecords({ env: s.env, workspaceRoot: s.repoA });
|
|
677
|
-
assert.
|
|
678
|
-
assert.strictEqual(byRoot[0].signature, 'v1-git-read-a');
|
|
850
|
+
assert.deepStrictEqual(signatures(byRoot), ['v1-git-read-a']);
|
|
679
851
|
|
|
680
852
|
// Matcher-supplied key works for bounded read lookup.
|
|
681
853
|
const byKey = localErrors.listRecords({ env: s.env, workspaceKey: keyA });
|
|
682
|
-
assert.
|
|
683
|
-
|
|
854
|
+
assert.deepStrictEqual(signatures(byKey), ['v1-git-read-a']);
|
|
855
|
+
|
|
856
|
+
// Matching explicit root plus key works; the top-level root remains the store location.
|
|
857
|
+
assert.deepStrictEqual(signatures(localErrors.listRecords({
|
|
858
|
+
env: s.env,
|
|
859
|
+
workspaceRoot: s.repoA,
|
|
860
|
+
workspaceKey: keyA,
|
|
861
|
+
})), ['v1-git-read-a']);
|
|
862
|
+
assert.deepStrictEqual(signatures(localErrors.listRecords({
|
|
863
|
+
env: s.env,
|
|
864
|
+
root: s.store,
|
|
865
|
+
workspaceKey: keyA,
|
|
866
|
+
})), ['v1-git-read-a']);
|
|
684
867
|
|
|
685
868
|
// Disagreeing root + key on read returns empty.
|
|
686
869
|
assert.deepStrictEqual(localErrors.listRecords({ env: s.env, workspaceRoot: s.repoA, workspaceKey: keyB }), []);
|
|
@@ -298,8 +298,20 @@ addOccurrence(workspaceB, 'workspace-b-occurrence', 'harness', 6);
|
|
|
298
298
|
const collisionOccurrence = addOccurrence(workspaceCollision, 'collision-occurrence', 'harness', 7);
|
|
299
299
|
const collisionRawId = collisionOccurrence.provisionalId;
|
|
300
300
|
PRIVATE_VALUES.push(collisionRawId);
|
|
301
|
-
const collisionLesson = addLesson(
|
|
301
|
+
const collisionLesson = addLesson(
|
|
302
|
+
workspaceCollision, 'collision-lesson', 'project', ACTIONS.commit, `${collisionRawId}-lesson`
|
|
303
|
+
);
|
|
302
304
|
addLesson(workspaceB, 'collision-id-other-workspace', 'harness', ACTIONS.commit, collisionRawId);
|
|
305
|
+
const collisionFixtureFile = path.join(STORE, localErrors.INDEX_FILE);
|
|
306
|
+
const collisionFixtureIndex = JSON.parse(fs.readFileSync(collisionFixtureFile, 'utf8'));
|
|
307
|
+
const collisionFixtureLesson = collisionFixtureIndex.records.find(record =>
|
|
308
|
+
record.kind === 'provisional-lesson' &&
|
|
309
|
+
record.workspaceKey === collisionLesson.workspaceKey &&
|
|
310
|
+
record.provisionalId === collisionLesson.provisionalId
|
|
311
|
+
);
|
|
312
|
+
assert.ok(collisionFixtureLesson, 'positive control: the lesson exists before creating a legacy collision');
|
|
313
|
+
collisionFixtureLesson.provisionalId = collisionRawId;
|
|
314
|
+
fs.writeFileSync(collisionFixtureFile, `${JSON.stringify(collisionFixtureIndex)}\n`);
|
|
303
315
|
const distinctLesson = addLesson(workspaceCollision, 'distinct-lesson-signature', 'harness', ACTIONS.commit, 'distinct-lesson-id');
|
|
304
316
|
const distinctOccurrence = addOccurrence(workspaceCollision, 'distinct-occurrence-signature', 'harness', 8);
|
|
305
317
|
PRIVATE_VALUES.push(distinctOccurrence.provisionalId);
|
|
@@ -53,10 +53,20 @@ function runScript(scriptPath, payload) {
|
|
|
53
53
|
return JSON.parse(res.stdout.trim());
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
function
|
|
56
|
+
function hasPwsh(cwd) {
|
|
57
|
+
const result = spawnSync('pwsh', ['-NoProfile', '-NonInteractive', '-Command', 'exit 0'], {
|
|
58
|
+
cwd, timeout: 20000,
|
|
59
|
+
});
|
|
60
|
+
if (result.error?.code === 'ENOENT' && process.env.HARNESS_TEST_PWSH !== '1') return false;
|
|
61
|
+
assert.strictEqual(result.error?.code, undefined, 'PowerShell 7 runtime requires pwsh on PATH');
|
|
62
|
+
assert.strictEqual(result.status, 0, 'PowerShell 7 prerequisite probe failed');
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function runPowerShell(cwd, command, executable = 'pwsh') {
|
|
57
67
|
const env = { ...process.env };
|
|
58
68
|
delete env.NODE_TEST_CONTEXT;
|
|
59
|
-
const res = spawnSync(
|
|
69
|
+
const res = spawnSync(executable, ['-NoProfile', '-NonInteractive', '-Command', command], {
|
|
60
70
|
cwd,
|
|
61
71
|
encoding: 'utf8',
|
|
62
72
|
env,
|
|
@@ -192,10 +202,28 @@ try {
|
|
|
192
202
|
assert.strictEqual(isVerificationCommand(`${changeLocation('.\\pkg')} && ${testCommand}`, { cwd: repo, root: repo }), true);
|
|
193
203
|
}
|
|
194
204
|
|
|
205
|
+
const pkg = path.join(repo, 'pkg');
|
|
206
|
+
if (process.platform === 'win32') {
|
|
207
|
+
const fixture = path.join(pkg, 'verify.test.js');
|
|
208
|
+
fs.writeFileSync(fixture, 'require("node:test")("failing verifier", () => { throw Error("fixture failure"); });\n');
|
|
209
|
+
const failure = runPowerShell(pkg, testCommand, 'powershell.exe');
|
|
210
|
+
assert.strictEqual(failure.status, 1, failure.stderr);
|
|
211
|
+
assert.match(failure.stdout, /fixture failure/);
|
|
212
|
+
assert.ok(!postShell(repo, 'winps-plain', testCommand, failure.status, pkg).lastVerifyAt);
|
|
213
|
+
|
|
214
|
+
fs.writeFileSync(fixture, 'require("node:test")("passing verifier", () => {});\n');
|
|
215
|
+
const success = runPowerShell(pkg, testCommand, 'powershell.exe');
|
|
216
|
+
assert.strictEqual(success.status, 0, success.stderr);
|
|
217
|
+
assert.match(success.stdout, /passing verifier/);
|
|
218
|
+
assert.ok(postShell(repo, 'winps-plain', testCommand, success.status, pkg).lastVerifyAt);
|
|
219
|
+
console.log('Windows PowerShell plain verifier: real exit 0 and 1 propagated through packaged PostToolUse.');
|
|
220
|
+
}
|
|
221
|
+
|
|
195
222
|
let successfulExit = 0;
|
|
196
223
|
let failedExit = 1;
|
|
197
224
|
let wildcardExit = 0;
|
|
198
|
-
|
|
225
|
+
const wantsPwsh = process.platform === 'win32' || process.env.HARNESS_TEST_PWSH === '1';
|
|
226
|
+
if (wantsPwsh && hasPwsh(repo)) {
|
|
199
227
|
fs.writeFileSync(path.join(repo, 'verify.test.js'), 'require("node:test")("root verifier", () => {});\n');
|
|
200
228
|
fs.writeFileSync(path.join(repo, 'pkg', 'verify.test.js'), 'require("node:test")("package verifier", () => {});\n');
|
|
201
229
|
fs.writeFileSync(path.join(repo, 'pkg1', 'verify.test.js'), 'require("node:test")("wildcard verifier", () => {});\n');
|
|
@@ -223,6 +251,8 @@ try {
|
|
|
223
251
|
const literal = runPowerShell(repo, literalBracketsPrelude);
|
|
224
252
|
assert.strictEqual(literal.status, 0, literal.stderr);
|
|
225
253
|
assert.match(literal.stdout, /literal verifier/);
|
|
254
|
+
} else {
|
|
255
|
+
console.log('Skipped 5 PowerShell 7 runtime cases: ' + (wantsPwsh ? 'pwsh unavailable' : 'pwsh runtime lane not requested'));
|
|
226
256
|
}
|
|
227
257
|
|
|
228
258
|
for (const cmd of [
|
|
@@ -280,23 +310,41 @@ try {
|
|
|
280
310
|
|
|
281
311
|
// 5. End-to-end packaged AGY hooks: read-only PowerShell doesn't trigger false Stop;
|
|
282
312
|
// A successful, contained Set-Location verifier allows Stop.
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
runScript(
|
|
290
|
-
conversationId:
|
|
291
|
-
workspacePaths: [repo],
|
|
292
|
-
toolCall: { name: 'run_command', args: { CommandLine: 'agy plugin list --json', Cwd: repo } },
|
|
313
|
+
git(repo, ['add', '.']);
|
|
314
|
+
git(repo, ['commit', '-m', 'seed verifier fixtures']);
|
|
315
|
+
const liveReadOnly = [
|
|
316
|
+
'git grep -n "mechanism-516"',
|
|
317
|
+
'$PSVersionTable.PSVersion; Get-Command pwsh -ErrorAction SilentlyContinue',
|
|
318
|
+
];
|
|
319
|
+
const stop = conversationId => runScript(PACKAGED_STOP, {
|
|
320
|
+
conversationId, workspacePaths: [repo], terminationReason: 'NO_TOOL_CALL',
|
|
293
321
|
});
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
322
|
+
for (const [index, command] of [
|
|
323
|
+
'Get-ChildItem | Select-Object Name', 'agy plugin list --json', ...liveReadOnly,
|
|
324
|
+
].entries()) {
|
|
325
|
+
const conversationId = 'win-readonly-' + index;
|
|
326
|
+
assert.ok(!git(repo, ['status', '--short']), 'read-only fixture requires a clean workspace');
|
|
327
|
+
const handoff = postShell(repo, conversationId, command);
|
|
328
|
+
assert.ok(!handoff.lastEditAt, command);
|
|
329
|
+
assert.ok(!handoff.lastVerifyAt, command);
|
|
330
|
+
assert.deepStrictEqual(stop(conversationId), { decision: 'allow' });
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
for (const [index, command] of [
|
|
334
|
+
'git grep -O "mechanism-516"',
|
|
335
|
+
'git grep --open-files-in-pager "mechanism-516"',
|
|
336
|
+
'git grep --textconv "mechanism-516"',
|
|
337
|
+
'git grep -n "mechanism-516" > output.txt',
|
|
338
|
+
'git grep -n "$(Get-Content file)"',
|
|
339
|
+
'git grep -n "mechanism-516"; git status',
|
|
340
|
+
'Get-ChildItem | ForEach-Object { Remove-Item $_.FullName }',
|
|
341
|
+
liveReadOnly[1] + '; git status',
|
|
342
|
+
].entries()) {
|
|
343
|
+
assert.notStrictEqual(classifyShell(command), 'read-only', command);
|
|
344
|
+
const handoff = postShell(repo, 'win-unknown-' + index, command);
|
|
345
|
+
assert.ok(handoff.lastEditAt, command);
|
|
346
|
+
assert.ok(!handoff.lastVerifyAt, command);
|
|
347
|
+
}
|
|
300
348
|
|
|
301
349
|
const convEditVerify = 'win-edit-verify-' + Date.now();
|
|
302
350
|
const target = path.join(repo, 'README.md');
|
|
@@ -307,6 +355,13 @@ try {
|
|
|
307
355
|
toolCall: { name: 'write_file', args: { Path: target, Content: 'edited\n' } },
|
|
308
356
|
});
|
|
309
357
|
const afterEdit = readHandoff(repo, convEditVerify);
|
|
358
|
+
for (const command of liveReadOnly) {
|
|
359
|
+
const pending = postShell(repo, convEditVerify, command);
|
|
360
|
+
assert.strictEqual(pending.lastEditAt, afterEdit.lastEditAt, command);
|
|
361
|
+
assert.strictEqual(pending.lastVerifyAt, afterEdit.lastVerifyAt, command);
|
|
362
|
+
}
|
|
363
|
+
assert.strictEqual(stop(convEditVerify).decision, 'continue');
|
|
364
|
+
assert.deepStrictEqual(stop(convEditVerify), { decision: 'allow' });
|
|
310
365
|
for (const exitCode of [undefined, '0']) {
|
|
311
366
|
const unverified = postShell(repo, convEditVerify, verifyInPkg, exitCode);
|
|
312
367
|
assert.strictEqual(unverified.lastEditAt, afterEdit.lastEditAt);
|
|
@@ -156,7 +156,7 @@ test('assembles BLOCKED from a raw body, blank line, and one EOF host label', t
|
|
|
156
156
|
const dir = tempDir(t);
|
|
157
157
|
const raw = path.join(dir, 'raw.txt');
|
|
158
158
|
const output = path.join(dir, 'report.md');
|
|
159
|
-
const rawBytes = Buffer.from(`Summary\n\nEvidence\n\n${labelLine({ ...CODEX_LABEL, intents: ['fix', 'lookup'], contextDependent: false })}`);
|
|
159
|
+
const rawBytes = Buffer.from(`Summary\n\nEvidence\n\n${labelLine({ ...CODEX_LABEL, workflow: null, intents: ['fix', 'lookup'], contextDependent: false })}`);
|
|
160
160
|
const body = rawBytes.subarray(0, rawBytes.lastIndexOf(Buffer.from('<!-- harness-label')));
|
|
161
161
|
fs.writeFileSync(raw, rawBytes);
|
|
162
162
|
|
|
@@ -240,6 +240,7 @@ test('464 rejects unrecognized terminal label schemas before touching report or
|
|
|
240
240
|
{ ...CODEX_LABEL, validity: 'unknown' },
|
|
241
241
|
{ ...CODEX_LABEL, tier: 'tier9' },
|
|
242
242
|
{ ...CODEX_LABEL, workflow: 'unknown' },
|
|
243
|
+
{ ...CODEX_LABEL, workflow: 'deferred' },
|
|
243
244
|
{ ...CODEX_LABEL, intents: 'fix' },
|
|
244
245
|
{ ...CODEX_LABEL, skills: [42] },
|
|
245
246
|
[],
|