fix(sdk): unbreak main — artifact-gate test under the run-root contract

Merged
KH
2mo ago
+7-2

main is red

Relayflow v2 Cloud runtime artifact — the job that runs the full SDK suite — fails on e30226c35, the merge of #517:

e07a19065  04:46  success     ← last green
e30226c35  05:42  FAILURE     ← #517 merged

It also blocks #518, #519 and #520, which inherit the failure from main.

Cause

Two correct changes that are incompatible together.

#512 introduced the contained-cwd contract: a step's cwd must be run-root-relative. #517's artifact-gate test declares an absolute one:

const cwd = tempDir();
… { id: 'review', type: 'agent', instruction: 'i', cli: 'claude', cwd, … }

So compileSpec throws spec.steps[0].cwd: expected a run-root-relative path, not an absolute path, preflight classifies the throw as invalid_spec, and the test's expected gate_path_unscanned never arrives:

AssertionError: expected [ 'invalid_spec' ] to deeply equal [ 'gate_path_unscanned' ]

Both PRs were green on their own branches. Neither could have caught this: GitHub does not re-run the suite against the post-merge tree, so branch-green does not imply main-green here.

Fix

The test uses cwd only to spawn its fake claude in a temp directory — which is what a run root is for. The step now declares no cwd, and the worker carries runRoot, matching how #512 restated the duration dispatch under the same contract.

No production code changes. The assertions are untouched.

Verification

27 passed (27) in artifact-gates.test.ts.

Mutation-proved — reverting #517's warning back to a refusal still fails this test, so it guards the same behaviour as before rather than passing vacuously:

 × does not refuse a gate the bundled worker itself can satisfy through JSON output
   → expected [ 'invalid_spec' ] to deeply equal [ 'gate_path_unscanned' ]

Worth following up separately

summary.md, the garden's own pull-request body source, keeps landing on main and conflicts on every rebase. It is a build artifact, not part of any change.

🤖 Generated with Claude Code


[!NOTE]
Low Risk
Test-only change with no production code paths modified.

Overview
Repairs a failing SDK test after the run-root-relative cwd rule: the integration case no longer puts an absolute temp path on the agent step (which compileSpec rejects as invalid_spec), and instead passes that directory as the worker’s runRoot so the fake CLI still runs in the same contained tree.

Assertions are unchanged—the test still expects a gate_path_unscanned warning and that JSON-reported artifacts under node_modules can satisfy the gate at runtime. Comments document that the scenario is about gate scanning, not how cwd is declared on steps.

Reviewed by Cursor Bugbot for commit 083e229f28c4409f85c4a1a566673035a81ebf61. Bugbot is set up for automated code reviews on this repo. Configure here.


Summary by cubic

Unbreaks the SDK suite on main, which went red when #517 merged: its artifact-gate test declares an absolute cwd on the step, and the contained-cwd contract now refuses that, so preflight reports invalid_spec instead of the expected gate_path_unscanned.

  • The step now declares no cwd; the worker carries runRoot, which is how a contained working directory is expressed under the contract.
  • Production code is untouched, and the assertions are unchanged — reverting the underlying warning still fails the test, so it guards the same behavior as before.