harness-everything 0.55.2 → 0.55.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/AGENTS.md +1 -1
- package/BENCHMARK_SOP.md +2 -2
- package/CHANGELOG.md +22 -0
- package/README.md +15 -16
- package/SECURITY.md +1 -1
- package/VERIFICATION.md +4 -8
- package/behavioral-evals/PAIRED-BENCHMARK.md +12 -27
- package/behavioral-evals/README.md +21 -65
- package/behavioral-evals/cases/breaker-zoom-out-after-3.yaml +26 -33
- package/behavioral-evals/cases/pressure-sunk-cost-retry.yaml +15 -17
- package/behavioral-evals/paired-benchmark.js +3 -40
- package/behavioral-evals/run.js +2 -3
- package/ci/fixtures/doc-obligations/reconciliation-s2b/wiring/legacy-off-golden.json +0 -6
- package/ci/invariant-routing.test.js +32 -6
- package/ci/lib/opencode-verification-loader.js +3 -5
- package/ci/mechanism-2a-rule-of-3.test.js +111 -97
- package/ci/mechanism-2n-opencode-plugin.test.js +68 -206
- package/ci/mechanism-2p-opencode-v2-entrypoint.test.js +47 -28
- package/ci/mechanism-2w-platform-compatibility.test.js +1 -0
- package/ci/mechanism-32-paired-benchmark.test.js +1 -2
- package/ci/mechanism-33-issues-205-207.test.js +1 -1
- package/ci/mechanism-338-opencode-async.test.js +18 -49
- package/ci/mechanism-36-verify-timeout.test.js +3 -189
- package/ci/mechanism-39-opencode-verify-outcomes.test.js +56 -323
- package/ci/mechanism-397-opencode-observations.test.js +64 -9
- package/ci/mechanism-check-packet-write-set.test.js +163 -8
- package/ci/mechanism-codex-hook-results.test.js +9 -5
- package/ci/mechanism-prb-outline-review.test.js +1 -13
- package/ci/mechanism-system-one-router.test.js +1 -1
- package/ci/openai-plugin-package.test.js +30 -7
- package/ci/openai-plugin-runtime.test.js +64 -32
- package/ci/prompt-contract-regressions.test.js +1 -5
- package/ci/router-workflow-plan.test.js +8 -8
- package/ci/self-evolve-loop.test.js +51 -51
- package/ci/workflow-execution-contract.test.js +3 -6
- package/code-review/SKILL.md +1 -1
- package/code-review/templates/finding.template.md +17 -1
- package/docker-verify.sh +1 -117
- package/docs/architecture.md +9 -7
- package/docs/document-lifecycle.md +1 -1
- package/docs/enforcement-locks.md +12 -10
- package/docs/mechanism-first-skill-mesh.md +2 -2
- package/docs/openai-plugin.md +3 -3
- package/docs/philosophy.md +1 -1
- package/docs/platform-capabilities.md +4 -3
- package/docs/platform-compatibility.json +2 -2
- package/docs/reflection.md +1 -1
- package/docs/routing.md +2 -2
- package/docs/system-one-suggestion-gates.md +4 -4
- package/docs/troubleshooting.md +9 -35
- package/docs/workflow-runtime.md +19 -18
- package/docs/workflows/environment-detection.md +11 -9
- package/docs/workflows/fable-discipline.md +6 -5
- package/docs/workflows/fable-mode.md +6 -5
- package/docs/workflows/harness-everything.md +5 -5
- package/docs/workflows/improve-codebase-architecture.md +10 -8
- package/docs/workflows/install-cognitive-os.md +5 -5
- package/docs/workflows/tdd.md +9 -9
- package/docs/workflows/zoom-out.md +20 -30
- package/environment-detection/SKILL.md +2 -2
- package/environment-detection/references/shell-syntax-rules.md +1 -1
- package/eval-harness/SKILL.md +1 -1
- package/eval-harness/references/scoring-rubric.md +3 -3
- package/evals/zoom-out/eval.yaml +2 -2
- package/evals/zoom-out/tasks/negative-productive-iteration.yaml +15 -0
- package/evals/zoom-out/tasks/negative-trivial-edit.yaml +6 -6
- package/evals/zoom-out/tasks/positive-first-failure.yaml +15 -0
- package/evals/zoom-out/tasks/positive-repair-loop.yaml +1 -1
- package/fable-discipline/SKILL.md +3 -3
- package/fable-discipline/references/discipline-rules.md +1 -1
- package/fable-mode/SKILL.md +1 -1
- package/fable-mode/execution-guardrails/SKILL.md +2 -4
- package/fable-mode/execution-guardrails/references/guardrail-rules.md +3 -3
- package/fable-mode/fable-haiku/SKILL.md +1 -1
- package/fable-mode/fable-opus/SKILL.md +2 -2
- package/fable-mode/fable-sonnet/SKILL.md +1 -1
- package/fable-mode/references/execution-phases.md +2 -2
- package/harness-everything/SKILL.md +3 -3
- package/harness-everything/references/router-workflow-plan.md +2 -2
- package/harness-everything/references/skill-registry.md +2 -2
- package/harness-everything/references/triage-and-tiers.md +5 -5
- package/harness-everything/scripts/bootstrap.js +1 -26
- package/harness-everything/scripts/kernel-router-core.js +2 -3
- package/harness-everything/scripts/kernel-router.js +1 -1
- package/harness-everything/scripts/router-contract-core.js +1 -1
- package/harness-everything/scripts/routing-keywords.json +0 -2
- package/hooks/hooks.json +0 -33
- package/hooks/scripts/lib/harness-state.js +5 -6
- package/hooks/scripts/lib/learning-opportunity.js +3 -13
- package/hooks/scripts/openai-session-start.js +2 -4
- package/improve-codebase-architecture/SKILL.md +3 -3
- package/improve-codebase-architecture/guides/refactoring-workflow.md +5 -4
- package/install-cognitive-os/SKILL.md +3 -3
- package/opencode-plugin/README.md +18 -43
- package/opencode-plugin/index.mjs +52 -380
- package/opencode-plugin/plugin.json +1 -1
- package/package.json +1 -4
- package/plugins/harness-everything/.codex-plugin/plugin.json +1 -1
- package/plugins/harness-everything/hooks/hooks.json +0 -14
- package/plugins/harness-everything/hooks/scripts/lib/harness-state.js +5 -6
- package/plugins/harness-everything/hooks/scripts/lib/learning-opportunity.js +3 -13
- package/plugins/harness-everything/hooks/scripts/lib/workspace.js +2 -2
- package/plugins/harness-everything/hooks/scripts/openai-session-start.js +2 -4
- package/plugins/harness-everything/hooks/session-start.js +2 -4
- package/plugins/harness-everything/plugin.json +1 -1
- package/plugins/harness-everything/scripts/lib/advisory-text.js +2 -2
- package/plugins/harness-everything/scripts/lib/workspace.js +2 -2
- package/plugins/harness-everything/skills/code-review/SKILL.md +1 -1
- package/plugins/harness-everything/skills/code-review/templates/finding.template.md +17 -1
- package/plugins/harness-everything/skills/environment-detection/SKILL.md +2 -2
- package/plugins/harness-everything/skills/environment-detection/references/shell-syntax-rules.md +1 -1
- package/plugins/harness-everything/skills/eval-harness/SKILL.md +1 -1
- package/plugins/harness-everything/skills/eval-harness/references/scoring-rubric.md +3 -3
- package/plugins/harness-everything/skills/fable-discipline/SKILL.md +3 -3
- package/plugins/harness-everything/skills/fable-discipline/references/discipline-rules.md +1 -1
- package/plugins/harness-everything/skills/fable-mode/SKILL.md +1 -1
- package/plugins/harness-everything/skills/fable-mode/execution-guardrails/SKILL.md +2 -4
- package/plugins/harness-everything/skills/fable-mode/execution-guardrails/references/guardrail-rules.md +3 -3
- package/plugins/harness-everything/skills/fable-mode/fable-haiku/SKILL.md +1 -1
- package/plugins/harness-everything/skills/fable-mode/fable-opus/SKILL.md +2 -2
- package/plugins/harness-everything/skills/fable-mode/fable-sonnet/SKILL.md +1 -1
- package/plugins/harness-everything/skills/fable-mode/references/execution-phases.md +2 -2
- package/plugins/harness-everything/skills/harness-everything/SKILL.md +3 -3
- package/plugins/harness-everything/skills/harness-everything/references/router-workflow-plan.md +2 -2
- package/plugins/harness-everything/skills/harness-everything/references/skill-registry.md +2 -2
- package/plugins/harness-everything/skills/harness-everything/references/triage-and-tiers.md +5 -5
- package/plugins/harness-everything/skills/harness-everything/scripts/bootstrap.js +1 -26
- package/plugins/harness-everything/skills/harness-everything/scripts/kernel-router-core.js +2 -3
- package/plugins/harness-everything/skills/harness-everything/scripts/kernel-router.js +1 -1
- package/plugins/harness-everything/skills/harness-everything/scripts/router-contract-core.js +1 -1
- package/plugins/harness-everything/skills/harness-everything/scripts/routing-keywords.json +0 -2
- package/plugins/harness-everything/skills/improve-codebase-architecture/SKILL.md +3 -3
- package/plugins/harness-everything/skills/improve-codebase-architecture/guides/refactoring-workflow.md +5 -4
- package/plugins/harness-everything/skills/install-cognitive-os/SKILL.md +3 -3
- package/plugins/harness-everything/skills/self-evolve/SKILL.md +1 -1
- package/plugins/harness-everything/skills/self-evolve/references/memory-resolution.md +3 -3
- package/plugins/harness-everything/skills/self-evolve/schemas/lesson-candidate.schema.json +4 -1
- package/plugins/harness-everything/skills/self-evolve/scripts/lesson-candidate.js +1 -0
- package/plugins/harness-everything/skills/skill-creator/SKILL.md +1 -1
- package/plugins/harness-everything/skills/skill-creator/references/quality-checklist.md +1 -1
- package/plugins/harness-everything/skills/skill-creator/references/quality-principles.md +4 -4
- package/plugins/harness-everything/skills/tdd/SKILL.md +2 -2
- package/plugins/harness-everything/skills/tdd/references/core-discipline.md +3 -5
- package/plugins/harness-everything/skills/todo-driven-workflow/SKILL.md +2 -2
- package/plugins/harness-everything/skills/zoom-out/SKILL.md +14 -26
- package/plugins/harness-everything/skills/zoom-out/references/circuit-breaker.md +18 -62
- package/references/platform-advisory-template.md +3 -9
- package/sbom.cdx.json +7 -7
- package/scripts/check-packet-write-set.js +76 -1
- package/scripts/lib/advisory-text.js +2 -2
- package/scripts/lib/workspace.js +2 -2
- package/self-evolve/SKILL.md +1 -1
- package/self-evolve/references/memory-resolution.md +3 -3
- package/self-evolve/schemas/lesson-candidate.schema.json +4 -1
- package/self-evolve/scripts/lesson-candidate.js +1 -0
- package/skill-creator/SKILL.md +1 -1
- package/skill-creator/references/quality-checklist.md +1 -1
- package/skill-creator/references/quality-principles.md +4 -4
- package/submission/openai/test-cases.json +5 -5
- package/tdd/SKILL.md +2 -2
- package/tdd/references/core-discipline.md +3 -5
- package/todo-driven-workflow/SKILL.md +2 -2
- package/zoom-out/SKILL.md +14 -26
- package/zoom-out/references/circuit-breaker.md +18 -62
- package/behavioral-evals/opencode-hardlock-live.js +0 -17
- package/behavioral-evals/opencode-reflection-gate-live.js +0 -342
- package/ci/mechanism-31-opencode-hardlock-evidence.test.js +0 -82
- package/evals/zoom-out/tasks/negative-first-edge-case-review.yaml +0 -16
- package/evals/zoom-out/tasks/positive-repeated-failure.yaml +0 -15
- package/hooks/scripts/reset-circuit-breaker.js +0 -30
- package/hooks/scripts/rule-of-3-tracker.js +0 -165
- package/hooks/scripts/rule-of-3.js +0 -171
- package/plugins/harness-everything/hooks/scripts/reset-circuit-breaker.js +0 -30
- package/plugins/harness-everything/hooks/scripts/rule-of-3-tracker.js +0 -165
- package/plugins/harness-everything/hooks/scripts/rule-of-3.js +0 -171
|
@@ -81,7 +81,7 @@ function makeRepo(t) {
|
|
|
81
81
|
return { repo, tempRoot };
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
function runChecker(repo, tempRoot, { base, head, allow = [], allowFile } = {}) {
|
|
84
|
+
function runChecker(repo, tempRoot, { base, head, allow = [], allowFile } = {}, extraEnv = {}) {
|
|
85
85
|
const args = [CHECKER_SOURCE, '--base', base];
|
|
86
86
|
if (head) args.push('--head', head);
|
|
87
87
|
for (const pattern of allow) args.push('--allow', pattern);
|
|
@@ -89,12 +89,48 @@ function runChecker(repo, tempRoot, { base, head, allow = [], allowFile } = {})
|
|
|
89
89
|
const result = spawnSync(process.execPath, args, {
|
|
90
90
|
cwd: repo,
|
|
91
91
|
encoding: 'utf8',
|
|
92
|
-
env: gitEnv(tempRoot),
|
|
92
|
+
env: { ...gitEnv(tempRoot), ...extraEnv },
|
|
93
93
|
});
|
|
94
94
|
assert.equal(result.error, undefined, result.error && result.error.message);
|
|
95
95
|
return result;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
function sparseRuleCounter(tempRoot, { fail = false } = {}) {
|
|
99
|
+
const directory = path.join(tempRoot, 'git counter');
|
|
100
|
+
fs.mkdirSync(directory, { recursive: true });
|
|
101
|
+
const log = path.join(directory, 'check-rules calls');
|
|
102
|
+
const realGit = execFileSync('which', ['git'], { encoding: 'utf8' }).trim();
|
|
103
|
+
const wrapper = path.join(directory, 'git');
|
|
104
|
+
fs.writeFileSync(wrapper, [
|
|
105
|
+
'#!/usr/bin/env node',
|
|
106
|
+
"'use strict';",
|
|
107
|
+
"const fs = require('node:fs');",
|
|
108
|
+
"const { spawnSync } = require('node:child_process');",
|
|
109
|
+
`const realGit = ${JSON.stringify(realGit)};`,
|
|
110
|
+
'const args = process.argv.slice(2);',
|
|
111
|
+
"const checkRules = args.includes('sparse-checkout') && args.includes('check-rules');",
|
|
112
|
+
'if (checkRules) {',
|
|
113
|
+
" if (process.env.WRITE_SET_FAIL_CHECK_RULES === '1') {",
|
|
114
|
+
" process.stderr.write('injected check-rules failure\\n');",
|
|
115
|
+
' process.exit(1);',
|
|
116
|
+
' }',
|
|
117
|
+
" fs.appendFileSync(process.env.WRITE_SET_CHECK_RULES_LOG, 'x');",
|
|
118
|
+
'}',
|
|
119
|
+
"const child = spawnSync(realGit, args, { stdio: 'inherit' });",
|
|
120
|
+
"if (child.error) { console.error(child.error.message); process.exitCode = 1; }",
|
|
121
|
+
'else process.exitCode = child.status ?? 1;',
|
|
122
|
+
'',
|
|
123
|
+
].join('\n'), { mode: 0o755 });
|
|
124
|
+
return {
|
|
125
|
+
env: {
|
|
126
|
+
PATH: `${directory}${path.delimiter}${process.env.PATH}`,
|
|
127
|
+
WRITE_SET_CHECK_RULES_LOG: log,
|
|
128
|
+
WRITE_SET_FAIL_CHECK_RULES: fail ? '1' : '0',
|
|
129
|
+
},
|
|
130
|
+
count: () => fs.existsSync(log) ? fs.readFileSync(log, 'utf8').length : 0,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
|
|
98
134
|
function outOfSetPaths(result) {
|
|
99
135
|
return result.stdout.split(/\r?\n/).filter(line => line.startsWith('OUT_OF_SET '))
|
|
100
136
|
.map(line => JSON.parse(line.slice('OUT_OF_SET '.length)));
|
|
@@ -217,13 +253,132 @@ test('compares only the requested commits when --head is not the worktree HEAD',
|
|
|
217
253
|
const head = commitAll(repo, tempRoot, 'requested head');
|
|
218
254
|
write(repo, 'later.txt', 'after requested head\n');
|
|
219
255
|
commitAll(repo, tempRoot, 'worktree HEAD');
|
|
220
|
-
|
|
256
|
+
runGit(repo, tempRoot, ['update-index', '--assume-unchanged', '--', 'base.txt']);
|
|
257
|
+
try {
|
|
258
|
+
write(repo, 'base.txt', 'hidden workspace-only change\n');
|
|
259
|
+
write(repo, 'dirty.txt', 'uncommitted\n');
|
|
221
260
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
261
|
+
const result = runChecker(repo, tempRoot, { base, head, allow: ['allowed.txt'] });
|
|
262
|
+
assert.equal(result.status, 0, result.stderr);
|
|
263
|
+
assert.deepEqual(outOfSetPaths(result), []);
|
|
264
|
+
assert.match(result.stdout, /commits only/i);
|
|
265
|
+
assert.doesNotMatch(result.stdout, /base\.txt|later\.txt|dirty\.txt/);
|
|
266
|
+
} finally {
|
|
267
|
+
runGit(repo, tempRoot, ['update-index', '--no-assume-unchanged', '--', 'base.txt']);
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
test('batches sparse-rule checks and distinguishes hidden deletions from omissions', { skip: process.platform === 'win32' }, t => {
|
|
272
|
+
const { repo, tempRoot } = makeRepo(t);
|
|
273
|
+
const includedPath = 'included/tracked\nname.txt';
|
|
274
|
+
const omittedPaths = ['omitted/space name.txt', 'omitted/new\nline.txt'];
|
|
275
|
+
write(repo, includedPath, 'inside sparse cone\n');
|
|
276
|
+
for (const file of omittedPaths) write(repo, file, `outside sparse cone: ${file}\n`);
|
|
277
|
+
const base = commitAll(repo, tempRoot, 'baseline');
|
|
278
|
+
write(repo, 'later.txt', 'committed after the requested head\n');
|
|
279
|
+
commitAll(repo, tempRoot, 'later commit');
|
|
280
|
+
|
|
281
|
+
runGit(repo, tempRoot, ['sparse-checkout', 'set', 'included']);
|
|
282
|
+
for (const file of omittedPaths) assert.equal(fs.existsSync(path.join(repo, ...file.split('/'))), false, `${file} is outside the sparse cone`);
|
|
283
|
+
runGit(repo, tempRoot, ['update-index', '--skip-worktree', '--', includedPath]);
|
|
284
|
+
fs.rmSync(path.join(repo, ...includedPath.split('/')));
|
|
285
|
+
assert.equal(gitText(repo, tempRoot, 'status', '--porcelain'), '', 'Git hides the in-cone deletion');
|
|
286
|
+
|
|
287
|
+
const counter = sparseRuleCounter(tempRoot);
|
|
288
|
+
const before = snapshotTree(repo);
|
|
289
|
+
const result = runChecker(repo, tempRoot, { base, allow: ['later.txt'] }, counter.env);
|
|
290
|
+
assert.equal(result.status, 1, result.stderr);
|
|
291
|
+
assert.deepEqual(outOfSetPaths(result), [includedPath]);
|
|
292
|
+
for (const file of omittedPaths) assert.ok(!result.stdout.includes(JSON.stringify(file)), `${file} is not reported`);
|
|
293
|
+
assert.equal(counter.count(), 1, 'all sparse candidates use one check-rules subprocess');
|
|
294
|
+
assert.deepEqual(snapshotTree(repo), before, 'inspection preserves the index flags and repository state');
|
|
295
|
+
|
|
296
|
+
const allowed = runChecker(repo, tempRoot, { base, head: 'HEAD', allow: [includedPath, 'later.txt'] }, counter.env);
|
|
297
|
+
assert.equal(allowed.status, 0, allowed.stderr);
|
|
298
|
+
assert.ok(allowed.stdout.includes(`ALLOWED ${JSON.stringify(includedPath)}`));
|
|
299
|
+
assert.equal(counter.count(), 2, 'the second candidate batch also uses one subprocess');
|
|
300
|
+
assert.deepEqual(snapshotTree(repo), before, 'allowed inspection preserves the index flags and repository state');
|
|
301
|
+
|
|
302
|
+
const historical = runChecker(repo, tempRoot, { base, head: base, allow: ['later.txt'] }, counter.env);
|
|
303
|
+
assert.equal(historical.status, 0, historical.stderr);
|
|
304
|
+
assert.match(historical.stdout, /commits only/);
|
|
305
|
+
assert.equal(counter.count(), 2, 'a non-current --head does not inspect sparse worktree paths');
|
|
306
|
+
|
|
307
|
+
const cleanFixture = makeRepo(t);
|
|
308
|
+
write(cleanFixture.repo, 'included/only.txt', 'present\n');
|
|
309
|
+
const cleanBase = commitAll(cleanFixture.repo, cleanFixture.tempRoot, 'baseline');
|
|
310
|
+
runGit(cleanFixture.repo, cleanFixture.tempRoot, ['sparse-checkout', 'set', 'included']);
|
|
311
|
+
const cleanCounter = sparseRuleCounter(cleanFixture.tempRoot);
|
|
312
|
+
const clean = runChecker(cleanFixture.repo, cleanFixture.tempRoot, { base: cleanBase, allow: ['included/**'] }, cleanCounter.env);
|
|
313
|
+
assert.equal(clean.status, 0, clean.stderr);
|
|
314
|
+
assert.equal(cleanCounter.count(), 0, 'no sparse-rule process is needed without missing skip-worktree paths');
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
test('fails closed when batched sparse-rule inspection fails', { skip: process.platform === 'win32' }, t => {
|
|
318
|
+
const { repo, tempRoot } = makeRepo(t);
|
|
319
|
+
write(repo, 'included/deleted.txt', 'inside sparse cone\n');
|
|
320
|
+
write(repo, 'omitted/hidden.txt', 'outside sparse cone\n');
|
|
321
|
+
const base = commitAll(repo, tempRoot, 'baseline');
|
|
322
|
+
runGit(repo, tempRoot, ['sparse-checkout', 'set', 'included']);
|
|
323
|
+
runGit(repo, tempRoot, ['update-index', '--skip-worktree', '--', 'included/deleted.txt']);
|
|
324
|
+
fs.rmSync(path.join(repo, 'included', 'deleted.txt'));
|
|
325
|
+
assert.equal(gitText(repo, tempRoot, 'status', '--porcelain'), '');
|
|
326
|
+
const before = snapshotTree(repo);
|
|
327
|
+
|
|
328
|
+
const counter = sparseRuleCounter(tempRoot, { fail: true });
|
|
329
|
+
const result = runChecker(repo, tempRoot, { base, allow: ['allowed/**'] }, counter.env);
|
|
330
|
+
assert.equal(result.status, 2, result.stdout);
|
|
331
|
+
assert.match(result.stderr, /git sparse-checkout failed/);
|
|
332
|
+
assert.equal(counter.count(), 0, 'the injected failing inspection is not recorded as a successful invocation');
|
|
333
|
+
assert.deepEqual(snapshotTree(repo), before, 'failed inspection does not mutate the index or worktree');
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
for (const flag of ['assume-unchanged', 'skip-worktree']) {
|
|
337
|
+
test(`checks actual worktree content hidden by --${flag}`, t => {
|
|
338
|
+
const { repo, tempRoot } = makeRepo(t);
|
|
339
|
+
const file = process.platform === 'win32' ? 'hidden [file].txt' : 'hidden [file]\nname.txt';
|
|
340
|
+
write(repo, file, 'before\n');
|
|
341
|
+
const base = commitAll(repo, tempRoot, 'baseline');
|
|
342
|
+
runGit(repo, tempRoot, ['update-index', `--${flag}`, '--', file]);
|
|
343
|
+
try {
|
|
344
|
+
const clean = runChecker(repo, tempRoot, { base, allow: ['allowed/**'] });
|
|
345
|
+
assert.equal(clean.status, 0, clean.stderr);
|
|
346
|
+
assert.equal(clean.stdout, '');
|
|
347
|
+
|
|
348
|
+
write(repo, file, 'after!\n');
|
|
349
|
+
assert.equal(gitText(repo, tempRoot, 'status', '--porcelain'), '', 'Git hides the edit');
|
|
350
|
+
const before = snapshotTree(repo);
|
|
351
|
+
const rejected = runChecker(repo, tempRoot, { base, allow: ['allowed/**'] });
|
|
352
|
+
assert.equal(rejected.status, 1, rejected.stderr);
|
|
353
|
+
assert.deepEqual(outOfSetPaths(rejected), [file]);
|
|
354
|
+
|
|
355
|
+
const allowed = runChecker(repo, tempRoot, { base, head: 'HEAD', allow: [file] });
|
|
356
|
+
assert.equal(allowed.status, 0, allowed.stderr);
|
|
357
|
+
assert.ok(allowed.stdout.includes(`ALLOWED ${JSON.stringify(file)}`));
|
|
358
|
+
assert.deepEqual(snapshotTree(repo), before, 'inspection preserves the index flags');
|
|
359
|
+
} finally {
|
|
360
|
+
runGit(repo, tempRoot, ['update-index', `--no-${flag}`, '--', file]);
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
test('reports a flagged-file inspection error when Git cannot clean its content', t => {
|
|
366
|
+
const { repo, tempRoot } = makeRepo(t);
|
|
367
|
+
const file = 'hidden.txt';
|
|
368
|
+
write(repo, '.gitattributes', 'hidden.txt filter=broken\n');
|
|
369
|
+
write(repo, file, 'tracked\n');
|
|
370
|
+
const base = commitAll(repo, tempRoot, 'baseline');
|
|
371
|
+
runGit(repo, tempRoot, ['update-index', '--assume-unchanged', '--', file]);
|
|
372
|
+
try {
|
|
373
|
+
runGit(repo, tempRoot, ['config', 'filter.broken.clean', 'exit 1']);
|
|
374
|
+
runGit(repo, tempRoot, ['config', 'filter.broken.required', 'true']);
|
|
375
|
+
const result = runChecker(repo, tempRoot, { base, allow: ['allowed/**'] });
|
|
376
|
+
assert.equal(result.status, 2, result.stderr);
|
|
377
|
+
assert.match(result.stderr, /git hash-object failed/);
|
|
378
|
+
} finally {
|
|
379
|
+
runGit(repo, tempRoot, ['config', '--remove-section', 'filter.broken']);
|
|
380
|
+
runGit(repo, tempRoot, ['update-index', '--no-assume-unchanged', '--', file]);
|
|
381
|
+
}
|
|
227
382
|
});
|
|
228
383
|
|
|
229
384
|
test('returns usage errors for an unknown base and a missing allow list', t => {
|
|
@@ -11,6 +11,9 @@ const pluginRoot = path.join(root, 'plugins', 'harness-everything');
|
|
|
11
11
|
const manifest = require('../plugins/harness-everything/hooks/hooks.json');
|
|
12
12
|
const { getSessionDir, getStateRoot } = require('../hooks/scripts/lib/harness-state');
|
|
13
13
|
|
|
14
|
+
assert.doesNotMatch(JSON.stringify(manifest.hooks), /rule-of-3(?:-tracker)?\.js|reset-circuit-breaker\.js/,
|
|
15
|
+
'packaged Codex hooks must not register retired breaker entry points');
|
|
16
|
+
|
|
14
17
|
function registeredHook(event, script) {
|
|
15
18
|
const handler = manifest.hooks[event].flatMap(group => group.hooks)
|
|
16
19
|
.find(hook => hook.command.includes('/' + script + '"'));
|
|
@@ -61,22 +64,22 @@ try {
|
|
|
61
64
|
}));
|
|
62
65
|
function read(file) { return JSON.parse(fs.readFileSync(file, 'utf8')); }
|
|
63
66
|
function post(response) {
|
|
64
|
-
for (const script of ['state-persist.js', '
|
|
67
|
+
for (const script of ['state-persist.js', 'contract-test.js']) {
|
|
65
68
|
hook('PostToolUse', script, { ...shell, tool_response: response });
|
|
66
69
|
}
|
|
67
70
|
}
|
|
68
71
|
|
|
69
72
|
const handoff = path.join(session, 'handoff-state.json');
|
|
70
|
-
const tracker = path.join(session, 'rule-of-3-state.json');
|
|
71
73
|
post({ exit_code: 1, stderr: 'test failed' });
|
|
72
74
|
assert.equal(read(handoff).status, 'failed');
|
|
73
|
-
assert.equal(
|
|
75
|
+
assert.equal(fs.existsSync(path.join(session, 'rule-of-3-state.json')), false,
|
|
76
|
+
'failure result capture must not create retired breaker state');
|
|
74
77
|
assert.equal(read(contract).status, 'fail');
|
|
75
78
|
function evidenceSnapshot() {
|
|
76
79
|
// Test commands can themselves write files, so the edit timestamp is
|
|
77
80
|
// independent of whether the host confirmed success.
|
|
78
81
|
const { lastEditAt, ...verification } = read(handoff);
|
|
79
|
-
return [verification, ...[
|
|
82
|
+
return [verification, ...[contract, evidence].map(read)];
|
|
80
83
|
}
|
|
81
84
|
const snapshots = evidenceSnapshot();
|
|
82
85
|
|
|
@@ -91,7 +94,8 @@ try {
|
|
|
91
94
|
post({ exitCode: 0, stderr: 'benign test warning' });
|
|
92
95
|
assert.equal(read(handoff).status, 'idle');
|
|
93
96
|
assert.ok(read(handoff).lastVerifyAt > 0);
|
|
94
|
-
assert.equal(
|
|
97
|
+
assert.equal(fs.existsSync(path.join(session, 'rule-of-3-state.json')), false,
|
|
98
|
+
'successful result capture must not create retired breaker state');
|
|
95
99
|
assert.equal(read(contract).status, 'pass');
|
|
96
100
|
|
|
97
101
|
const priorEdit = read(handoff).lastEditAt;
|
|
@@ -3248,18 +3248,8 @@ test('legacy session-dir keying stays aligned through an aliased workspace root'
|
|
|
3248
3248
|
tool_name: 'Agent', tool_use_id: 'pilot-alias-capture', agent_type: 'worker',
|
|
3249
3249
|
tool_input: { prompt: 'alias capture probe' },
|
|
3250
3250
|
}, true);
|
|
3251
|
-
writeJson(path.join(aliasSessionDir, 'rule-of-3-state.json'), {
|
|
3252
|
-
count: 3, threshold: 3, lastHash: 'alias-keying-control', lastFailureAt: 0,
|
|
3253
|
-
});
|
|
3254
|
-
const breaker = runHook('hooks/scripts/rule-of-3.js', {
|
|
3255
|
-
hook_event_name: 'PreToolUse', session_id: sessionId, cwd: aliasRoot,
|
|
3256
|
-
tool_name: 'apply_patch', tool_input: { patch: '*** Update File: unrelated.txt\n@@\n-old\n+new\n' },
|
|
3257
|
-
});
|
|
3258
3251
|
assert.strictEqual(legacy.status, 0, `pilot-OFF state-persist must remain fail-open: ${legacy.stderr}`);
|
|
3259
3252
|
assert.strictEqual(pilot.status, 0, `pilot capture must remain fail-open: ${pilot.stderr}`);
|
|
3260
|
-
assert.strictEqual(breaker.status, 2, `rule-of-3 must find the tripped alias session: ${breaker.stderr}`);
|
|
3261
|
-
assert.match(breaker.stderr, /RULE OF 3 CIRCUIT BREAKER TRIGGERED/);
|
|
3262
|
-
console.log('PASS rule-of-3 alias-root positive control blocks at exit 2');
|
|
3263
3253
|
return {
|
|
3264
3254
|
legacyExit: legacy.status,
|
|
3265
3255
|
pilotOffCaptureCount,
|
|
@@ -3267,7 +3257,6 @@ test('legacy session-dir keying stays aligned through an aliased workspace root'
|
|
|
3267
3257
|
handoffInCanonicalSession: fs.existsSync(path.join(canonicalSessionDir, 'handoff-state.json')),
|
|
3268
3258
|
pilotCaptureInAliasSession: provider.readCaptureView(aliasSessionDir).records.some(item => item.tool_use_id === 'pilot-alias-capture'),
|
|
3269
3259
|
pilotCaptureInCanonicalSession: provider.readCaptureView(canonicalSessionDir).records.some(item => item.tool_use_id === 'pilot-alias-capture'),
|
|
3270
|
-
breakerExit: breaker.status,
|
|
3271
3260
|
};
|
|
3272
3261
|
} finally {
|
|
3273
3262
|
fs.rmSync(stateHome, { recursive: true, force: true });
|
|
@@ -3281,7 +3270,6 @@ test('legacy session-dir keying stays aligned through an aliased workspace root'
|
|
|
3281
3270
|
assert.deepStrictEqual(first, second, 'identical alias-root inputs must produce the same normalized state and exits');
|
|
3282
3271
|
assert.strictEqual(first.legacyExit, 0, 'pilot OFF remains fail-open');
|
|
3283
3272
|
assert.strictEqual(first.pilotOffCaptureCount, 0, 'pilot OFF writes no capture record');
|
|
3284
|
-
assert.strictEqual(first.breakerExit, 2, 'the aliased rule-of-3 positive control blocks');
|
|
3285
3273
|
assert.deepStrictEqual({
|
|
3286
3274
|
handoffInAliasSession: first.handoffInAliasSession,
|
|
3287
3275
|
handoffInCanonicalSession: first.handoffInCanonicalSession,
|
|
@@ -3292,7 +3280,7 @@ test('legacy session-dir keying stays aligned through an aliased workspace root'
|
|
|
3292
3280
|
handoffInCanonicalSession: false,
|
|
3293
3281
|
pilotCaptureInAliasSession: true,
|
|
3294
3282
|
pilotCaptureInCanonicalSession: false,
|
|
3295
|
-
}, `legacy handoff and pilot capture must stay in
|
|
3283
|
+
}, `legacy handoff and pilot capture must stay in the bound alias session directory: ${JSON.stringify(first)}`);
|
|
3296
3284
|
});
|
|
3297
3285
|
|
|
3298
3286
|
test('no final D stays incomplete and hand-authored JSON without a host seam earns no outline credit', () => {
|
|
@@ -59,7 +59,7 @@ test('S1-R04 integrated accepted route preserves policy and explicit model choic
|
|
|
59
59
|
assert.notEqual(risky.workflowPlan.memory.write, 'none');
|
|
60
60
|
const explicit = run('use fable-staged without subagents');
|
|
61
61
|
assert.notEqual(explicit.workflowPlan.strategy, 'direct-single');
|
|
62
|
-
assert.ok(explicit.workflowPlan.requiredInvariants.includes('replan-after-repeated-failure'));
|
|
62
|
+
assert.ok(!explicit.workflowPlan.requiredInvariants.includes('replan-after-repeated-failure'));
|
|
63
63
|
const normal = run('unusual bounded wording');
|
|
64
64
|
assert.equal(normal.workflowPlan.tier, 'tier1');
|
|
65
65
|
} finally { provider.score = original; console.log = log; if (env === undefined) delete process.env.HARNESS_SYSTEM_ONE_MODE; else process.env.HARNESS_SYSTEM_ONE_MODE = env; }
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
const assert = require('assert');
|
|
4
4
|
const crypto = require('crypto');
|
|
5
5
|
const fs = require('fs');
|
|
6
|
+
const os = require('os');
|
|
6
7
|
const path = require('path');
|
|
7
8
|
const { spawnSync } = require('child_process');
|
|
8
9
|
|
|
@@ -43,6 +44,33 @@ function assertTreesEqual(source, packaged, name) {
|
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
46
|
|
|
47
|
+
const sessionFixture = fs.mkdtempSync(path.join(process.env.TMPDIR || os.tmpdir(), 'harness-openai-session-start-'));
|
|
48
|
+
try {
|
|
49
|
+
const session = spawnSync(process.execPath, [path.join(ROOT, 'hooks', 'scripts', 'openai-session-start.js')], {
|
|
50
|
+
cwd: sessionFixture,
|
|
51
|
+
input: JSON.stringify({
|
|
52
|
+
hook_event_name: 'SessionStart',
|
|
53
|
+
session_id: 'openai-package-session-start',
|
|
54
|
+
cwd: sessionFixture,
|
|
55
|
+
source: 'startup'
|
|
56
|
+
}),
|
|
57
|
+
encoding: 'utf8',
|
|
58
|
+
env: { ...process.env, HARNESS_STATE_HOME: path.join(sessionFixture, 'state-home') }
|
|
59
|
+
});
|
|
60
|
+
assert.strictEqual(session.status, 0, session.stderr);
|
|
61
|
+
const sessionOutput = JSON.parse(session.stdout);
|
|
62
|
+
const sessionContext = sessionOutput.hookSpecificOutput.additionalContext;
|
|
63
|
+
assert.strictEqual(sessionOutput.hookSpecificOutput.hookEventName, 'SessionStart');
|
|
64
|
+
assert.match(sessionContext, /Cognitive OS policy is active/);
|
|
65
|
+
assert.match(sessionContext, /Route before execution/);
|
|
66
|
+
assert.match(sessionContext, /Verify before claim/);
|
|
67
|
+
assert.match(sessionContext, /first meaningful signal/i);
|
|
68
|
+
assert.match(sessionContext, /productive iteration may continue/i);
|
|
69
|
+
assert.doesNotMatch(sessionContext, /after 3 same-signature failures|third matching failure|Rule[- ]of[- ]3|forced reflection|compulsory report|reset|unlock/i);
|
|
70
|
+
} finally {
|
|
71
|
+
fs.rmSync(sessionFixture, { recursive: true, force: true });
|
|
72
|
+
}
|
|
73
|
+
|
|
46
74
|
assert.strictEqual(PLUGIN_MANIFEST.name, 'harness-everything');
|
|
47
75
|
assert.strictEqual(PLUGIN_MANIFEST.version, SOURCE_MANIFEST.version, 'OpenAI plugin version must match canonical plugin version');
|
|
48
76
|
assert.strictEqual(PLUGIN_MANIFEST.skills, './skills/');
|
|
@@ -164,13 +192,8 @@ assert.match(hookText, /PLUGIN_ROOT/, 'plugin hooks must resolve from PLUGIN_ROO
|
|
|
164
192
|
assert.match(hookText, /commandWindows/, 'plugin hooks need a Windows command override');
|
|
165
193
|
assert.match(hookText, /workflow-gate\.js/, 'plugin hooks must package workflow contract observation');
|
|
166
194
|
assert.match(hookText, /workflow-stop-gate\.js/, 'plugin hooks must package workflow completion reminders');
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
assert.strictEqual(session.status, 0, session.stderr);
|
|
170
|
-
assert.match(session.stdout, /Cognitive OS policy is active/);
|
|
171
|
-
assert.match(session.stdout, /Route before execution/);
|
|
172
|
-
assert.match(session.stdout, /Verify before claim/);
|
|
173
|
-
assert.match(session.stdout, /3 same-signature failures/);
|
|
195
|
+
assert.doesNotMatch(hookText, /rule-of-3(?:-tracker)?\.js|reset-circuit-breaker\.js/,
|
|
196
|
+
'OpenAI package must not register retired breaker entry points');
|
|
174
197
|
|
|
175
198
|
const kernel = path.join(PLUGIN, 'skills', 'harness-everything', 'scripts', 'kernel-router.js');
|
|
176
199
|
function route(prompt) {
|
|
@@ -61,8 +61,8 @@ assert.ok(fs.existsSync(path.join(PLUGIN, 'scripts', 'lib', 'advisory-text.js'))
|
|
|
61
61
|
const packagedState = fs.readFileSync(path.join(PLUGIN, 'hooks', 'scripts', 'lib', 'harness-state.js'), 'utf8');
|
|
62
62
|
assert.doesNotMatch(packagedState, /\.\.\/\.\.\/\.\.\/scripts[\\/]lib[\\/]workspace/);
|
|
63
63
|
|
|
64
|
-
function runHook(relative, payload, stateHome) {
|
|
65
|
-
return spawnSync(process.execPath, [path.join(PLUGIN, relative)], {
|
|
64
|
+
function runHook(relative, payload, stateHome, args = []) {
|
|
65
|
+
return spawnSync(process.execPath, [path.join(PLUGIN, relative), ...args], {
|
|
66
66
|
input: JSON.stringify(payload),
|
|
67
67
|
encoding: 'utf8',
|
|
68
68
|
cwd: ROOT,
|
|
@@ -70,6 +70,22 @@ function runHook(relative, payload, stateHome) {
|
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
function registeredHooks(event, tool) {
|
|
74
|
+
return (hooks[event] || [])
|
|
75
|
+
.filter(group => !group.matcher || group.matcher.split('|').some(pattern =>
|
|
76
|
+
pattern === tool || pattern === '.*' || (pattern.endsWith('.*') && tool.startsWith(pattern.slice(0, -2)))))
|
|
77
|
+
.flatMap(group => group.hooks || []);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function runRegistered(event, tool, payload, stateHome) {
|
|
81
|
+
return registeredHooks(event, tool).map(hook => {
|
|
82
|
+
const match = hook.command.match(/^node "\$\{PLUGIN_ROOT\}\/([^"]+)"(.*)$/);
|
|
83
|
+
assert.ok(match, `unrecognized packaged hook command: ${hook.command}`);
|
|
84
|
+
const args = match[2].trim().split(/\s+/).filter(Boolean);
|
|
85
|
+
return runHook(match[1], { ...payload, hook_event_name: event, tool_name: tool }, stateHome, args);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
73
89
|
const fixture = fs.mkdtempSync(path.join(os.tmpdir(), 'harness-openai-runtime-'));
|
|
74
90
|
const stateHome = path.join(fixture, 'state-home');
|
|
75
91
|
const gitInit = spawnSync('git', ['init', '--quiet'], { cwd: fixture, encoding: 'utf8' });
|
|
@@ -117,39 +133,55 @@ assert.ok(handoff, 'SessionStart/state-persist should create a handoff state fil
|
|
|
117
133
|
assert.ok(JSON.parse(fs.readFileSync(handoff, 'utf8')).lastEditAt, 'apply_patch must count as an edit');
|
|
118
134
|
|
|
119
135
|
const sessionDir = path.dirname(handoff);
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
threshold: 3,
|
|
123
|
-
lastHash: 'runtime-test-failure',
|
|
124
|
-
lastFailureAt: 0
|
|
125
|
-
}), 'utf8');
|
|
126
|
-
const reportFile = path.join(sessionDir, 'zoom-out-report.md');
|
|
127
|
-
const reportWrite = runHook('hooks/scripts/rule-of-3.js', {
|
|
128
|
-
hook_event_name: 'PreToolUse',
|
|
129
|
-
session_id: 'openai-runtime-test',
|
|
130
|
-
cwd: fixture,
|
|
131
|
-
tool_name: 'apply_patch',
|
|
132
|
-
tool_input: { patch: `*** Add File: ${reportFile}\n## Goal` }
|
|
133
|
-
}, stateHome);
|
|
134
|
-
assert.strictEqual(reportWrite.status, 0, 'apply_patch must be allowed to write the zoom-out report');
|
|
136
|
+
assert.doesNotMatch(hookText, /rule-of-3(?:-tracker)?\.js|reset-circuit-breaker\.js/,
|
|
137
|
+
'packaged Codex hooks must not register retired breaker entry points');
|
|
135
138
|
|
|
136
|
-
const
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
assert.strictEqual(
|
|
139
|
+
const legacyState = { count: 3, lastHash: 'legacy-trip', zoomOutResolved: false, lastFailureAt: 123, zoomOutCycles: 0 };
|
|
140
|
+
const legacyStateFile = path.join(sessionDir, 'rule-of-3-state.json');
|
|
141
|
+
const reportFile = path.join(sessionDir, 'zoom-out-report.md');
|
|
142
|
+
const note = 'agent-authored recovery note\n';
|
|
143
|
+
fs.writeFileSync(legacyStateFile, JSON.stringify(legacyState), 'utf8');
|
|
144
|
+
fs.writeFileSync(reportFile, note, 'utf8');
|
|
145
|
+
const resumedSession = runHook('hooks/session-start.js', sessionPayload, stateHome);
|
|
146
|
+
assert.strictEqual(resumedSession.status, 0, resumedSession.stderr);
|
|
147
|
+
assert.deepStrictEqual(JSON.parse(fs.readFileSync(legacyStateFile, 'utf8')), legacyState,
|
|
148
|
+
'Codex startup leaves stale breaker state inert and intact');
|
|
149
|
+
assert.strictEqual(fs.readFileSync(reportFile, 'utf8'), note,
|
|
150
|
+
'Codex startup preserves optional agent-authored notes');
|
|
151
|
+
|
|
152
|
+
for (const scenario of [
|
|
153
|
+
{ name: 'fresh', state: null, command: `${process.execPath} -e "process.exit(1)"`, response: { exitCode: 1, stderr: 'fixture failure' } },
|
|
154
|
+
{ name: 'legacy-tripped', state: legacyState, command: `${process.execPath} -e "process.stdout.write('permitted')"`, response: { exitCode: 0, stdout: 'permitted' } },
|
|
155
|
+
]) {
|
|
156
|
+
if (scenario.state) fs.writeFileSync(legacyStateFile, JSON.stringify(scenario.state), 'utf8');
|
|
157
|
+
else fs.rmSync(legacyStateFile, { force: true });
|
|
158
|
+
const payload = {
|
|
159
|
+
host: 'codex', session_id: 'openai-runtime-test', cwd: fixture,
|
|
160
|
+
tool_use_id: `r1-${scenario.name}`, tool_input: { command: scenario.command },
|
|
161
|
+
};
|
|
162
|
+
const before = runRegistered('PreToolUse', 'Bash', payload, stateHome);
|
|
163
|
+
assert.ok(before.every(result => result.status === 0), `${scenario.name} pre-tool hooks should permit this command: ${before.map(item => item.stderr).join('\n')}`);
|
|
164
|
+
const call = spawnSync(process.execPath, ['-e', scenario.name === 'fresh' ? 'process.exit(1)' : 'process.stdout.write("permitted")'], {
|
|
165
|
+
cwd: fixture, encoding: 'utf8',
|
|
166
|
+
});
|
|
167
|
+
assert.strictEqual(call.status, scenario.response.exitCode, `${scenario.name} otherwise-permitted tool call must run`);
|
|
168
|
+
const after = runRegistered('PostToolUse', 'Bash', { ...payload, tool_response: scenario.response }, stateHome);
|
|
169
|
+
assert.ok(after.every(result => result.status === 0), `${scenario.name} result hooks should complete: ${after.map(item => item.stderr).join('\n')}`);
|
|
170
|
+
if (scenario.state) {
|
|
171
|
+
assert.deepStrictEqual(JSON.parse(fs.readFileSync(legacyStateFile, 'utf8')), legacyState,
|
|
172
|
+
'legacy tripped state remains unchanged after the next tool call');
|
|
173
|
+
} else {
|
|
174
|
+
assert.strictEqual(fs.existsSync(legacyStateFile), false, 'fresh tool call creates no breaker state');
|
|
175
|
+
}
|
|
176
|
+
}
|
|
144
177
|
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
cwd: fixture,
|
|
149
|
-
tool_name: 'apply_patch',
|
|
150
|
-
tool_input: { patch: '*** Update File: unrelated.txt\n@@' }
|
|
178
|
+
const denied = runRegistered('PreToolUse', 'mcp__codex_apps__github__delete_issue', {
|
|
179
|
+
host: 'codex', session_id: 'openai-runtime-test', cwd: fixture, tool_use_id: 'r1-denied-control',
|
|
180
|
+
tool_input: { repository_full_name: 'example/repo', issue_number: 7 },
|
|
151
181
|
}, stateHome);
|
|
152
|
-
assert.strictEqual(
|
|
182
|
+
assert.strictEqual(denied.length, 1);
|
|
183
|
+
assert.strictEqual(denied[0].status, 2, 'the independent Codex action gate still blocks a destructive MCP action');
|
|
184
|
+
assert.match(denied[0].stderr, /no Harness-verified ask-style decision path/);
|
|
153
185
|
|
|
154
186
|
const subagentStart = runHook('hooks/scripts/subagent-start.js', {
|
|
155
187
|
hook_event_name: 'SubagentStart',
|
|
@@ -11,7 +11,6 @@ function read(rel) {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
// #273: Fable replan counts are advisory, never execution hard-stops.
|
|
14
|
-
// Only repeated same-signature failures invoke mandatory Rule-of-3 reflection.
|
|
15
14
|
for (const [canonical, packaged] of [
|
|
16
15
|
['fable-mode/SKILL.md', 'plugins/harness-everything/skills/fable-mode/SKILL.md'],
|
|
17
16
|
['fable-mode/fable-opus/SKILL.md', 'plugins/harness-everything/skills/fable-mode/fable-opus/SKILL.md'],
|
|
@@ -23,7 +22,6 @@ for (const [canonical, packaged] of [
|
|
|
23
22
|
? read('fable-mode/references/execution-phases.md') : '';
|
|
24
23
|
const contract = body + '\n' + phases;
|
|
25
24
|
assert.ok(/advisory replan|replans are advisory/i.test(contract), canonical + ' must describe replans as advisory');
|
|
26
|
-
assert.ok(/Rule-of-3/i.test(contract), canonical + ' must preserve same-signature failure reflection');
|
|
27
25
|
assert.ok(!/at most two (?:full )?replans/i.test(body), canonical + ' must not imply a two-replan hard cap');
|
|
28
26
|
}
|
|
29
27
|
for (const rel of [
|
|
@@ -38,12 +36,11 @@ assert.ok(/maxReplans[\s\S]{0,60}is advisory/i.test(orchestratorContract), 'orch
|
|
|
38
36
|
assert.ok(/do not block execution/i.test(orchestratorContract), 'orchestrator does not block on replan count');
|
|
39
37
|
|
|
40
38
|
// #275: build divergence is a diagnostic signal, not a second hard-stop.
|
|
41
|
-
//
|
|
39
|
+
// Divergent build state remains diagnostic guidance, not a hard stop.
|
|
42
40
|
const fableDiscipline = read('fable-discipline/SKILL.md');
|
|
43
41
|
assert.strictEqual(read('plugins/harness-everything/skills/fable-discipline/SKILL.md'), fableDiscipline, 'fable-discipline packaged contract matches canonical');
|
|
44
42
|
assert.ok(/divergence is a warning signal/i.test(fableDiscipline), 'fable-discipline must classify divergence as warning guidance');
|
|
45
43
|
assert.ok(/does not hard-stop execution/i.test(fableDiscipline), 'divergence must not create an independent hard stop');
|
|
46
|
-
assert.ok(/Rule-of-3 owns mandatory reflection/i.test(fableDiscipline), 'Rule-of-3 remains the mandatory reflection owner');
|
|
47
44
|
assert.ok(!/HALTS execution immediately/i.test(fableDiscipline), 'fable-discipline must not retain the divergent-build hard halt');
|
|
48
45
|
assert.ok(!/If build errors diverge, HALT/i.test(fableDiscipline), 'fable-discipline must not issue an immediate divergence halt');
|
|
49
46
|
|
|
@@ -107,7 +104,6 @@ assert.ok(!/Trigger: Commit Request \/ Task Complete/i.test(gitCommitFlow), 'tas
|
|
|
107
104
|
|
|
108
105
|
// #275 reference surface must agree with the non-blocking divergence contract.
|
|
109
106
|
assert.ok(/divergence alone is not a hard stop/i.test(fableDisciplineRules), 'fable reference keeps divergence advisory');
|
|
110
|
-
assert.ok(/Mandatory reflection remains owned by Rule-of-3/i.test(fableDisciplineRules), 'fable reference keeps Rule-of-3 as reflection owner');
|
|
111
107
|
assert.ok(!/HALT EXECUTION IMMEDIATELY/i.test(fableDisciplineRules), 'fable reference must not retain the old divergence hard halt');
|
|
112
108
|
const fableWorkflow = read('docs/workflows/fable-discipline.md');
|
|
113
109
|
const gitWorkflow = read('docs/workflows/git-commit.md');
|
|
@@ -7,10 +7,12 @@ const { spawnSync: spawnNodeSync } = require('child_process');
|
|
|
7
7
|
|
|
8
8
|
function spawnSync(command, args, options = {}) {
|
|
9
9
|
const { systemOneMode = 'off', ...spawnOptions } = options;
|
|
10
|
+
const inheritedEnv = Object.fromEntries(Object.entries(process.env)
|
|
11
|
+
.filter(([key]) => !key.toUpperCase().startsWith('HARNESS_')));
|
|
10
12
|
return spawnNodeSync(command, args, {
|
|
11
13
|
...spawnOptions,
|
|
12
14
|
env: {
|
|
13
|
-
...
|
|
15
|
+
...inheritedEnv,
|
|
14
16
|
...(spawnOptions.env || {}),
|
|
15
17
|
HARNESS_SYSTEM_ONE_MODE: systemOneMode,
|
|
16
18
|
},
|
|
@@ -65,7 +67,6 @@ function runTier(prompt, options = {}) {
|
|
|
65
67
|
encoding: 'utf8',
|
|
66
68
|
input: context ? JSON.stringify({ ...context, prompt }) : undefined,
|
|
67
69
|
env: {
|
|
68
|
-
...process.env,
|
|
69
70
|
...(options.env || {}),
|
|
70
71
|
HARNESS_ROUTER_CONTRACT_PATH: contractPath,
|
|
71
72
|
},
|
|
@@ -488,7 +489,7 @@ const kernelNotificationPersistFailure = spawnSync(process.execPath, [kernelRout
|
|
|
488
489
|
hook_event_name: 'UserPromptSubmit',
|
|
489
490
|
prompt: '<task-notification><task-id>background-1</task-id><status>completed</status></task-notification>',
|
|
490
491
|
}),
|
|
491
|
-
env: {
|
|
492
|
+
env: { HARNESS_STATE_HOME: notificationStateFile, HARNESS_WORKSPACE_ROOT: ROOT },
|
|
492
493
|
});
|
|
493
494
|
check(kernelNotificationPersistFailure.status === 0, 'host notification persistence failure stays fail-open');
|
|
494
495
|
check(kernelNotificationPersistFailure.stdout.includes('Host notification: no active execution contract; ignored for routing.'), 'host notification remains a routing no-op when state persistence fails');
|
|
@@ -510,18 +511,17 @@ check(!kernelIterative.stdout.includes('evaluate-suggestions-before-skip'), 'leg
|
|
|
510
511
|
|
|
511
512
|
const retainedStateHome = fs.mkdtempSync(path.join(os.tmpdir(), 'harness-router-retained-step-'));
|
|
512
513
|
const retainedSession = 'issue297-retained-step';
|
|
513
|
-
const retainedEnv =
|
|
514
|
-
...process.env,
|
|
514
|
+
const retainedEnv = {
|
|
515
515
|
HARNESS_STATE_HOME: retainedStateHome,
|
|
516
516
|
HARNESS_WORKSPACE_ROOT: ROOT,
|
|
517
|
-
}
|
|
517
|
+
};
|
|
518
518
|
const retainedInput = prompt => JSON.stringify({ session_id: retainedSession, cwd: ROOT, hook_event_name: 'UserPromptSubmit', prompt });
|
|
519
|
-
const initialRetainedRoute = spawnSync(process.execPath, [kernelRouter], {
|
|
519
|
+
const initialRetainedRoute = withInheritedSystemOneLive(() => spawnSync(process.execPath, [kernelRouter], {
|
|
520
520
|
cwd: ROOT,
|
|
521
521
|
encoding: 'utf8',
|
|
522
522
|
input: retainedInput('Fix this checkout bug and add a regression test.'),
|
|
523
523
|
env: retainedEnv,
|
|
524
|
-
});
|
|
524
|
+
}));
|
|
525
525
|
check(initialRetainedRoute.status === 0, 'retained workflow fixture routes successfully');
|
|
526
526
|
check(!initialRetainedRoute.stdout.includes('SYSTEM ONE REFERENCE CONFIDENCE'), 'retained kernel route ignores inherited live mode');
|
|
527
527
|
check(initialRetainedRoute.stdout.includes('PLANNING STEP: decompose → compose'), 'new selected workflow exposes its planning step');
|