harness-everything 0.53.0 → 0.54.1

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 (83) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/AGENTS.md +3 -1
  4. package/CHANGELOG.md +26 -0
  5. package/bin/cli.js +1 -0
  6. package/ci/action-gate.test.js +1 -1
  7. package/ci/invariant-routing.test.js +22 -3
  8. package/ci/mechanism-2al-codex-hooks-compat.test.js +56 -2
  9. package/ci/mechanism-2at-fable-execution-phases.test.js +38 -0
  10. package/ci/mechanism-349-ci-change-scope.test.js +78 -57
  11. package/ci/mechanism-397-cycle-import.test.js +18 -3
  12. package/ci/mechanism-check-packet-write-set.test.js +232 -0
  13. package/ci/mechanism-codex-hook-results.test.js +145 -0
  14. package/ci/mechanism-codex-prompt-pass-through.test.js +8 -4
  15. package/ci/mechanism-error-handling-map.test.js +219 -0
  16. package/ci/mechanism-report-writer.test.js +335 -0
  17. package/ci/openai-plugin-runtime.test.js +2 -1
  18. package/ci/prompt-contract-regressions.test.js +6 -2
  19. package/ci/router-workflow-plan.test.js +50 -7
  20. package/docs/architecture.md +4 -3
  21. package/docs/error-handling/README.md +250 -0
  22. package/docs/error-handling/actions/c1-action-map.md +89 -0
  23. package/docs/error-handling/actions/c2-action-map.md +22 -0
  24. package/docs/error-handling/actions/c3-action-map.md +26 -0
  25. package/docs/error-handling/actions/c5-action-map.md +31 -0
  26. package/docs/error-handling/actions/c6-action-map.md +37 -0
  27. package/docs/error-handling/actions/c7-action-map.md +18 -0
  28. package/docs/error-handling/actions/e0002-action-map.md +101 -0
  29. package/docs/error-handling/activity.puml +84 -0
  30. package/docs/error-handling/details/c1-authority-conformance.md +93 -0
  31. package/docs/error-handling/details/c2-test-root-containment.md +35 -0
  32. package/docs/error-handling/details/c3-mode-ownership.md +50 -0
  33. package/docs/error-handling/details/c5-host-replay-contract.md +40 -0
  34. package/docs/error-handling/details/c6-packet-briefing.md +65 -0
  35. package/docs/error-handling/details/c7-write-set-check.md +54 -0
  36. package/docs/error-handling/details/e0002-capture-evidence.md +93 -0
  37. package/docs/error-handling/details/e0002-report-writer.md +116 -0
  38. package/docs/error-handling/nodes.yaml +44 -0
  39. package/docs/error-handling/registry.md +59 -0
  40. package/docs/error-handling/templates/packet-briefing.md +45 -0
  41. package/docs/platform-capabilities.md +20 -1
  42. package/fable-mode/SKILL.md +5 -5
  43. package/fable-mode/execution-guardrails/SKILL.md +1 -1
  44. package/fable-mode/fable-haiku/SKILL.md +1 -1
  45. package/fable-mode/fable-opus/SKILL.md +1 -1
  46. package/fable-mode/fable-sonnet/SKILL.md +1 -1
  47. package/fable-mode/references/execution-phases.md +26 -4
  48. package/hooks/scripts/action-gate.js +5 -0
  49. package/hooks/scripts/codex-action-gate-post.js +3 -12
  50. package/hooks/scripts/codex-user-prompt.js +2 -3
  51. package/hooks/scripts/contract-test.js +17 -7
  52. package/hooks/scripts/lib/codex-tool-outcome.js +28 -0
  53. package/hooks/scripts/rule-of-3-tracker.js +11 -4
  54. package/hooks/scripts/state-persist.js +15 -9
  55. package/hooks/scripts/subagent-scope-guard.js +32 -25
  56. package/hooks/scripts/subagent-start.js +1 -1
  57. package/hooks/scripts/subagent-stop.js +14 -3
  58. package/opencode-plugin/plugin.json +1 -1
  59. package/package.json +2 -1
  60. package/plugins/harness-everything/.codex-plugin/plugin.json +1 -1
  61. package/plugins/harness-everything/hooks/hooks.json +6 -6
  62. package/plugins/harness-everything/hooks/scripts/action-gate.js +5 -0
  63. package/plugins/harness-everything/hooks/scripts/codex-action-gate-post.js +3 -12
  64. package/plugins/harness-everything/hooks/scripts/codex-user-prompt.js +2 -3
  65. package/plugins/harness-everything/hooks/scripts/contract-test.js +17 -7
  66. package/plugins/harness-everything/hooks/scripts/lib/codex-tool-outcome.js +28 -0
  67. package/plugins/harness-everything/hooks/scripts/rule-of-3-tracker.js +11 -4
  68. package/plugins/harness-everything/hooks/scripts/state-persist.js +15 -9
  69. package/plugins/harness-everything/hooks/scripts/subagent-scope-guard.js +32 -25
  70. package/plugins/harness-everything/hooks/scripts/subagent-start.js +1 -1
  71. package/plugins/harness-everything/hooks/scripts/subagent-stop.js +14 -3
  72. package/plugins/harness-everything/plugin.json +1 -1
  73. package/plugins/harness-everything/skills/fable-mode/SKILL.md +5 -5
  74. package/plugins/harness-everything/skills/fable-mode/execution-guardrails/SKILL.md +1 -1
  75. package/plugins/harness-everything/skills/fable-mode/fable-haiku/SKILL.md +1 -1
  76. package/plugins/harness-everything/skills/fable-mode/fable-opus/SKILL.md +1 -1
  77. package/plugins/harness-everything/skills/fable-mode/fable-sonnet/SKILL.md +1 -1
  78. package/plugins/harness-everything/skills/fable-mode/references/execution-phases.md +26 -4
  79. package/sbom.cdx.json +7 -7
  80. package/scripts/check-packet-write-set.js +155 -0
  81. package/scripts/codex-hooks-compat.js +46 -5
  82. package/scripts/error-handling-map.js +288 -0
  83. package/scripts/report-writer.js +261 -0
