harness-everything 1.2.1 → 1.3.0

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.
Files changed (55) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/CHANGELOG.md +31 -0
  4. package/benchmarks/results/live-host/agy-2026-11-26-516-read-only/README.md +12 -0
  5. package/benchmarks/results/live-host/agy-2026-11-26-516-read-only/capture.sanitized.jsonl +5 -0
  6. package/benchmarks/results/live-host/codex-2026-11-26-488-post-tool-use/README.md +25 -0
  7. package/benchmarks/results/live-host/codex-2026-11-26-488-post-tool-use/capture.sanitized.jsonl +10 -0
  8. package/ci/fixtures/468-dispatch/agy-quota-PROVENANCE.md +19 -0
  9. package/ci/fixtures/468-dispatch/agy-quota-direct-individual.stderr +2 -0
  10. package/ci/fixtures/468-dispatch/agy-quota-direct-third-party.stderr +2 -0
  11. package/ci/fixtures/468-dispatch/agy-quota-exec-individual.log +3 -0
  12. package/ci/mechanism-2am-observations-session-import.test.js +1 -0
  13. package/ci/mechanism-2w-platform-compatibility.test.js +1 -2
  14. package/ci/mechanism-34-observations.test.js +37 -1
  15. package/ci/mechanism-397-opencode-observations.test.js +4 -3
  16. package/ci/mechanism-468-dispatch-cli.test.js +1496 -4
  17. package/ci/mechanism-516-windows-verify-and-shell.test.js +74 -19
  18. package/ci/mechanism-548-bigint-identity.test.js +531 -0
  19. package/ci/mechanism-error-ledger-oracle.test.js +786 -3
  20. package/ci/mechanism-error-ledger-scan.test.js +981 -0
  21. package/ci/mechanism-report-writer.test.js +47 -1
  22. package/ci/mechanism-system-one-cycle.test.js +47 -2
  23. package/ci/openai-plugin-submission.test.js +26 -8
  24. package/docs/error-handling/details/c8-dispatch-cli.md +109 -13
  25. package/docs/openai-plugin.md +6 -10
  26. package/docs/platform-capabilities.md +15 -0
  27. package/docs/routing.md +2 -0
  28. package/error-ledger-bootstrap/SKILL.md +1 -1
  29. package/error-ledger-bootstrap/references/workflow.md +42 -7
  30. package/error-ledger-bootstrap/scripts/promote.js +8 -6
  31. package/error-ledger-bootstrap/scripts/scan.js +525 -12
  32. package/harness-everything/SKILL.md +1 -1
  33. package/harness-everything/scripts/kernel-router.js +3 -2
  34. package/hooks/scripts/state-persist.js +6 -1
  35. package/opencode-plugin/plugin.json +1 -1
  36. package/package.json +1 -1
  37. package/plugins/harness-everything/.antigravity-plugin/plugin.json +1 -1
  38. package/plugins/harness-everything/.codex-plugin/plugin.json +1 -1
  39. package/plugins/harness-everything/hooks/scripts/state-persist.js +6 -1
  40. package/plugins/harness-everything/plugin.json +1 -1
  41. package/plugins/harness-everything/skills/error-ledger-bootstrap/SKILL.md +1 -1
  42. package/plugins/harness-everything/skills/error-ledger-bootstrap/references/workflow.md +42 -7
  43. package/plugins/harness-everything/skills/error-ledger-bootstrap/scripts/promote.js +8 -6
  44. package/plugins/harness-everything/skills/error-ledger-bootstrap/scripts/scan.js +525 -12
  45. package/plugins/harness-everything/skills/harness-everything/SKILL.md +1 -1
  46. package/plugins/harness-everything/skills/harness-everything/scripts/kernel-router.js +3 -2
  47. package/sbom.cdx.json +7 -7
  48. package/scripts/build-openai-submission.js +8 -4
  49. package/scripts/dispatch.js +499 -87
  50. package/scripts/error-ledger-oracle.js +521 -27
  51. package/scripts/errors-sync.js +4 -3
  52. package/scripts/report-writer.js +4 -3
  53. package/submission/openai/README.md +9 -14
  54. package/submission/openai/listing.json +1 -1
  55. package/submission/openai/test-cases.json +1 -1
@@ -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
 
@@ -182,6 +182,40 @@ test('497 accepts the live codex -o shape: STATUS, one blank line, then the EOF
182
182
  assertOk(run(['check', '--file', output]));
183
183
  });
184
184
 
