From 083e229f28c4409f85c4a1a566673035a81ebf61 Mon Sep 17 00:00:00 2001 From: Proactive Runtime Bot Date: Wed, 23 Sep 2026 23:11:06 -0700 Subject: [PATCH] fix(sdk): express the artifact-gate test under the run-root contract MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit main went red when #517 merged: its artifact-gate test declares an absolute `cwd` on the step, and #512's contained-cwd contract refuses that — `spec.steps[0].cwd: expected a run-root-relative path, not an absolute path`. compileSpec throws, preflight reports `invalid_spec`, and the test's expected `gate_path_unscanned` never happens. Each change is correct alone; only the combination fails, and neither branch could see it because CI does not re-run the suite against the merged tree. The test uses cwd only to spawn its fake `claude` in a temp directory, which is exactly what a run root is for. The step now declares no cwd and the worker carries `runRoot`, matching how #512 restated the duration dispatch. The assertions are unchanged, and reverting #517's `gate_path_unscanned` warning still fails this test, so it guards the same behaviour it did before. --- packages/sdk/tests/artifact-gates.test.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/sdk/tests/artifact-gates.test.ts b/packages/sdk/tests/artifact-gates.test.ts index 55a68963..0bebb123 100644 --- a/packages/sdk/tests/artifact-gates.test.ts +++ b/packages/sdk/tests/artifact-gates.test.ts @@ -308,8 +308,13 @@ describe('artifact_exists named gate: static scan coverage', () => { writeFileSync(join(dir!, 'node_modules/review.md'), 'findings'); }; claudeResult = JSON.stringify({ artifacts: [path] }); + // The step declares no cwd: `cwd` here is the worker's run root, which is + // how a contained working directory is expressed since the run-root + // contract landed. Declaring the absolute temp directory on the step is + // refused now ("expected a run-root-relative path"), and this test is + // about gate scanning, not about the shape of a cwd declaration. const authored = { version: '0.1.0', name: 'x', steps: [{ id: 'review', type: 'agent', instruction: 'i', - cli: 'claude', cwd, verification: { type: 'artifact_exists', path } }] }; + cli: 'claude', verification: { type: 'artifact_exists', path } }] }; // `claude` carries a default model, so its probe has to answer the // model-scoped readiness question too; nothing else about it matters here. @@ -327,7 +332,7 @@ describe('artifact_exists named gate: static scan coverage', () => { client.once('worker-error', reject); }); const worker = new AgentWorker(client as unknown as JournalClient, { - workerId: 'w', pins: { workspace: [], streams: [] }, + workerId: 'w', pins: { workspace: [], streams: [] }, runRoot: cwd, }); worker.on('error', (error: unknown) => client.emit('worker-error', error)); await worker.attach();