@@ -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": "0.53.0",
13
+ "version": "0.54.1",
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": "0.53.0",
4
+ "version": "0.54.1",
5
5
  "author": {
6
6
  "name": "Miya Daniel"
7
7
  },
package/AGENTS.md CHANGED
@@ -92,7 +92,9 @@ flowchart LR
92
92
  V -. optional .-> N["-- --node22<br/>(Node 22 smoke lane)"]
93
93
  ```
94
94
 
95
- - `npm run verify:all` runs every CI gate category and prints paste-ready evidence. Individual gates: `npm test`, `npm run test:mutations`, `test:mechanism`, `test:consistency`, `test:repo-contract`, `test:docs:capabilities`, `test:references`, `test:release`, `test:collision`, `test:routing:skills`, `test:routing:invariants`, `test:plugin:openai`, `test:plugin:submission`, `test:platform:compatibility`, `test:portability`.
95
+ - `npm run verify:all` runs a local subset of the hosted `ci.yml` gates and prints paste-ready PASS/FAIL/UNCHECKED evidence: 12 rows in the full plan, 4 with `--fast` (`npm test`, `test:mutations`, `test:consistency`, `test:portability`).
96
+ - Full rows: `npm test`, `test:mutations`, `test:consistency`, `test:references`, `test:release`, `test:collision`, `test:routing:skills`, `test:routing:invariants`, `test:plugin:openai`, `test:plugin:submission`, `test:platform:compatibility`, `test:portability`. `test:mechanism` runs inside `npm test`; `test:repo-contract` and `test:docs:capabilities` run inside `test:consistency`. Hosted CI runs the two `test:routing:*` rows inside `self-regression`.
97
+ - Hosted `ci.yml` jobs it does not run: `pilot-offline-evidence`, both System One Windows runtime-pin jobs, `release-semantics` (`test:release:semantics`), `skill-quality` (waza per-skill checks; only the optional `waza:check` row runs, and only when waza is installed), `installer-e2e` (`ci/installer-roundtrip.test.js`) and `npm ci` under Node 22 in `runtime-floor`. Local rows also run on one OS, where hosted `self-regression` and `consistency` run three.
96
98
  - With waza (`~/bin/waza`): `waza check <skill-dir>`, `waza spec verify <skill> evals/<skill>/eval.yaml --fail --threshold 1`, `waza tokens check`.
97
99
  - CI runs Node.js 24 on Ubuntu/Windows/macOS plus a Node.js 22 floor lane ([repository-contract.md](docs/repository-contract.md)). Node 22 install compatibility stays UNCHECKED locally.
98
100
  - Never report "it works" from code reading. Name the evidence layer: package, deterministic mechanism, live host or behavior.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,28 @@
2
2
 
3
3
  All notable changes to this project are documented in this file.
4
4
 
5
+ ## [0.54.1](https://github.com/dyphn1/Harness-everything/compare/v0.54.0...v0.54.1) (2026-11-20)
6
+
7
+ ### Bug Fixes
8
+
9
+ * **codex:** handle hook outcomes and subagent warnings ([420b36f](https://github.com/dyphn1/Harness-everything/commit/420b36f4f21e32d1ce416abbcda0c239a4ee0a8b))
10
+ * **fable:** move planning rules into execution phases and relax the prompt contract pin ([149bc78](https://github.com/dyphn1/Harness-everything/commit/149bc785ee9575c839f15a50ecb73606be0d3b0e)), closes [#476](https://github.com/dyphn1/Harness-everything/issues/476)
11
+ * **fable:** restore quoted skill description within the token budget ([7935939](https://github.com/dyphn1/Harness-everything/commit/7935939f4455ba4c885f8cfaa4b3bbb4de3a5ee5))
12
+
13
+ ## [0.54.0](https://github.com/dyphn1/Harness-everything/compare/v0.53.0...v0.54.0) (2026-11-19)
14
+
15
+ ### Features
16
+
17
+ * **scripts:** add a read-only write-set check for packet slices ([5953f34](https://github.com/dyphn1/Harness-everything/commit/5953f34e04cc0722f74f716ab0e53559dd1ff5ad)), closes [#402](https://github.com/dyphn1/Harness-everything/issues/402)
18
+ * **scripts:** add a report writer that owns the terminal status line ([54beeee](https://github.com/dyphn1/Harness-everything/commit/54beeee19f8eb95d90aa40b91228376493039968)), closes [#402](https://github.com/dyphn1/Harness-everything/issues/402) [#441](https://github.com/dyphn1/Harness-everything/issues/441)
19
+ * **scripts:** add new, set-status and check for the error handling map ([4f9afe2](https://github.com/dyphn1/Harness-everything/commit/4f9afe27de01ca1390a5f1b333831913f0df6a9e)), closes [#437](https://github.com/dyphn1/Harness-everything/issues/437) [#402](https://github.com/dyphn1/Harness-everything/issues/402) [#437](https://github.com/dyphn1/Harness-everything/issues/437)
20
+
21
+ ### Bug Fixes
22
+
23
+ * **codex:** migrate stale tier-router prompt hooks ([d6aa9a7](https://github.com/dyphn1/Harness-everything/commit/d6aa9a711fac5007dc68ccf25732d67da8c448a5))
24
+ * **scripts:** check the write-set of the repository the command runs in ([bcf3c57](https://github.com/dyphn1/Harness-everything/commit/bcf3c577e32a4d6061298059d14caf05eaae210a)), closes [#402](https://github.com/dyphn1/Harness-everything/issues/402)
25
+ * **scripts:** let the cli status complete raw codex output without status ([b61ebea](https://github.com/dyphn1/Harness-everything/commit/b61ebea855fc265feaa0f63715f9500e1ee96f4b)), closes [#402](https://github.com/dyphn1/Harness-everything/issues/402)
26
+
5
27
  ## [0.53.0](https://github.com/dyphn1/Harness-everything/compare/v0.52.0...v0.53.0) (2026-11-18)
6
28
 
7
29
  ### Features
@@ -74,6 +96,10 @@ All notable changes to this project are documented in this file.
74
96
  * **CI:** Skip the three-platform Node 24 self-regression matrix for pull requests limited to approved documentation, benchmark results, error ledger, or changelog paths.
75
97
  * **doc-reconciliation:** credit only correlated, bounded workflow-state operations for the approved row-17 outline cycle
76
98
 
99
+ ### Bug Fixes
100
+
101
+ * **codex:** report stale npx tier-router prompt hooks and let users migrate them to the JSON adapter (#457).
102
+
77
103
  ## [0.50.0](https://github.com/dyphn1/Harness-everything/compare/v0.49.0...v0.50.0) (2026-11-09)
78
104
 
79
105
  ### Features
package/bin/cli.js CHANGED
@@ -112,6 +112,7 @@ Commands:
112
112
  that fail to mount enabled plugin-bundled hooks.
113
113
  Usage: harness codex-hooks <install|status|uninstall>
114
114
  [--codex-home <path>] [--allow-unreleased-source]
115
+ Install option: --remove-legacy-tier-router
115
116
  Does not trust hooks or modify Codex config.toml.
116
117
  plugin-sync Install or update the native Harness plugin on Claude Code
117
118
  and Codex. Existing installations always take the update
@@ -348,7 +348,7 @@ try {
348
348
  check(pluginPost && pluginPost.hooks.some(hook => /codex-action-gate-post\.js/.test(hook.command)), 'Codex plugin infers action-gate outcome from supported PostToolUse');
349
349
  check(codexPost.inferOutcome({ tool_response: { exitCode: 0 } }) === 'success', 'Codex PostToolUse maps zero exit code to success');
350
350
  check(codexPost.inferOutcome({ tool_response: { exit_code: 2, stderr: 'failed' } }) === 'failure', 'Codex PostToolUse maps non-zero exit code to failure');
351
- check(codexPost.inferOutcome({ tool_response: { stderr: 'fatal: denied' } }) === 'failure', 'Codex PostToolUse conservatively recognizes failure stderr without exit code');
351
+ check(codexPost.inferOutcome({ tool_response: { stderr: 'fatal: denied' } }) === 'unknown', 'Codex PostToolUse treats stderr without a structured status as unknown');
352
352
  check(pluginHooks.hooks.Stop.some(group => group.hooks.some(hook => /action-gate\.js/.test(hook.command))), 'OpenAI plugin closes pending approvals at Stop');
353
353
 
354
354
  check(fs.readFileSync(rulesPath, 'utf8') === fs.readFileSync(pluginRules, 'utf8'), 'canonical and plugin action-gate rule tables are byte-identical');
@@ -1,12 +1,31 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
- const fs=require('fs'),path=require('path'),{spawnSync}=require('child_process');
3
+ const fs=require('fs'),path=require('path'),{spawnSync:spawnNodeSync}=require('child_process');
4
+ function spawnSync(command,args,options={}){
5
+ const {systemOneMode='off',...spawnOptions}=options;
6
+ return spawnNodeSync(command,args,{...spawnOptions,env:{...process.env,...(spawnOptions.env||{}),HARNESS_SYSTEM_ONE_MODE:systemOneMode}});
7
+ }
4
8
  const ROOT=path.resolve(__dirname,'..');let failed=0;
5
9
  function check(c,m){if(c)console.log(' PASS '+m);else{console.error(' FAIL '+m);failed++;}}
6
10
  function read(p){return fs.readFileSync(path.join(ROOT,p),'utf8');}
7
11
  console.log('=== Semantic Contract-Strength Routing Contract ===');
8
12
  const kernel=path.join(ROOT,'harness-everything/scripts/kernel-router.js');
9
- const tier2=spawnSync(process.execPath,[kernel,'add a login endpoint with tests and update the implementation'],{cwd:ROOT,encoding:'utf8'});
13
+ function runKernel(prompt, {systemOneMode='off'}={}){
14
+ return spawnSync(process.execPath,[kernel,prompt],{cwd:ROOT,encoding:'utf8',systemOneMode});
15
+ }
16
+ const priorMode=process.env.HARNESS_SYSTEM_ONE_MODE;
17
+ let inheritedLive;
18
+ try{
19
+ process.env.HARNESS_SYSTEM_ONE_MODE='live';
20
+ inheritedLive=runKernel('add a login endpoint with tests and update the implementation');
21
+ }finally{
22
+ if(priorMode===undefined)delete process.env.HARNESS_SYSTEM_ONE_MODE;
23
+ else process.env.HARNESS_SYSTEM_ONE_MODE=priorMode;
24
+ }
25
+ check(inheritedLive.status===0&&!inheritedLive.stdout.includes('SYSTEM ONE REFERENCE CONFIDENCE'),'kernel routing fixture ignores inherited live mode unless explicitly selected');
26
+ const explicitLive=runKernel('add a login endpoint with tests and update the implementation',{systemOneMode:'live'});
27
+ check(explicitLive.status===0&&explicitLive.stdout.includes('SYSTEM ONE REFERENCE CONFIDENCE'),'kernel routing fixture retains an explicit live-mode control');
28
+ const tier2=runKernel('add a login endpoint with tests and update the implementation');
10
29
  check(tier2.status===0,'kernel router exits successfully');
11
30
  check(/RECOMMENDED TIER:\s*Tier 2/i.test(tier2.stdout),'classifier result is preserved');
12
31
  check(tier2.stdout.includes('"strategy":"iterative-single"'),'Tier 2 selects iterative-single workflow');
@@ -30,7 +49,7 @@ check(!tier2.stdout.includes('HARNESS ROUTING CHECKPOINT (REQUIRED VISIBLE STATE
30
49
  check(tier2.stdout.includes('nested bullets when there are multiple items'),'kernel tells agents to split dense evidence into nested bullets');
31
50
  check(tier2.stdout.includes('semantic communication MUST, not a hard execution lock'),'kernel separates semantic MUST from mechanical blocking');
32
51
 
33
- const tier3=spawnSync(process.execPath,[kernel,'audit the entire repository architecture and coordinate multiple modules'],{cwd:ROOT,encoding:'utf8'});
52
+ const tier3=runKernel('audit the entire repository architecture and coordinate multiple modules');
34
53
  check(tier3.status===0,'Tier 3 routing exits successfully');
35
54
  check(/RECOMMENDED TIER:\s*Tier 3/i.test(tier3.stdout),'macro task remains Tier 3');
36
55
  check(tier3.stdout.includes('isolated-worktree-before-mutation'),'Tier 3 keeps the worktree isolation invariant');
@@ -5,6 +5,7 @@ const assert = require('assert');
5
5
  const fs = require('fs');
6
6
  const os = require('os');
7
7
  const path = require('path');
8
+ const { spawnSync } = require('child_process');
8
9
 
9
10
  const compat = require('../scripts/codex-hooks-compat');
10
11
 
@@ -62,6 +63,11 @@ const original = {
62
63
  fs.writeFileSync(hooksFile, JSON.stringify(original, null, 4) + '\n', 'utf8');
63
64
  fs.writeFileSync(configFile, 'model = "test"\n# user trust/config state\n', 'utf8');
64
65
  const configBefore = fs.readFileSync(configFile, 'utf8');
66
+ const npxRouterPath = '_npx/9abc123def/node_modules/harness-everything/harness-everything/scripts/tier-router.js';
67
+ const legacyWindows = {
68
+ type: 'command',
69
+ commandWindows: 'node "C:\\Cache Dir\\' + npxRouterPath.replace(/\//g, '\\') + '"',
70
+ };
65
71
 
66
72
  try {
67
73
  const installed = compat.install({ allowUnreleasedSource: true, codexHome });
@@ -215,6 +221,52 @@ try {
215
221
  fs.readFileSync(path.join(preexistingHome, 'hooks.json'), 'utf8') === preexistingBefore,
216
222
  'uninstall preserves byte-identical hooks that predated compatibility install');
217
223
 
224
+ const legacyHome = path.join(root, 'legacy-codex');
225
+ fs.mkdirSync(legacyHome);
226
+ const legacyFile = path.join(legacyHome, 'hooks.json');
227
+ const legacyConfigFile = path.join(legacyHome, 'config.toml');
228
+ const direct = { type: 'command', command: 'node "/cache dir/' + npxRouterPath + '"' };
229
+ const customized = { ...direct, commandWindows: 'node "C:\\user\\my-prompt-hook.js"' };
230
+ const chained = { ...direct, command: direct.command + ' && echo custom' };
231
+ const localRouter = { ...direct, command: 'node "/user/scripts/tier-router.js"' };
232
+ const preserved = { matcher: '.*', hooks: [customized, chained, localRouter] };
233
+ const otherEvent = { hooks: [direct] };
234
+ fs.writeFileSync(legacyConfigFile, configBefore);
235
+ fs.writeFileSync(legacyFile, JSON.stringify({ hooks: {
236
+ UserPromptSubmit: [{ ...preserved, hooks: [direct, ...preserved.hooks] }, { hooks: [legacyWindows, direct] }],
237
+ Stop: [otherEvent],
238
+ } }));
239
+ const beforeLegacyStatus = fs.readFileSync(legacyFile, 'utf8');
240
+ const legacyStatus = compat.status({ codexHome: legacyHome });
241
+ assert.strictEqual(legacyStatus.installed, false);
242
+ assert.deepStrictEqual(legacyStatus.legacyTierRouterHooks, [direct, legacyWindows, direct]);
243
+ assert.strictEqual(fs.readFileSync(legacyFile, 'utf8'), beforeLegacyStatus);
244
+
245
+ const legacyInstall = compat.install({ allowUnreleasedSource: true, codexHome: legacyHome });
246
+ assert.deepStrictEqual(legacyInstall.legacyTierRouterHooks, legacyStatus.legacyTierRouterHooks);
247
+ assert.deepStrictEqual(compat.status({ codexHome: legacyHome }).legacyTierRouterHooks, legacyStatus.legacyTierRouterHooks);
248
+
249
+ const migration = spawnSync(process.execPath, [
250
+ path.join(__dirname, '..', 'bin', 'cli.js'), 'codex-hooks', 'install',
251
+ '--codex-home', legacyHome, '--allow-unreleased-source', '--remove-legacy-tier-router',
252
+ ], { encoding: 'utf8', timeout: 30000 });
253
+ assert.strictEqual(migration.status, 0, migration.stderr || String(migration.error));
254
+ assert.strictEqual(JSON.parse(migration.stdout).removedLegacyTierRouterHooks, 3);
255
+ const migrated = read(legacyFile);
256
+ assert.deepStrictEqual(migrated.hooks.UserPromptSubmit[0], preserved);
257
+ assert.deepStrictEqual(migrated.hooks.Stop[0], otherEvent);
258
+ const promptCommands = migrated.hooks.UserPromptSubmit.slice(1).flatMap(group => group.hooks);
259
+ assert.deepStrictEqual(promptCommands.map(hook => path.posix.basename(hook.command).replace(/"$/, '')),
260
+ ['codex-user-prompt.js', 'observation-hook.js']);
261
+ assert.strictEqual(fs.readFileSync(legacyConfigFile, 'utf8'), configBefore);
262
+ const migratedStatus = compat.status({ codexHome: legacyHome });
263
+ assert.strictEqual(migratedStatus.healthy, true);
264
+ assert.deepStrictEqual(migratedStatus.legacyTierRouterHooks, []);
265
+ const retried = compat.install({ allowUnreleasedSource: true, codexHome: legacyHome, removeLegacyTierRouter: true });
266
+ assert.strictEqual(retried.removedLegacyTierRouterHooks, 0);
267
+ assert.deepStrictEqual(read(legacyFile), migrated);
268
+ console.log(' PASS opt-in migration removes only legacy prompt handlers, installs one adapter, and is idempotent (#457)');
269
+
218
270
  const forgedManifestHome = path.join(root, 'forged-manifest-codex');
219
271
  fs.mkdirSync(forgedManifestHome, { recursive: true });
220
272
  fs.writeFileSync(path.join(forgedManifestHome, 'hooks.json'),
@@ -241,7 +293,9 @@ try {
241
293
  fs.mkdirSync(failedInstallHome, { recursive: true });
242
294
  const failedInstallHooks = path.join(failedInstallHome, 'hooks.json');
243
295
  fs.writeFileSync(failedInstallHooks,
244
- JSON.stringify({ description: 'must survive', hooks: { PreToolUse: [userHook] } }, null, 4) + '\n',
296
+ JSON.stringify({ description: 'must survive', hooks: {
297
+ PreToolUse: [userHook], UserPromptSubmit: [{ hooks: [legacyWindows] }],
298
+ } }, null, 4) + '\n',
245
299
  'utf8');
246
300
  const failedInstallBefore = fs.readFileSync(failedInstallHooks, 'utf8');
247
301
  const failedManifestPath = path.join(
@@ -254,7 +308,7 @@ try {
254
308
  }
255
309
  return realRenameSync(source, destination);
256
310
  };
257
- try { compat.install({ allowUnreleasedSource: true, codexHome: failedInstallHome }); }
311
+ try { compat.install({ allowUnreleasedSource: true, codexHome: failedInstallHome, removeLegacyTierRouter: true }); }
258
312
  catch (error) { failedInstallRefused = /injected manifest commit failure/.test(error.message); }
259
313
  finally { fs.renameSync = realRenameSync; }
260
314
  check(failedInstallRefused &&
@@ -5,6 +5,8 @@ const fs = require('fs');
5
5
  const path = require('path');
6
6
 
7
7
  const ROOT = path.resolve(__dirname, '..');
8
+ const skill = fs.readFileSync(path.join(ROOT, 'fable-mode/SKILL.md'), 'utf8');
9
+ const packagedSkill = fs.readFileSync(path.join(ROOT, 'plugins/harness-everything/skills/fable-mode/SKILL.md'), 'utf8');
8
10
  const guide = fs.readFileSync(path.join(ROOT, 'fable-mode/references/execution-phases.md'), 'utf8');
9
11
  const packagedGuide = fs.readFileSync(path.join(ROOT, 'plugins/harness-everything/skills/fable-mode/references/execution-phases.md'), 'utf8');
10
12
  const contract = fs.readFileSync(path.join(ROOT, 'fable-mode/CONTRACT-FORMAT.md'), 'utf8');
@@ -43,4 +45,40 @@ assert.match(guide, /explicit user or\s+host runtime choice/i);
43
45
  assert.doesNotMatch(guide, /Resolve requested model|Opus macro work|do not silently change models/i);
44
46
  assert.match(guide.slice(legacyStart), /`\.claude\/harness-everything\/state\/contracts\//);