185
+ test('441-A accepts trailing ASCII spaces or tabs on raw Codex STATUS and writes canonical report bytes', t => {
186
+ const dir = tempDir(t);
187
+ const raw = path.join(dir, 'raw.txt');
188
+ const output = path.join(dir, 'report.md');
189
+
190
+ // P498-F shape: raw STATUS: BLOCKED: <reason> followed by two trailing ASCII spaces.
191
+ const blockedRaw = Buffer.from('Summary\nSTATUS: BLOCKED: verification unavailable \n');
192
+ fs.writeFileSync(raw, blockedRaw);
193
+ const blockedResult = run(writeArgs(output, 'BLOCKED', ['--from-codex-output', raw], '--reason', 'verification unavailable'));
194
+ assertOk(blockedResult);
195
+ assert.deepEqual(fs.readFileSync(raw), blockedRaw);
196
+ assert.deepEqual(fs.readFileSync(output), Buffer.from('Summary\nSTATUS: BLOCKED: verification unavailable\n'));
197
+ assertOk(run(['check', '--file', output]));
198
+
199
+ // Padded STATUS: DONE with a trailing ASCII tab.
200
+ const doneTabRaw = Buffer.from('Summary\nSTATUS: DONE\t\n');
201
+ fs.writeFileSync(raw, doneTabRaw);
202
+ const doneTabResult = run(writeArgs(output, 'DONE', ['--from-codex-output', raw]));
203
+ assertOk(doneTabResult);
204
+ assert.deepEqual(fs.readFileSync(raw), doneTabRaw);
205
+ assert.deepEqual(fs.readFileSync(output), Buffer.from('Summary\nSTATUS: DONE\n'));
206
+ assertOk(run(['check', '--file', output]));
207
+
208
+ // Padded STATUS: BLOCKED followed by a blank line and an EOF host label.
209
+ const labeledRaw = Buffer.from(`Summary\nSTATUS: BLOCKED: verification unavailable \t\n\n${VALID_LABEL}\n`);
210
+ fs.writeFileSync(raw, labeledRaw);
211
+ const labeledResult = run(writeArgs(output, 'BLOCKED', ['--from-codex-output', raw], '--reason', 'verification unavailable'));
212
+ assertOk(labeledResult);
213
+ assert.match(labeledResult.stderr, /stripped.*host label/i);
214
+ assert.deepEqual(fs.readFileSync(raw), labeledRaw);
215
+ assert.deepEqual(fs.readFileSync(output), Buffer.from('Summary\nSTATUS: BLOCKED: verification unavailable\n'));
216
+ assertOk(run(['check', '--file', output]));
217
+ });
218
+
185
219
  test('rejects embedded STATUS in body without changing an existing target', t => {
186
220
  const dir = tempDir(t);
187
221
  const output = path.join(dir, 'report.md');
@@ -240,6 +274,7 @@ test('464 rejects unrecognized terminal label schemas before touching report or
240
274
  { ...CODEX_LABEL, validity: 'unknown' },
241
275
  { ...CODEX_LABEL, tier: 'tier9' },
242
276
  { ...CODEX_LABEL, workflow: 'unknown' },
277
+ { ...CODEX_LABEL, workflow: 'deferred' },
243
278
  { ...CODEX_LABEL, intents: 'fix' },
244
279
  { ...CODEX_LABEL, skills: [42] },
245
280
  [],
@@ -265,11 +300,20 @@ test('rejects mismatched, malformed, duplicate, or trailing Codex controls and p
265
300
  const invalidRaw = [
266
301
  ['Summary\nSTATUS: BLOCKED: wrong reason\n', 'DONE'],
267
302
  ['Summary\nSTATUS: BLOCKED: wrong reason\n', 'BLOCKED', '--reason', 'expected reason'],
303
+ ['Summary\nSTATUS: BLOCKED: wrong reason \n', 'BLOCKED', '--reason', 'expected reason'],
304
+ ['Summary\nSTATUS: BLOCKED: expected reason \n', 'BLOCKED', '--reason', 'expected reason'],
305
+ ['Summary\nSTATUS: DONE\u00a0\n', 'DONE'],
306
+ ['Summary\nSTATUS: BLOCKED: expected reason\u00a0\n', 'BLOCKED', '--reason', 'expected reason'],
307
+ ['Summary\nSTATUS: DONE \n', 'DONE'],
268
308
  ['Summary\nSTATUS: FINISHED\n', 'DONE'],
269
309
  ['Summary\nSTATUS: malformed\nSTATUS: DONE\n', 'DONE'],
310
+ ['Summary\nSTATUS: DONE \nSTATUS: DONE\n', 'DONE'],
270
311
  ['Summary\nSTATUS: DONE\nSTATUS: DONE\n', 'DONE'],
312
+ ['Summary\nSTATUS: DONE \n\n', 'DONE'],
271
313
  ['Summary\nSTATUS: DONE\n\n', 'DONE'],
314
+ ['Summary\nSTATUS: DONE \ntext after status\n', 'DONE'],
272
315
  ['Summary\nSTATUS: DONE\ntext after status\n', 'DONE'],
316
+ [`Summary\nSTATUS: DONE ${VALID_LABEL}`, 'DONE'],
273
317
  [`Summary\nSTATUS: DONE\ntext\n${VALID_LABEL}`, 'DONE'],
274
318
  [`Summary\nSTATUS: DONE\n${VALID_LABEL}\n${VALID_LABEL}\n`, 'DONE'],
275
319
  [`Summary\nSTATUS: DONE\n${VALID_LABEL}\ntrailing text`, 'DONE'],
@@ -326,6 +370,8 @@ test('check accepts one terminal status with LF or CRLF and rejects other contro
326
370
  }
327
371
  for (const invalid of [
328
372
  'Summary',
373
+ 'Summary\nSTATUS: DONE ',
374
+ 'Summary\n STATUS: DONE',
329
375
  'Summary\nSTATUS: DONE\n\n',
330
376
  'Summary\nSTATUS: DONE\ntrailing',
331
377
  'Summary\nSTATUS: DONE\nSTATUS: DONE',
@@ -155,13 +155,15 @@ function environment446(fixture, quality = 0.9) {
155
155
  return env;
156
156
  }
157
157
 
158
- function run446Cycle(fixture, version, { history, quality = 0.9, all = false } = {}) {
158
+ function run446Cycle(fixture, version, { history, quality = 0.9, all = false, preload } = {}) {
159
159
  const args = [cycleCli, all ? 'all' : 'evaluate'];
160
160
  if (all) args.push('--until', 'evaluate');
161
161
  args.push('--data-dir', fixture.dataDir, '--holdout', fixture.holdout, '--version', version);
162
162
  if (history === true) args.push('--history');
163
163
  else if (history !== undefined) args.push('--history', history);
164
- return spawnSync(process.execPath, args, { cwd: root, encoding: 'utf8', env: environment446(fixture, quality) });
164
+ const env = environment446(fixture, quality);
165
+ if (preload) env.NODE_OPTIONS = `--require ${JSON.stringify(preload.replaceAll('\\', '/'))}`;
166
+ return spawnSync(process.execPath, args, { cwd: root, encoding: 'utf8', env });
165
167
  }
166
168
 
167
169
  function rows446(history) {
@@ -1026,6 +1028,49 @@ test('446 cross-cycle: default history remains local and explicit history valida
1026
1028
  assert.equal(fs.existsSync(path.join(appendFailure.dataDir, 'cycle-state.json')), false);
1027
1029
  });
1028
1030
 
1031
+ test('443 R6: resumes after an interrupted history append exactly once', t => {
1032
+ const tmp = private446Root(t);
1033
+ const history = path.join(tmp, 'history.jsonl');
1034
+ const version = 'v1';
1035
+ const fixture = setup446Cycle(t, path.join(tmp, 'cycle'), [
1036
+ { version: 'v0', quality: 0.9 }, { version, quality: 0.9 },
1037
+ ]);
1038
+ assert.equal(run446Cycle(fixture, 'v0', { history }).status, 0);
1039
+ const prefix = fs.readFileSync(history, 'utf8');
1040
+ const preload = path.join(tmp, 'fail-history-append.cjs');
1041
+ fs.writeFileSync(preload, `
1042
+ const fs = require('node:fs');
1043
+ const append = fs.appendFileSync;
1044
+ fs.appendFileSync = (file, ...args) => {
1045
+ if (file === ${JSON.stringify(fs.realpathSync.native(history))}) throw new Error('injected history append failure');
1046
+ return append(file, ...args);
1047
+ };
1048
+ `);
1049
+
1050
+ const interrupted = run446Cycle(fixture, version, { history, preload });
1051
+ assert.notEqual(interrupted.status, 0);
1052
+ const candidate = path.join(fixture.dataDir, 'training', 'candidates', version);
1053
+ const manifest = path.join(candidate, 'manifest.json');
1054
+ const evaluationFiles = snapshot446(['curves.json', 'trend.json'].map(file =>
1055
+ path.join(candidate, 'evaluation', file)));
1056
+ assert.equal(fs.readFileSync(history, 'utf8'), prefix);
1057
+ assert.equal(JSON.parse(fs.readFileSync(manifest, 'utf8')).evaluation, null);
1058
+ const callsAfterFailure = fs.readFileSync(fixture.callLog, 'utf8');
1059
+
1060
+ const resumed = run446Cycle(fixture, version, { history });
1061
+ assert.equal(resumed.status, 0, resumed.stderr || resumed.stdout);
1062
+ assert.equal(JSON.parse(resumed.stdout).steps[0].resumed, true);
1063
+ assert.equal(JSON.parse(fs.readFileSync(manifest, 'utf8')).evaluation, 'evaluation/curves.json');
1064
+ const restored = fs.readFileSync(history, 'utf8');
1065
+ assert.equal(restored, prefix + JSON.stringify(evaluation446(fixture.dataDir, version).curves) + '\n');
1066
+
1067
+ const repeated = run446Cycle(fixture, version, { history });
1068
+ assert.equal(repeated.status, 0, repeated.stderr || repeated.stdout);
1069
+ assert.equal(fs.readFileSync(history, 'utf8'), restored);
1070
+ assert.equal(fs.readFileSync(fixture.callLog, 'utf8'), callsAfterFailure);
1071
+ assertSnapshot446(evaluationFiles);
1072
+ });
1073
+
1029
1074
  test('446 H2: rejects changed same-id baseline before append, including an existing identical candidate', t => {
1030
1075
  const tmp = private446Root(t);
1031
1076
  const originalHistory = path.join(tmp, 'original-history.jsonl');
@@ -48,8 +48,8 @@ assert.ok(listing.manual_requirements?.developer_identity, 'developer identity r
48
48
  assert.ok(listing.manual_requirements?.logo, 'logo upload reminder missing');
49
49
  assert.ok(listing.manual_requirements?.apps_management_write_access, 'Apps Management access reminder missing');
50
50
 
51
- assert.strictEqual(tests.positive.length, 5, 'OpenAI submission requires five positive test cases');
52
- assert.strictEqual(tests.negative.length, 3, 'OpenAI submission requires three negative test cases');
51
+ assert.strictEqual(tests.positive.length, 5, 'maintain five positive smoke cases');
52
+ assert.strictEqual(tests.negative.length, 3, 'maintain three negative smoke cases');
53
53
  const ids = new Set();
54
54
  for (const test of tests.positive) {
55
55
  assert.ok(test.id && !ids.has(test.id), `duplicate/missing test id: ${test.id}`);
@@ -82,20 +82,38 @@ try {
82
82
  assert.strictEqual(sha256(first), sha256(second), 'submission bundle must be deterministic');
83
83
 
84
84
  const manifest = JSON.parse(fs.readFileSync(first.replace(/\.zip$/, '.manifest.json'), 'utf8'));
85
- const expectedFiles = filesUnder(path.join(PLUGIN, 'skills')).map(file => `skills/${file}`);
85
+ const expectedFiles = ['plugin.json', ...filesUnder(path.join(PLUGIN, 'skills')).map(file => `skills/${file}`)];
86
86
  assert.strictEqual(manifest.source, 'plugins/harness-everything/skills');
87
- assert.ok(manifest.files.every(file => file.path.startsWith('skills/')), 'public bundle must contain only skills/ paths');
88
87
  assert.ok(manifest.files.every(file => !/(^|\/)(hooks|\.codex-plugin)(\/|$)/.test(file.path)), 'public bundle must exclude local hook package paths');
89
- assert.ok(manifest.files.every(file => path.basename(file.path) !== 'plugin.json'), 'public bundle must exclude plugin manifests');
90
- assert.deepStrictEqual(manifest.files.map(file => file.path), expectedFiles, 'bundle manifest must contain exactly packaged skill files');
88
+ assert.deepStrictEqual(manifest.files.map(file => file.path), expectedFiles, 'bundle must contain the root manifest and packaged skill files');
91
89
  assert.strictEqual(manifest.file_count, expectedFiles.length);
92
90
  assert.strictEqual(manifest.bundle_sha256, sha256(first));
93
91
 
94
92
  const zip = fs.readFileSync(first);
95
- assert.strictEqual(zip.readUInt32LE(0), 0x04034b50, 'bundle must start with ZIP local-file signature');
93
+ let offset = 0;
94
+ for (const file of manifest.files) {
95
+ assert.strictEqual(zip.readUInt32LE(offset), 0x04034b50, file.path);
96
+ const size = zip.readUInt32LE(offset + 18);
97
+ const nameStart = offset + 30;
98
+ const nameEnd = nameStart + zip.readUInt16LE(offset + 26);
99
+ const dataStart = nameEnd + zip.readUInt16LE(offset + 28);
100
+ const data = zip.subarray(dataStart, dataStart + size);
101
+ assert.strictEqual(zip.toString('utf8', nameStart, nameEnd), file.path);
102
+ assert.strictEqual(size, file.bytes);
103
+ assert.strictEqual(crypto.createHash('sha256').update(data).digest('hex'), file.sha256);
104
+ if (file.path === 'plugin.json') {
105
+ const { extensions, ...identity } = portablePlugin;
106
+ assert.deepStrictEqual(JSON.parse(data), {
107
+ ...identity,
108
+ extensions: { 'com.openai': { interface: extensions['com.openai'].interface } },
109
+ });
110
+ }
111
+ offset = dataStart + size;
112
+ }
113
+ assert.strictEqual(zip.readUInt32LE(offset), 0x02014b50, 'no extra file entries before the central directory');
96
114
  assert.strictEqual(zip.readUInt32LE(zip.length - 22), 0x06054b50, 'bundle must end with ZIP EOCD signature');
97
115
  } finally {
98
116
  fs.rmSync(tmp, { recursive: true, force: true });
99
117
  }
100
118
 
101
- console.log('OpenAI public submission verified: listing metadata, 5+3 review cases, and deterministic skills bundle.');
119
+ console.log('OpenAI public submission verified: portable manifest, listing metadata, smoke cases, and deterministic skills bundle.');
@@ -5,27 +5,30 @@ This detail implements the C8 action map for one coordinator-selected runner att
5
5
  ## Invocation
6
6
 
7
7
  ```sh
8
- npm run --silent dispatch -- --runner <codex|opencode> --model <id> \
8
+ npm run --silent dispatch -- --runner <codex|opencode|agy> --model <id> \
9
9
  --packet <path> --worktree <git-root> --scratch <absolute-external-path> \
10
- --report <path> [--effort <low|medium|high|xhigh>] [--dry-run] [--json]
10
+ --report <path> [--effort <low|medium|high|xhigh>] [--assignment <path>] \
11
+ [--admission-policy <path>] [--dry-run] [--json]
11
12
  ```
12
13
 
13
- `node scripts/dispatch.js` accepts the same options. `--help` prints this short synopsis. The coordinator supplies every value; packet and report paths may be relative to the worktree or absolute. The worktree must be an existing Git root. Scratch must be absolute and outside every Git repository/worktree. A pre-existing report path is rejected as invalid input.
14
+ `node scripts/dispatch.js` accepts the same options. `--help` prints this short synopsis. The coordinator supplies every value; packet and report paths may be relative to the worktree or absolute (for `agy`, both must resolve inside `--worktree` so the prompt passes cwd-relative worker paths only). The worktree must be an existing Git root. Scratch must be absolute and outside every Git repository/worktree. A pre-existing report path is rejected as invalid input.
14
15
 
15
16
  | Option | Meaning |
16
17
  | --- | --- |
17
- | `--runner` | Required explicit selection: `codex` or `opencode`. |
18
+ | `--runner` | Required explicit selection: `codex`, `opencode`, or `agy`. |
18
19
  | `--model` | Required model id for that runner. |
19
- | `--packet` | Required existing packet file, resolved from the worktree when relative. |
20
+ | `--packet` | Required existing packet file, resolved from the worktree when relative (must resolve inside `--worktree` for `agy`). |
20
21
  | `--worktree` | Required existing Git repository or worktree root; child cwd. |
21
- | `--scratch` | Required absolute path outside all Git repository/worktree roots; child `TMPDIR`. |
22
- | `--report` | Required fresh report path, resolved from the worktree when relative. |
23
- | `--effort` | Optional Codex reasoning effort: `low`, `medium`, `high`, or `xhigh`. It passes a Codex `-c model_reasoning_effort="…"` override; omission leaves Codex configuration unchanged. Rejected for OpenCode. |
22
+ | `--scratch` | Required absolute path outside all Git repository/worktree roots; child `TMPDIR` (in managed mode: the external root of per-attempt directories, see [Managed scratch](#managed-scratch-and-lifecycle-466-d-scratch)). |
23
+ | `--report` | Required fresh report path, resolved from the worktree when relative (must resolve inside `--worktree` for `agy`). |
24
+ | `--effort` | Optional Codex reasoning effort: `low`, `medium`, `high`, or `xhigh`. It passes a Codex `-c model_reasoning_effort="…"` override; omission leaves Codex configuration unchanged. Rejected for OpenCode and `agy`. |
25
+ | `--assignment` | Optional managed-mode gate assignment sidecar JSON; see [Managed mode](#managed-mode-and-gate-assignment-466-d-gate). |
26
+ | `--admission-policy` | Required in managed mode (`--assignment`); host-level per-pool reservation policy JSON, see [Managed admission](#managed-per-pool-admission-466-d-admission). Rejected in unmanaged mode (`10 INVALID_INPUT`). |
24
27
  | `--dry-run` | Validate inputs and return planned argv/cwd; no child or filesystem writes. |
25
28
  | `--json` | Return one JSON object on stdout, including refusals. |
26
29
  | `--help` | Return the short usage synopsis with exit 0. |
27
30
 
28
- In JSON mode the common shape is `{ok, code, phase, message}` with resolved `runner`, `model`, and existing `evidence` paths when available. A validated requested Codex `--effort` is also returned as `effort`; it records the request and does not claim the provider applied it. Dry run also returns `argv` and `cwd`; Codex's generated raw-output argument uses a `<run-id>` placeholder. Human-mode refusals go to stderr. Child logs and raw output stay in evidence files, not in the JSON result.
31
+ In JSON mode the common shape is `{ok, code, phase, message}` with resolved `runner`, `model`, and existing `evidence` paths when available. A validated requested Codex `--effort` is also returned as `effort`; it records the request and does not claim the provider applied it. For `agy`, JSON also returns `sandbox: "requested"`; it records the requested `--sandbox` flag only and does not claim proven isolation (scope any isolation claim to separately executed evidence). Dry run also returns `argv` and `cwd`; Codex's generated raw-output argument uses a `<run-id>` placeholder. Human-mode refusals go to stderr. Child logs and raw output stay in evidence files, not in the JSON result.
29
32
 
30
33
  ## Exit and JSON codes
31
34
 
@@ -34,7 +37,7 @@ In JSON mode the common shape is `{ok, code, phase, message}` with resolved `run
34
37
  | `0` | `HELP`, `DRY_RUN_OK`, `DONE` | Help, validated dry run, or a fresh validated DONE report. |
35
38
  | `1` | `INTERNAL_ERROR` | Unexpected application failure outside a named phase result. |
36
39
  | `10` | `INVALID_INPUT` | Bad/missing/duplicate option, unsupported or runner-incompatible effort, runner/model, packet/worktree, or a report path that already exists. |
37
- | `11` | `UNSAFE_SCRATCH` | Scratch is relative, an existing scratch path is not a directory, or it is inside a Git repository/worktree. |
40
+ | `11` | `UNSAFE_SCRATCH` | Scratch is relative, an existing scratch path is not a directory, it crosses a dangling symlink or unresolved symlink chain, or it resolves inside a Git repository/worktree. |
38
41
  | `12` | `NOT_READY` | Selected executable is missing or readiness failed, timed out, or omitted `READY`. No run starts. |
39
42
  | `13` | `RUNNER_RATE_LIMITED` | The selected runner's failed readiness stderr has a recognized provider throttling diagnostic. No run starts. |
40
43
  | `13` | `RUNNER_QUOTA` | The selected runner's failed readiness stderr has an explicit usage/quota exhaustion diagnostic. No run starts. |
@@ -60,20 +63,113 @@ Classification requires a full runner-specific diagnostic line on the failed rea
60
63
  | OpenCode usage/quota exhaustion | `Error: Free usage limit reached. Free models work in OpenCode (https://opencode.ai); subscribe to OpenCode Go to keep going: https://opencode.ai/go` | The stderr envelope is live-traced; the cause is from the retained OpenCode log. |
61
64
  | Codex provider rate limit | `ERROR: Provider request failed with HTTP 429: {"status":429,"title":"Too Many Requests"}` | Fixture-only; no retained live Codex 429 trace. |
62
65
  | Codex usage/quota exhaustion | `ERROR: Free usage limit reached. Free models work in OpenCode (https://opencode.ai); subscribe to OpenCode Go to keep going: https://opencode.ai/go` | Fixture-only; no retained live Codex usage-limit trace. |
66
+ | `agy` usage/quota exhaustion | One normal exit `3` (no signal, no spawn error, no timeout, no report) whose ANSI-stripped stderr has exactly one full line `error: <Third-party\|Individual> quota reached. … Resets in <duration>.` **and** exactly one `AGY_ERROR: <json>` line whose parsed object has `status: "RESOURCE_EXHAUSTED"` and numeric `error_code: 429` and whose `short_error` names the same pool. Advice text, reset value and redacted identifier are not pinned. | Live-backed stderr shape from the sanitized captures in `ci/fixtures/468-dispatch/agy-quota-*` (see `agy-quota-PROVENANCE.md`); the managed wrappers and the execution exit status are fixtures. One recognizer serves readiness and execution. Duplicate, contradictory, partial, malformed, generic/quoted, wrong/split-stream, stdout-only or retired-single-line diagnostics, unsupported pools, other exit shapes, and runs that wrote a report are not classified as quota. |
63
67
 
64
68
  Each invocation uses one selected runner and one readiness attempt. A `12` or `13` refusal starts no execution, report writer, fallback, or retry; available child evidence remains available to the coordinator.
65
69
 
66
- Codex writes raw output with `codex exec -o`; it must contain an explicit terminal DONE or BLOCKED status. `report-writer --from-codex-output` strips an optional valid terminal host label (blank lines between STATUS and the label are allowed; live codex output has one), writes the final report, and `report-writer check` validates it. OpenCode is asked to write the report path directly; the path must remain absent through readiness and the resulting file must pass `report-writer check`. A valid BLOCKED report returns 17. Failed execution returns 15 and preserves its logs/raw output; it may have changed the worktree.
70
+ Codex writes raw output with `codex exec -o`; it must contain an explicit terminal DONE or BLOCKED status. `report-writer --from-codex-output` strips an optional valid terminal host label (blank lines between STATUS and the label are allowed; live codex output has one), writes the final report, and `report-writer check` validates it. OpenCode and `agy` follow the direct-delivery contract: the worker writes the report path directly, the path must remain absent through readiness (pre-existing returns `10 INVALID_INPUT`, populated during readiness returns `16 REPORT_INVALID`), exit 0 without a fresh regular report file fails delivery (`16 REPORT_INVALID`) with logs retained, and the resulting file must pass `report-writer check`. A valid BLOCKED report returns 17. Failed execution returns 15 and preserves its logs/raw output (for `agy`, an execution exit `3` with no report and the validated diagnostic pair above returns `13 RUNNER_QUOTA` with `phase: "execution"` and logs retained); a failed execution may have changed the worktree. The execution-pair fixture is derived from a live Individual stderr shape plus a fixture exit status: the captured managed result was `15 RUN_FAILED` and did not preserve its original exit status, so the `13 RUNNER_QUOTA` execution row is a fixture outcome, not a live reclassification (see `ci/fixtures/468-dispatch/agy-quota-PROVENANCE.md`).
71
+
72
+ ## `agy` headless runner adapter (#466 D-agy)
73
+
74
+ `agy` is invoked with the pinned headless argv, `cwd` set to `--worktree`, closed stdin (`stdio: ['ignore', 'pipe', 'pipe']`), and child execution bounded by C8 (`120s` readiness, `2700s` execution) in addition to `--print-timeout`:
75
+
76
+ ```sh
77
+ agy -p "<prompt>" --model <id> --mode accept-edits --sandbox \
78
+ --settings '{"permissions":{"allow":["command(*)","read_file(*)"]}}' --print-timeout <N>s
79
+ ```
80
+
81
+ - **Cwd-relative worker paths:** `--packet` and `--report` must resolve inside `--worktree` (otherwise `10 INVALID_INPUT`), and the execution prompt points only at cwd-relative paths (`<packet-rel>`, `<report-rel>`).
82
+ - **Readiness:** runs the same pinned argv with `Reply with the single word READY` and `--print-timeout 120s`; accepts `READY` or `READY.` after dropping an optional trailing Harness host label. A failed readiness check starts no execution.
83
+ - **Sandbox configuration:** `--sandbox` is recorded as requested configuration (`sandbox: "requested"` in JSON). No isolation is claimed; scope any isolation claim to separately executed evidence.
84
+ - **Gate profile:** `runnerProfile('agy')` returns `{ sandboxed: true }` conservatively because `agy` requests `--sandbox` and is not treated as an unsandboxed loopback-capable profile. Assigning `verify:all` or `verify:all --fast` to the worker returns `18 GATE_REFUSED` ("assign it to the coordinator").
85
+ - **Evidence:** fixture rows A1–A10 in `ci/mechanism-468-dispatch-cli.test.js` (real Node entry, stubbed `agy` fixture). Live `agy` runs remain out of scope here until admission is in place.
67
86
 
68
87
  ## Evidence boundary
69
88
 
70
89
  | Layer | What it establishes | What it does not establish |
71
90
  | --- | --- | --- |
72
- | Fixture | The real Node entry with stubbed child runners exercises argv, cwd, closed stdin, readiness, quota, timeout, fresh delivery, report writing/checking, and exit/JSON outcomes. | No real provider behavior or live host behavior. |
91
+ | Fixture | The real Node entry with stubbed child runners exercises argv, cwd, closed stdin, readiness, quota, timeout, fresh delivery, report writing/checking, and exit/JSON outcomes. Captured `agy` quota-pair rows replay sanitized live stderr through that entry. | No real provider behavior or live host behavior. The managed exit status is a fixture; only the direct calls establish a live normal exit 3. |
73
92
  | Checkout/package entry | The npm script invokes the checked-in entry, and documented options work through that entry; named repository gates validate local consistency and portability. | No installed npm tarball or distributed plugin integration. |
74
93
  | Live dispatch (2026-11-21, #497) | One full `npm run --silent dispatch` per runner on this Mac: OpenCode `opencode/hy4-flash-free` and Codex `gpt-6-luna --effort medium`, a two-line probe packet, both `0 DONE` with a validated report. The readiness replies carried a trailing host label; the Codex raw output had a blank line before it. | Effort is recorded as requested; provider-side application of the effort is not observed. One run each, not a reliability claim. |
75
94
  | Live (channel probe only) | `opencode run --auto -m <model>`, the exact C8 OpenCode readiness argv, against failing nvidia models on OpenCode 2.1.4 (2026-11-21): provider errors reach stderr as one ANSI `Error: <message>` line, exit 1, empty stdout. | Not a C8 dispatch: no live 429 or quota reproduction (the 429 and quota bodies come from the retained OpenCode log), no Codex provider call, no host dispatch or live report delivery. |
76
95
 
96
+ ## Managed mode and gate assignment (#466 D-gate)
97
+
98
+ Managed mode is entered only by `--assignment <path>` (resolved from the worktree when relative): a sidecar JSON file next to the packet. Without the option, behavior, output, and JSON shape are unchanged. A sidecar was chosen over packet frontmatter so the C6 packet format stays untouched and C8 reads one strict, machine-checkable file; packet metadata owns which actor runs each gate, C8 owns admission.
99
+
100
+ ```json
101
+ { "schemaVersion": 1, "gates": [ { "id": "verify:all", "actor": "coordinator" }, { "id": "npm run test:consistency", "actor": "worker" } ] }
102
+ ```
103
+
104
+ Validation is strict: the root has exactly `schemaVersion` (`1`) and `gates`; each gate has exactly `id` and `actor` (`worker` or `coordinator`); ids are unique and must be in the registry. Any unknown key, value, shape, unreadable file, or unknown id returns `19 GATE_ASSIGNMENT_INVALID`.
105
+
106
+ | Gate id | Requirement for a worker |
107
+ | --- | --- |
108
+ | `verify:all`, `verify:all --fast` | Unsandboxed, loopback-capable profile |
109
+ | `npm run test:consistency`, `npm run test:references`, `npm run test:portability`, `node --test <repo-relative .js file>` | Any profile (focused) |
110
+
111
+ One decision function maps the selected runner to a profile: `codex` runs `-s workspace-write` and `agy` requests `--sandbox` (not treated as an unsandboxed loopback-capable profile), so both are conservatively `sandboxed: true`; `opencode` is not. A sandboxed profile with a worker assignment of either full or fast `verify:all` returns `18 GATE_REFUSED` ("assign it to the coordinator"). Both refusals happen after input validation and before readiness or any file creation, so no child starts and no scratch, report, or evidence exists; `--dry-run` applies the same refusals. An accepted managed run returns `gates: {worker: [...], coordinator: [...]}` in JSON (also on dry run). C8 never runs a gate itself: coordinator gates are only recorded, and the attempt is the same single readiness plus execution.
112
+
113
+ | Exit | JSON `code` | Meaning |
114
+ | --- | --- | --- |
115
+ | `18` | `GATE_REFUSED` | Managed worker gate needs a profile the selected runner does not provide. |
116
+ | `19` | `GATE_ASSIGNMENT_INVALID` | Managed assignment is missing, malformed, or names an unknown gate. |
117
+
118
+ Evidence: fixture rows G1–G7 in `ci/mechanism-468-dispatch-cli.test.js` (real entry, stubbed runners). The registry is a v1 list of gates C8 can assess; gates outside it are refused rather than assumed.
119
+
120
+ ## Managed scratch and lifecycle (#466 D-scratch)
121
+
122
+ This is #466 policy within C8, entered only with `--assignment`. In managed mode `--scratch` names the canonical external **root**, not the child `TMPDIR`. Unmanaged invocations (no `--assignment`) are unchanged: `--scratch` is used directly and nothing is removed.
123
+
124
+ | Step | Behavior |
125
+ | --- | --- |
126
+ | Root check | Same `UNSAFE_SCRATCH` (`11`) validation as before, on the canonical path: a root inside any repository or linked worktree, including through a symlink or a symlinked ancestor, or crossing a dangling symlink or unresolved symlink chain at the root or any ancestor, is refused before any slot, directory, report, or child exists. |
127
+ | Attempt dir | After validation and admission, C8 creates `<root>/attempt-<random>` with `mkdtemp` (distinct for concurrent attempts, even on one root). It is re-resolved after creation; one that lands inside a repository is removed and refused. It is the child `TMPDIR` and holds readiness/run/report-writer logs and Codex raw output. |
128
+ | Checked DONE | Report validated and not BLOCKED: the logs and raw output are copied to `<root>/retained/<attempt>/` (outside the run dir), each copy is size-verified, and only then this attempt's own directory is removed. The JSON `evidence` paths point at the retained copies. Other attempt dirs are never touched. The report stays at `--report`. |
129
+ | BLOCKED (`17`), failure (`12`/`13`/`15`/`16`) | The attempt dir and all available evidence are kept. |
130
+ | Retention failure | Returns `20 EVIDENCE_RETENTION_FAILED` (phase `retention`) although the report was valid; the attempt dir and evidence are kept, and `evidence` points at them. |
131
+ | `--dry-run` | Creates no root, attempt dir, or child. |
132
+
133
+ | Exit | JSON `code` | Meaning |
134
+ | --- | --- | --- |
135
+ | `20` | `EVIDENCE_RETENTION_FAILED` | Managed DONE could not copy and verify its evidence outside the run dir; nothing was deleted. |
136
+
137
+ Scratch and evidence have different lifetimes: scratch is disposable only after a checked DONE has usable retained evidence. Evidence: fixture rows S1–S8 in `ci/mechanism-468-dispatch-cli.test.js`.
138
+
139
+ ## Managed per-pool admission (#466 D-admission)
140
+
141
+ In managed mode (`--assignment`), C8 requires `--admission-policy <path>` (resolved from the worktree when relative) and atomically reserves one slot for the selected credential or shared quota pool before readiness. Without `--assignment`, unmanaged invocations are unchanged and take no reservation (`--admission-policy` without `--assignment` returns `10 INVALID_INPUT`).
142
+
143
+ ```json
144
+ {
145
+ "schemaVersion": 1,
146
+ "dir": "/abs/external/admission-dir",
147
+ "pools": {
148
+ "opencode-pilot-key": { "cap": 2 },
149
+ "agy-shared-pool": { "cap": 1 }
150
+ },
151
+ "routes": [
152
+ { "runner": "opencode", "model": "fixture/opencode-model", "pool": "opencode-pilot-key" },
153
+ { "runner": "opencode", "model": "fixture/opencode-alias", "pool": "opencode-pilot-key" },
154
+ { "runner": "agy", "model": "gemini-4-neon-medium", "pool": "agy-shared-pool" }
155
+ ]
156
+ }
157
+ ```
158
+
159
+ - **Strict validation (`21 ADMISSION_POLICY_INVALID`, phase `admission`):** exact root keys (`schemaVersion: 1`, `dir`, `pools`, `routes`); `dir` must be an absolute directory outside every Git repository/worktree (reusing the canonical path check from D-scratch) and disjoint from `--scratch`; `pools` maps opaque pool ids (`^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$`) to `{ "cap": <integer >= 1> }`; `routes` maps unique `(runner, model)` pairs to defined pools; the selected `(runner, model)` must have a route. Missing, malformed, or unknown policies refuse before spawn.
160
+ - **Opaque identity, no credentials:** pool ids are operator-supplied opaque names. C8 never derives identity from environment secrets and never emits credential values in JSON, slot files, or evidence. Aliases sharing a pool consume the same cap even across different scratch roots.
161
+ - **Atomic bounded slots:** `<dir>/<pool>/slot-<0..cap-1>.json` created with `O_EXCL` (`wx`). Each slot records `{ schemaVersion: 1, pool, slot, holderPid, childPid, startedAt }`, updating `childPid` when a child spawns and clearing it after the child exits.
162
+ - **Over-cap refusal (`22 ADMISSION_CAP_REACHED`, phase `admission`):** no queueing. If all `cap` slots are occupied (including live, abandoned, corrupt, or indeterminate slot files), the excess attempt refuses before spawn and creates no scratch attempt dir; independent pools remain eligible.
163
+ - **Release and coordinator manual slot recovery:** DONE, BLOCKED, readiness failure, runner failure, timeout, and report/retention errors release the owned slot in `finally` after the child has ended (verifying ownership before unlink). Automatic stale-slot reclamation is disabled for the pilot: any existing slot file — including an abandoned, corrupt, or indeterminate reservation — is treated as occupied and is never displaced by contenders. To recover an abandoned slot, the coordinator must first quiesce admission for that pool, confirm that the recorded `holderPid` and any `childPid` (and any spawned child process) have ended and are absent, and only then remove the stale `slot-<k>.json` file before resuming admission.
164
+ - **`--dry-run`:** validates the policy and route and returns `admission: { pool, cap }` without creating `dir` or taking any reservation.
165
+
166
+ | Exit | JSON `code` | Meaning |
167
+ | --- | --- | --- |
168
+ | `21` | `ADMISSION_POLICY_INVALID` | Managed admission policy is missing, malformed, unsafe, or has no route for the selected runner/model. |
169
+ | `22` | `ADMISSION_CAP_REACHED` | Selected admission pool is at cap; excess attempt refused before spawn (no queueing). |
170
+
171
+ Admission bounds concurrency; a provider can still return quota exhaustion at concurrency one. Evidence: fixture rows R1–R10 in `ci/mechanism-468-dispatch-cli.test.js`.
172
+
77
173
  ## #466 boundary
78
174
 
79
- #466 owns automatic `TMPDIR` selection and lifecycle, enforcement across launch paths, per-key admission/reservation, and refusing packets that declare worker `gh`/network needs. This CLI accepts coordinator-supplied inputs for one attempt and cannot certify those launcher guarantees. It also does not add a distributed plugin command or run a live provider.
175
+ #466 still owns enforcement across launch paths, refusing packets that declare worker `gh`/network needs (no network capability is assessed here), and any live `agy` pilot. Managed gate assignment, managed scratch, the `agy` headless runner adapter, and managed per-pool admission above are the #466 policy implemented in C8. This CLI otherwise accepts coordinator-supplied inputs for one attempt and cannot certify launcher guarantees outside C8. It also does not add a distributed plugin command or run a live provider.
@@ -61,7 +61,7 @@ npm run test:plugin:submission
61
61
 
62
62
  OpenAI documents GitHub marketplace import for workspace administrators. The repository provides both `.agents/plugins/marketplace.json` and `.claude-plugin/marketplace.json`; the source entry resolves to `plugins/harness-everything/`.
63
63
 
64
- Use the repository URL as the source, leave Path empty so the marketplace is read from the repository root, and select the intended branch (normally `main`). In ChatGPT, use **Workspace settings > Plugins > Add > Import marketplace**, review the import results, and set the workspace installation policy. OpenAI documents automatic daily synchronization and a **Sync now** action for later refreshes.
64
+ Use the repository URL as the source, leave Path empty so the marketplace is read from the repository root, and select the intended branch (normally `main`). In the OpenAI Admin Console, select the workspace and use **Plugins > Add > Import marketplace**. Save the import report with the source/ref and client version, set the installation policy, then install and invoke a representative skill from a fresh eligible member session. Use **Marketplaces > Sync now** after a branch update and retain the sync report and the updated skill result. OpenAI also documents automatic daily sync.
65
65
 
66
66
  This repository contains the marketplace/package artifacts and deterministic import-shape checks. It does not contain a managed-workspace import report or a fresh host smoke-test artifact, so those operations remain `Unknown` in the compatibility matrix.
67
67
 
@@ -74,7 +74,7 @@ The local package path is distinct from the general `--codex` installer. The gen
74
74
  The package tests prove the following repository-side contract:
75
75
 
76
76
  - the portable root manifest and `.codex-plugin` compatibility manifest agree on identity, version, interface, and hook entry point;
77
- - the root `skills/` tree contains exactly the 27 canonical skills;
77
+ - the root `skills/` tree contains the canonical skills;
78
78
  - Windows and POSIX hook commands resolve through `PLUGIN_ROOT`;
79
79
  - session start emits the compact policy and prompt submission invokes invariant-first routing;
80
80
  - supported local `Bash` and `apply_patch` calls receive the packaged guards and state tracking;
@@ -93,13 +93,9 @@ Build the final upload from the synchronized package:
93
93
  npm run plugin:submission:build
94
94
  ```
95
95
 
96
- The generated ZIP contains only `skills/<name>/...` files from `plugins/harness-everything/skills/`. It does **not** include the local `.codex-plugin` lifecycle hooks, MCP definitions, or a fake app wrapper. The generated manifest records every path, byte count, file hash, and final bundle hash; repeated builds from the same revision must match.
96
+ The generated ZIP has a portable root `plugin.json` and the synchronized `skills/<name>/...` tree. It does **not** include the local `.codex-plugin` lifecycle hooks, MCP definitions, or app wrappers. The generated checksum manifest records each file and the ZIP SHA-256. OpenAI documents a supported plugin manifest as an upload requirement. [Submission error reference](https://developers.openai.com/plugins/deploy/submission-errors#plugin-manifest-errors)
97
97
 
98
- The submission source files in [`../submission/openai/`](../submission/openai/) model the official review inputs: listing metadata, starter prompts, release notes, exactly five positive cases, and exactly three negative cases. Positive cases specify the prompt, expected skill/workflow behavior, expected result shape, and fixture/account data. Negative cases specify the prompt/scenario, expected refusal/clarification/safe fallback, and why completion is not appropriate.
99
-
100
- The official portal flow is: **Create plugin → Skills only → upload the final skill bundle → provide review cases and listing metadata → complete identity, availability, policy, and access requirements → submit for review → publish after approval**. The repository cannot complete verified identity, logo upload, availability selection, Apps Management write access, review, approval, or public-directory publication.
101
-
102
- Official documentation: [Submit a plugin](https://developers.openai.com/plugins/deploy/submission) and [Build plugins](https://developers.openai.com/plugins/build/plugins).
98
+ The [public submission runbook](../submission/openai/README.md) covers the developer identity, ZIP upload, automated scans, and publication. It also links to the project smoke cases for a fresh session. Use the [OpenAI submission guide](https://developers.openai.com/plugins/deploy/submission) to confirm the portal requirements.
103
99
 
104
100
  ## Evidence boundary
105
101
 
@@ -109,10 +105,10 @@ The local plugin and public Skills-only artifact must not be conflated:
109
105
  | --- | --- | --- |
110
106
  | Portable/root plugin package | Manifest, tree, hook, and routing mechanism tests | Package shape and local mechanism are verified |
111
107
  | Managed workspace marketplace | Marketplace JSON and source-path checks | Import-ready repository artifact; live import remains unverified |
112
- | Public Skills-only ZIP | Deterministic builder and 5+3 review-input checks | Reproducible skills bundle; approval and live public behavior remain unverified |
108
+ | Public Skills-only ZIP | Deterministic builder, portable manifest, and smoke-case inputs | Reproducible skills bundle; approval and live public behavior remain unverified |
113
109
 
114
110
  See the [platform capability matrix](platform-capabilities.md) for the complete ten-dimension status table and official source URLs.
115
111
 
116
112
  ## Publication smoke checklist
117
113
 
118
- Before public submission, run `plugin:sync`, both OpenAI package checks, and the platform compatibility check. Confirm all 26 skills are content-identical to canonical sources after EOL normalization, the ZIP is reproducible, public links are current, the publisher identity and Apps Management access are ready, and final reviewer-facing cases run against the exact submitted skills tree.
114
+ Before public submission, run `plugin:sync`, both OpenAI package checks, and the platform compatibility check. Check that the packaged skills match canonical sources after EOL normalization and that the ZIP is reproducible. Confirm the publisher identity and portal permissions, and run the project smoke cases against the exact bundle being submitted.
@@ -30,6 +30,13 @@ recovery state intact and is audited as `unknown` for observed gated actions.
30
30
  Edits are still tracked when the outcome is unknown because side effects may
31
31
  already have occurred.
32
32
 
33
+ [Windows CLI 0.172.0 evidence](../benchmarks/results/live-host/codex-2026-11-26-488-post-tool-use/README.md)
34
+ shows that UnifiedExec with PowerShell and Git Bash delivers only a string in
35
+ `PostToolUse.tool_response`. A command that yielded and then completed through
36
+ `write_stdin` delivered an empty string response on both shells. Structured exit
37
+ status appears in the separate CLI event stream. Automatic verification credit
38
+ through the hook depends on Codex exposing structured status in the hook payload.
39
+
33
40
  Codex `SubagentStop` uses the documented JSON `systemMessage` field for a UI-only
34
41
  warning when the scope audit detects a new violation. Each audit advances the
35
42
  Git status baseline and replaces `subagent-scope-last.json`. A later silent stop
@@ -38,6 +45,14 @@ can therefore coexist with unresolved changes. The coordinator owns
38
45
  even when the hook is silent. The source and package fixtures cover these
39
46
  behaviors. Windows host delivery remains to be verified.
40
47
 
48
+ ### Antigravity Windows shell handoff
49
+
50
+ [AGY CLI 1.5.17 evidence](../benchmarks/results/live-host/agy-2026-11-26-516-read-only/README.md)
51
+ records live delivery of two read-only Windows shell probes to the packaged
52
+ AGY hooks. Both probes left edit and verification timestamps unset, and the
53
+ patched Stop hook allowed termination. These payloads omitted structured exit
54
+ status, so they could not grant automatic verification credit.
55
+
41
56
  ### Routing contract vs. host evidence
42
57
 
43
58
  The workflow plan controller rejects present non-array required/optional binding declarations before recording a requirement plan. This input-validation contract is covered by deterministic mechanism tests and does not change live-host evidence status.
package/docs/routing.md CHANGED
@@ -75,6 +75,8 @@ End the final message of **every** turn with one line that rendered Markdown hid
75
75
 
76
76
  It states the agent's own judgement after the work, not a copy of the router's suggestion. `invalid` means the prompt cannot be understood from its own text and needs conversation context; agent-written dispatches and worker instructions are ordinary prompts. The remaining keys record `tier` under tier rules v2, up to three `intents`, the `workflow` strategy and the `skills` actually used. The observation collector stores it as training data ([system-one-observations.md](system-one-observations.md)). A missing or malformed line is recorded with a reason code; it never blocks a turn or changes routing.
77
77
 
78
+ Use JSON `null` for `workflow` when the strategy is deferred or no strategy was selected. Otherwise use the strategy id actually used.
79
+
78
80
  Tier values:
79
81
 
80
82
  | Tier | Meaning |
@@ -4,7 +4,7 @@ description: "Bootstrap a local error ledger for an existing repository by inven
4
4
  license: Apache-2.0
5
5
  metadata:
6
6
  author: Miya Daniel
7
- version: 1.2.0
7
+ version: 1.3.0
8
8
  ---
9
9
 
10
10
  # Error Ledger Bootstrap
@@ -14,13 +14,26 @@ Bug/regression/flake labels or `fix`/`bug` title prefixes qualify; reports keep
14
14
  - `--hide-ledger` excludes existing error-ledger files from the scan.
15
15
  - `--home <dir>` changes the local home used to resolve automatic memory.
16
16
 
17
+ - **Redaction scope:** the opaque-ref/no-excerpt rules below apply only to fields derived from local-store rows. Git, doc and tracker fields in the same report keep their own sanitization (repo-existing sites, issue reference only); local-store redaction does not rewrite them. The whole combined report still follows the privacy rules below and stays local.
18
+
17
19
  ## Optional local error store
18
20
 
19
- Local observations are opt-in: `--source local-store --destination harness|project`. With no `--source` option, the scanner keeps the legacy report bytes and source set. `--destination` is required with this source and accepts only `harness` or `project`; it is the operator's declaration for the canonical Git `--root`.
21
+ Local observations are opt-in: `--source local-store --destination <harness-or-project>`. With no `--source` option, the scanner keeps the legacy report bytes and source set. `--destination` is required with this source and accepts exactly one of `harness` or `project` (the `harness|project` notation is not a literal value); it is the operator's declaration for the canonical Git `--root`, not a router to another repository.
22
+
23
+ The scanner derives the workspace key from that root, calls the supported reader as `listRecords({ workspaceRoot, workspaceKey })`, and accepts only returned rows carrying that key. A bound host workspace that disagrees fails closed. The report binds the resolved destination to an opaque `workspaceRef`; each record ref is `p-local-<sha256>` over the workspace key and validated stored provisional ID. Raw provisional IDs are never reported.
20
24
 
21
- The scanner derives the workspace key from that root, calls the supported reader as `listRecords({ workspaceRoot, workspaceKey })`, and accepts only returned rows carrying that key. A bound host workspace that disagrees fails closed. The report binds the resolved destination to an opaque `workspaceRef`; each record ref is `p-local-<sha256>` over the workspace key and validated stored provisional ID. Raw provisional IDs are never reported. If the reader contract is absent (including the packaged Skills-only copy), the scan succeeds with source status `unavailable` and reason `reader-unavailable`.
25
+ | Reader condition | Source status / reason | Recovery |
26
+ | --- | --- | --- |
27
+ | Reader module missing (the packaged Skills-only copy has no `hooks/scripts/lib/local-errors.js`) | `unavailable` / `reader-unavailable` | Re-scan from a trusted full Harness checkout with the command below. |
28
+ | Reader module present but its contract/API is incomplete (for example a missing `DESTINATIONS` export) | `unavailable` / `reader-contract-incomplete` | Repair that checkout's reader, then re-scan. |
22
29
 
23
- The `local-store` source status is `used`, `missing`, `unverified`, or `unavailable`. Missing indexes use `index-missing`; unreadable or corrupt input uses a sanitized reason such as `store-unreadable`, `store-corrupt`, or `store-unsupported`. An empty reader result is `unverified` (`empty-reader-result`) because the reader returns an empty array for both an empty workspace and several read failures. Invalid rows are skipped and counted as `malformed`; they are never quoted. The report separately counts valid rows assigned to another destination and rows whose destination is `unknown`.
30
+ Both conditions yield zero local leads, keep the other sources, and fail closed; neither implies routing to another repository. Full-checkout recovery command (choose one destination value, not the literal `harness|project`):
31
+
32
+ ```sh
33
+ node "<Harness checkout>/error-ledger-bootstrap/scripts/scan.js" --root "<target>" --no-memory --source local-store --destination harness --out "<private dir outside target>" --json
34
+ ```
35
+
36
+ The `local-store` source status is `used`, `missing`, `unverified`, or `unavailable`. Missing local-store indexes use `index-missing`; unreadable or corrupt input uses a sanitized reason such as `store-unreadable`, `store-corrupt`, or `store-unsupported`. A missing destination ledger directory or `index.jsonl` reports `ledgerStatus: unverified` / `ledgerReason: ledger-missing`; unreadable or corrupt ledger uses `ledger-unreadable` / `ledger-corrupt`. An empty reader result is `unverified` (`empty-reader-result`) because the reader returns an empty array for both an empty workspace and several read failures. Invalid rows are skipped and counted as `malformed`; they are never quoted. The report separately counts valid rows assigned to another destination and rows whose destination is `unknown`.
24
37
 
25
38
  Each valid destination-matched provisional lesson yields one neutral local lead. Occurrences are grouped by exact signature and suppressed when a selected lesson covers that signature. JSON and Markdown contain only opaque refs, validated destination/kind/command-class metadata, signatures, counts, and dedupe/evidence results. They never include excerpts, cues, lesson text, issue URLs, paths, session IDs, or tool-use IDs. Keep the reports local; the local store and destination ledger are read-only during scan.
26
39
 
@@ -38,9 +51,9 @@ Obtain explicit owner approval for each candidate. Bind the approval to the exac
38
51
 
39
52
  The top-level approval JSON has `schemaVersion: 1`, a 20-character hexadecimal `candidateId`, a 64-character hexadecimal `reportSha256` of the exact report bytes, an absolute canonical `targetRoot` matching `--target`, a non-empty `approvedBy`, and a parseable `approvedAt` timestamp. Its `record` object has a kebab-case `signature`; non-empty `class`, `title`, `violates`, and `sourcesNote`; `scope` of `in`, `out`, or `unresolved`; `status` of `open`, `lesson`, or `mechanism`; and `sites`, an array of existing target-repository files named by relative paths without absolute paths or `.` or `..` components. Do not put absolute paths in `approvedBy`, `approvedAt`, or the record text fields. The approved candidate must occur exactly once in the report, and the selected and approved site files must exist in the target.
40
53
 
41
- For a candidate with a `local-store` source, also include top-level `destination: harness` or `destination: project` in the approval. Promotion requires one `used` workspace binding whose opaque ref resolves to canonical `--target` through the trusted Harness checkout's local-store reader; every candidate ref must still resolve to a row for that workspace and destination. The report's exact-dedupe result must be eligible, and the candidate must carry a verified Git or documentation commit source that exists in the target repository on that same candidate. Promotion rechecks exact signature and whole-rule dedupe against the current destination ledger while holding the promotion lock. Missing, unknown, mismatched, stale, or unreadable local bindings fail closed before ledger changes. Legacy reports without a local-store source keep their existing approval shape. A stored issue URL is only a local lead and never satisfies the durable-source requirement.
54
+ For a candidate with a `local-store` source, also include exactly one top-level `destination: harness` or `destination: project` in the approval, matching the report's `--destination`. Promotion requires one `used` workspace binding whose opaque ref resolves to canonical `--target` through the trusted Harness checkout's local-store reader; every candidate ref must still resolve to a row for that workspace and destination. The report's exact-dedupe result must be eligible, and the candidate must carry a verified Git or documentation commit source that exists in the target repository on that same candidate. Promotion rechecks exact signature and whole-rule dedupe against the current destination ledger while holding the promotion lock. Missing, unknown, mismatched, stale, or unreadable local bindings fail closed before ledger changes. Legacy reports without a local-store source keep their existing approval shape. A stored issue URL is only a local lead and never satisfies the durable-source requirement.
42
55
 
43
- Use this complete example as the approval file structure, replacing the sample candidate ID and digest with the exact report values, `targetRoot` with the target's absolute canonical path, and the approver, timestamp, and reviewed record content with the owner's approval:
56
+ Use this example as the approval structure, replacing the sample candidate ID and digest with the exact report values, `targetRoot` with the target's absolute canonical path, and the approver, timestamp, and reviewed record content with the owner's approval. A local-store approval includes the top-level `destination` shown here; a legacy approval omits that field.
44
57
 
45
58
  ```json
46
59
  {
@@ -48,6 +61,7 @@ Use this complete example as the approval file structure, replacing the sample c
48
61
  "candidateId": "0123456789abcdef0123",
49
62
  "reportSha256": "0000000000000000000000000000000000000000000000000000000000000000",
50
63
  "targetRoot": "/absolute/path/to/target",
64
+ "destination": "harness",
51
65
  "approvedBy": "Owner Name",
52
66
  "approvedAt": "2026-11-20T00:00:00.000Z",
53
67
  "record": {
@@ -65,13 +79,34 @@ Use this complete example as the approval file structure, replacing the sample c
65
79
 
66
80
  Do not promote an unapproved, changed, or stale candidate. Keep full candidate reports and private inputs out of E-records, PRs, shared logs, and uploads.
67
81
 
68
- Promotion requires the target to already contain `.agents/harness-everything/errors/`. Before the first promotion, create that directory once:
82
+ Promotion requires the target to already contain `.agents/harness-everything/errors/`; it refuses when the directory is absent. Create that directory once:
83
+
84
+ ```sh
85
+ mkdir -p "<target repo>/.agents/harness-everything/errors"
86
+ ```
87
+
88
+ | Candidate source | Index precondition before scan and approval |
89
+ | --- | --- |
90
+ | Legacy (no `local-store` source) | No index file needed beforehand; the first promotion creates it through the sync command below. |
91
+ | `local-store` | `index.jsonl` must already exist and be current in the target. Create/refresh it from the trusted checkout with `node "<Harness checkout>/scripts/errors-sync.js" --root "<target repo>"`. A missing index leaves scan dedupe `unverified` (`ledger-missing`). Scan does not detect a stale index; promotion rechecks it under lock and fails closed (`destination ledger index is stale or unavailable`). Never bypass either; refresh, rescan and reapprove. |
92
+
93
+ Copyable first-promotion sequence for a `local-store` lead:
69
94
 
70
95
  ```sh
96
+ # 1. Target ledger directory and index (an empty ledger is fine)
71
97
  mkdir -p "<target repo>/.agents/harness-everything/errors"
98
+ node "<Harness checkout>/scripts/errors-sync.js" --root "<target repo>"
99
+
100
+ # 2. Scan from the trusted full checkout, not the packaged Skills-only copy
101
+ node "<Harness checkout>/error-ledger-bootstrap/scripts/scan.js" \
102
+ --root "<target repo>" --no-memory --source local-store --destination harness \
103
+ --out "<private dir outside target>" --json
104
+
105
+ # 3. Classify locally; obtain fresh per-item approval bound to the exact report bytes
106
+ # 4. Promote with the packaged script below
72
107
  ```
73
108
 
74
- Promotion refuses when the directory is absent. No index file is needed beforehand; successful promotion updates the index through the sync command below.
109
+ If the index was missing or stale, re-run step 1 **before** step 2, then rescan and reapprove the new `reportSha256`; an approval bound to earlier report bytes is stale.
75
110
 
76
111
  Before promotion, resolve a trusted local Harness checkout containing `scripts/errors-sync.js` and verify its Node dependencies are installed. Local-store candidates also require `hooks/scripts/lib/local-errors.js` in that checkout. The current sync script requires `js-yaml`; a read-only preflight is:
77
112