45
47
 
48
+ const workflow = skill.split('## Workflow\n')[1];
49
+ assert.strictEqual(packagedSkill, skill, 'OpenAI package includes the canonical Fable workflow');
50
+ const routing = [
51
+ '## USE FOR:',
52
+ '- Large multi-file, multi-source, or multi-session work',
53
+ '- Fable profile explanations or explicit Fable execution requests',
54
+ '- Work needing named delegation and cold verification',
55
+ '',
56
+ '## DO NOT USE FOR:',
57
+ '- One obvious single-pass edit',
58
+ '- Ordinary Tier 2 implementation or bugfix work',
59
+ '',
60
+ '## Select Operation First',
61
+ ].join('\n');
62
+ assert.ok(skill.includes(routing), 'the existing Fable routing text is preserved');
63
+ assert.match(workflow, /^1\. Discover the runtime and lock the authorized file scope before edits\.$/m);
64
+ assert.ok(skill.includes('Execution only: stage checklist and audit records.'));
65
+ assert.match(skill, /Execution: `<this-skill-dir>\/scripts\/model-selector\.js`, stage contracts, and `<skills-repo-root>\/harness-everything\/scripts\/verify-gate\.js`\./);
66
+ assert.ok(skill.includes('For explanation/profile-only lookup, read only `<this-skill-dir>/references/profile-lookup.md` and answer. No stage state, delegation, or selector source reads. Quoted aliases do not start Fable. Mixed execution retains its topology; execution follows the workflow below.'));
67
+ assert.match(workflow, /^4\. Delegate by profile: orchestrator coordinates, reasoning takes bounded judgment, mechanical takes low-ambiguity work; workers never spawn workers\./m);
68
+ assert.match(workflow, /^5\. The host runtime-model floor is advisory; record it, never block on model choice alone\.$/m);
69
+ assert.match(workflow, /^6\. .*Run stage checks, cold-review high-stakes artifacts, and audit profile\/runtime\/fallback fields\.$/m);
70
+ const handoffReference = '`<this-skill-dir>/references/execution-phases.md#verification-and-handoff`'; // portability-lint: allow markdown text to match, never a path
71
+ assert.ok(workflow.includes(`4. Delegate by profile: orchestrator coordinates, reasoning takes bounded judgment, mechanical takes low-ambiguity work; workers never spawn workers. Before Codex dispatch, load/apply ${handoffReference}.`),
72
+ 'step 4 requires loading and applying the verification-and-handoff reference before Codex subagent dispatch');
73
+ assert.ok(workflow.includes(`6. On every Codex handoff or silent stop, load/apply ${handoffReference} before accepting results or releasing dependent stages. Run stage checks, cold-review high-stakes artifacts, and audit profile/runtime/fallback fields.`),
74
+ 'step 6 requires loading and applying the verification-and-handoff reference at every handoff before accepting results or releasing dependent stages');
75
+ assert.match(workflow, /^2\. Plan via `<this-skill-dir>\/references\/execution-phases\.md`\.$/m);
76
+ assert.match(workflow, /^3\. Use `model-selector\.js`\.$/m);
77
+ assert.match(guide, /^## Verification and handoff$/m, 'the explicit handoff target heading exists');
78
+ const handoff = guide.split(/\r?\n## Verification and handoff\r?\n/)[1];
79
+ assert.ok(handoff, 'the dispatch reference contains Verification and handoff');
80
+ assert.match(handoff, /coordinator MUST reconcile scope before accepting a\nresult or using it in a dependent stage/);
81
+ assert.match(handoff, /Before dispatch, capture the worker worktree's starting state/);
82
+ assert.match(handoff, /Run this check after every handoff, including silent stops\./);
83
+
46
84
  console.log('PASS Fable execution phases match the active workflow contract and preserve a scoped legacy fallback');
@@ -11,7 +11,6 @@ const { classifyPaths, classifyChangeSet } = require('../scripts/ci-change-scope
11
11
 
12
12
  const ROOT = path.resolve(__dirname, '..');
13
13
  const SCRIPT = path.join(ROOT, 'scripts', 'ci-change-scope.js');
14
- const BASELINE_SHA = '71a8706061f2fdec657b1c2b348571aa6c40e877';
15
14
  const CHANGE_SCOPE_JOB = 'ci-change-scope';
16
15
  const SELF_REGRESSION_IF = "${{ !cancelled() && (needs.ci-change-scope.result != 'success' || needs.ci-change-scope.outputs.scope != 'docs-only') }}";
17
16
 
@@ -42,16 +41,79 @@ function runClassifier(event, base, head, cwd = ROOT) {
42
41
  return result.stdout.trim();
43
42
  }
44
43
 
45
- function baselineFile(file) {
46
- // Pin the pre-change tree; GitHub's pull_request HEAD is the candidate merge ref.
47
- return execFileSync('git', ['show', `${BASELINE_SHA}:${file}`], { cwd: ROOT, encoding: 'utf8' });
48
- }
49
-
50
44
  // This models the condition's truth table, not GitHub's scheduler.
51
45
  function shouldRunSelfRegression(workflowCancelled, result, scope) {
52
46
  return !workflowCancelled && (result !== 'success' || scope !== 'docs-only');
53
47
  }
54
48
 
49
+ // Assert the intended scope-gating invariants against parsed workflow documents.
50
+ // Taking documents (not git history or whole-file text) keeps unrelated CI edits
51
+ // green and lets the oracle be replayed against mutated copies of the YAML.
52
+ function assertScopeGating({ ci, release, governance }) {
53
+ const jobs = ci.jobs;
54
+ const classifier = jobs[CHANGE_SCOPE_JOB];
55
+ const selfRegression = jobs['self-regression'];
56
+ assert.ok(classifier, 'the ci-change-scope job exists');
57
+ assert.ok(selfRegression, 'the self-regression job exists');
58
+
59
+ // Only self-regression may be gated by the classifier. Other jobs, their
60
+ // steps and later added ungated jobs are deliberately left unpinned.
61
+ for (const [jobId, job] of Object.entries(jobs)) {
62
+ if (jobId === CHANGE_SCOPE_JOB || jobId === 'self-regression') continue;
63
+ assert.ok(!Object.hasOwn(job, 'if'), `${jobId} must not be gated`);
64
+ }
65
+
66
+ // The classifier runs only on pull requests and wires its scope output.
67
+ assert.equal(classifier.if, "${{ github.event_name == 'pull_request' }}");
68
+ assert.deepEqual(classifier.outputs, { scope: '${{ steps.scope.outputs.scope }}' });
69
+ const checkout = classifier.steps.find(step => step.uses === 'actions/checkout@v7');
70
+ assert.ok(checkout, 'the classifier checks out the repository');
71
+ assert.equal(checkout.with['fetch-depth'], 0, 'the classifier has complete Git history');
72
+ const node = classifier.steps.find(step => step.uses === 'actions/setup-node@v7');
73
+ assert.ok(node, 'the classifier sets up Node');
74
+ assert.equal(node.with['node-version'], 24);
75
+ const scope = classifier.steps.find(step => step.id === 'scope');
76
+ assert.ok(scope, 'the classifier produces the scope output');
77
+ assert.equal(scope.env.GITHUB_EVENT_NAME, undefined, 'the runner-provided GITHUB_EVENT_NAME is not overwritten');
78
+ assert.equal(scope.env.PR_BASE_SHA, '${{ github.event.pull_request.base.sha }}');
79
+ assert.equal(scope.env.PR_HEAD_SHA, '${{ github.event.pull_request.head.sha }}');
80
+ assert.match(scope.run, /node scripts\/ci-change-scope\.js "\$GITHUB_EVENT_NAME" "\$PR_BASE_SHA" "\$PR_HEAD_SHA"/);
81
+ assert.match(scope.run, /printf 'scope=%s\\n' "\$scope" >> "\$GITHUB_OUTPUT"/);
82
+
83
+ // Self-regression depends on the classifier and keeps the exact predicate.
84
+ assert.deepEqual(selfRegression.needs, [CHANGE_SCOPE_JOB]);
85
+ assert.equal(selfRegression.if, SELF_REGRESSION_IF, 'the full fallback predicate stays exact');
86
+ assert.ok(selfRegression.if.includes('!cancelled()'), 'workflow cancellation must disable self-regression');
87
+ assert.ok(!selfRegression.if.includes('always()'), 'always() keeps self-regression eligible during cancellation');
88
+
89
+ // The three-OS matrix stays complete.
90
+ assert.equal(selfRegression.strategy['fail-fast'], false);
91
+ assert.deepEqual(selfRegression.strategy.matrix.os, ['ubuntu-latest', 'windows-latest', 'macos-latest']);
92
+
93
+ // No workflow-level path filter may narrow what the classifier sees.
94
+ assert.ok(ci.on && Object.hasOwn(ci.on, 'push') && Object.hasOwn(ci.on, 'pull_request') &&
95
+ Object.hasOwn(ci.on, 'workflow_call'), 'push, pull_request and workflow_call triggers stay present');
96
+ const events = [ci.on, ci.on.push];
97
+ if (ci.on.pull_request && typeof ci.on.pull_request === 'object') events.push(ci.on.pull_request);
98
+ for (const event of events) {
99
+ assert.ok(!Object.hasOwn(event, 'paths'), 'no workflow-level paths filter');
100
+ assert.ok(!Object.hasOwn(event, 'paths-ignore'), 'no workflow-level paths-ignore filter');
101
+ }
102
+
103
+ // The reusable callers stay ungated, including any job added later.
104
+ assert.deepEqual(release.on.push.branches, ['main']);
105
+ assert.ok(Object.hasOwn(release.on, 'workflow_dispatch'));
106
+ assert.equal(release.jobs.gate.uses, './.github/workflows/ci.yml');
107
+ for (const [label, doc] of [['release.yml', release], ['doc-governance.yml', governance]]) {
108
+ assert.ok(doc && doc.jobs, `${label} declares jobs`);
109
+ for (const [jobId, job] of Object.entries(doc.jobs)) {
110
+ assert.ok(!Object.hasOwn(job, 'if'), `${label} job ${jobId} must not be gated`);
111
+ const needs = Array.isArray(job.needs) ? job.needs : job.needs ? [job.needs] : [];
112
+ assert.ok(!needs.includes(CHANGE_SCOPE_JOB), `${label} job ${jobId} must not depend on the classifier`);
113
+ }
114
+ }
115
+ }
116
+
55
117
  test('each owner-approved path class and their combination classify as docs-only', () => {
56
118
  for (const file of [
57
119
  'docs/guide.md',
@@ -183,49 +245,12 @@ test('real Git merge-base diff includes earlier code, deletions, both rename end
183
245
  });
184
246
 
185
247
  test('the workflow gates only self-regression and fails open on every uncertain dependency/output state', () => {
186
- const workflowFile = '.github/workflows/ci.yml';
187
- const workflowText = fs.readFileSync(path.join(ROOT, workflowFile), 'utf8');
188
- const beforeText = baselineFile(workflowFile);
189
- const workflow = yaml.load(workflowText);
190
- const before = yaml.load(beforeText);
191
-
192
- assert.equal(workflow.name, before.name);
193
- assert.deepEqual(workflow.on, before.on, 'push, pull_request, and reusable-workflow triggers stay unchanged');
194
- assert.deepEqual(workflow.permissions, before.permissions);
195
- assert.deepEqual(workflow.concurrency, before.concurrency);
196
- assert.deepEqual(
197
- Object.keys(workflow.jobs).sort(),
198
- [...Object.keys(before.jobs), CHANGE_SCOPE_JOB].sort(),
199
- 'only the classifier job is added; existing job ids remain present',
200
- );
201
- for (const [jobId, original] of Object.entries(before.jobs)) {
202
- const current = workflow.jobs[jobId];
203
- if (jobId === 'self-regression') {
204
- const { if: _condition, needs: _needs, ...unchanged } = current;
205
- assert.deepEqual(unchanged, original, 'self-regression name, matrix, steps, and runtime stay unchanged');
206
- } else {
207
- assert.deepEqual(current, original, `${jobId} stays unchanged`);
208
- }
209
- }
210
-
211
- const classifier = workflow.jobs[CHANGE_SCOPE_JOB];
212
- assert.equal(classifier.if, "${{ github.event_name == 'pull_request' }}");
213
- assert.deepEqual(classifier.outputs, { scope: '${{ steps.scope.outputs.scope }}' });
214
- const checkout = classifier.steps.find(step => step.uses === 'actions/checkout@v7');
215
- assert.equal(checkout.with['fetch-depth'], 0, 'the classifier has complete Git history');
216
- const node = classifier.steps.find(step => step.uses === 'actions/setup-node@v7');
217
- assert.equal(node.with['node-version'], 24);
218
- const scope = classifier.steps.find(step => step.id === 'scope');
219
- assert.equal(scope.env.GITHUB_EVENT_NAME, undefined, 'the runner-provided GITHUB_EVENT_NAME is not overwritten');
220
- assert.equal(scope.env.PR_BASE_SHA, '${{ github.event.pull_request.base.sha }}');
221
- assert.equal(scope.env.PR_HEAD_SHA, '${{ github.event.pull_request.head.sha }}');
222
- assert.match(scope.run, /node scripts\/ci-change-scope\.js "\$GITHUB_EVENT_NAME" "\$PR_BASE_SHA" "\$PR_HEAD_SHA"/);
223
- assert.match(scope.run, /printf 'scope=%s\\n' "\$scope" >> "\$GITHUB_OUTPUT"/);
224
- const selfRegressionIf = workflow.jobs['self-regression'].if;
225
- assert.ok(selfRegressionIf.includes('!cancelled()'), 'workflow cancellation must disable self-regression');
226
- assert.ok(!selfRegressionIf.includes('always()'), 'always() keeps self-regression eligible during cancellation');
227
- assert.equal(selfRegressionIf, SELF_REGRESSION_IF, 'the full fallback predicate stays exact');
228
- assert.deepEqual(workflow.jobs['self-regression'].needs, [CHANGE_SCOPE_JOB]);
248
+ const readWorkflow = file => yaml.load(fs.readFileSync(path.join(ROOT, file), 'utf8'));
249
+ assertScopeGating({
250
+ ci: readWorkflow('.github/workflows/ci.yml'),
251
+ release: readWorkflow('.github/workflows/release.yml'),
252
+ governance: readWorkflow('.github/workflows/doc-governance.yml'),
253
+ });
229
254
 
230
255
  const gateCases = [
231
256
  ['successful docs-only classifier', false, 'success', 'docs-only', false],
@@ -244,17 +269,13 @@ test('the workflow gates only self-regression and fails open on every uncertain
244
269
  assert.equal(shouldRunSelfRegression(workflowCancelled, result, output), expected, label);
245
270
  }
246
271
 
247
- const releaseFile = '.github/workflows/release.yml';
248
- const governanceFile = '.github/workflows/doc-governance.yml';
249
- assert.equal(fs.readFileSync(path.join(ROOT, releaseFile), 'utf8'), baselineFile(releaseFile));
250
- assert.equal(fs.readFileSync(path.join(ROOT, governanceFile), 'utf8'), baselineFile(governanceFile));
251
- const release = yaml.load(fs.readFileSync(path.join(ROOT, releaseFile), 'utf8'));
252
- assert.deepEqual(release.on.push.branches, ['main']);
253
- assert.ok(Object.hasOwn(release.on, 'workflow_dispatch'));
254
- assert.equal(release.jobs.gate.uses, './.github/workflows/ci.yml');
255
272
  assert.equal(classifyChangeSet('push', 'a'.repeat(40), 'b'.repeat(40), { runGit: unusedGitForWorkflow }), 'full');
256
273
  });
257
274
 
258
275
  function unusedGitForWorkflow() {
259
276
  throw new Error('the release caller is a push/dispatch, so no PR diff may authorize a skip');
260
277
  }
278
+
279
+ // Exported so the in-report mutant harness can replay the same oracle against
280
+ // parsed copies of the workflow documents without registering these tests.
281
+ module.exports = { assertScopeGating };
@@ -14,12 +14,27 @@ const ROOT = path.resolve(__dirname, '..');
14
14
  const PLUGIN = path.join(ROOT, 'opencode-plugin', 'index.mjs');
15
15
  function isOutside(root, dir, pathApi = path) {
16
16
  const relative = pathApi.relative(root, dir);
17
- return relative.startsWith('..') || pathApi.isAbsolute(relative);
17
+ return relative === '..' || relative.startsWith(`..${pathApi.sep}`) || pathApi.isAbsolute(relative);
18
18
  }
19
19
 
20
20
  const win32Root = 'D:\\a\\Harness-everything\\Harness-everything';
21
- assert.equal(isOutside(win32Root, 'C:\\Users\\runner\\AppData\\Local\\Temp\\fixture', path.win32), true, 'cross-drive temp path is outside the repository');
22
- assert.equal(isOutside(win32Root, path.win32.join(win32Root, 'ci'), path.win32), false, 'same-drive child is inside the repository');
21
+ test('test-root containment handles Windows path boundaries', () => {
22
+ const win32Parent = path.win32.dirname(win32Root);
23
+ const win32Child = path.win32.join(win32Root, 'ci');
24
+ const win32DotChild = path.win32.join(win32Root, '..cache');
25
+ const win32Sibling = path.win32.join(win32Parent, `${path.win32.basename(win32Root)}-other`);
26
+ const win32CrossDrive = 'C:\\Users\\runner\\AppData\\Local\\Temp\\fixture';
27
+ const crossDriveRelative = path.win32.relative(win32Root, win32CrossDrive);
28
+
29
+ assert.equal(isOutside(win32Root, win32Child, path.win32), false, 'a root child is inside');
30
+ assert.equal(isOutside(win32Root, win32DotChild, path.win32), false, 'a child whose name starts with two dots is still inside');
31
+ assert.equal(win32Sibling.startsWith(win32Root), true, 'the sibling shares the root string prefix');
32
+ assert.equal(isOutside(win32Root, win32Sibling, path.win32), true, 'a similar-prefix sibling is outside');
33
+ assert.equal(isOutside(win32Root, win32Parent, path.win32), true, 'the parent escape is outside');
34
+ assert.equal(path.win32.isAbsolute(crossDriveRelative), true, 'cross-drive relative result is absolute');
35
+ assert.equal(crossDriveRelative.startsWith('..'), false, 'the old prefix-only check misses a cross-drive path');
36
+ assert.equal(isOutside(win32Root, win32CrossDrive, path.win32), true, 'a cross-drive temp path is outside');
37
+ });
23
38
 
24
39
  const LABELS = [
25
40
  '<!-- harness-label {"v":1,"validity":"actionable","tier":"tier2","intents":["fix"],"workflow":"iterative-single","skills":[]} -->',