Skip to content

test: pin that a public-review stage never dispatches through the CoS runner (#6105) - #6135

Merged
atomantic merged 1 commit into
mainfrom
claim/issue-6105
Sep 3, 2026
Merged

test: pin that a public-review stage never dispatches through the CoS runner (#6105)#6135
atomantic merged 1 commit into
mainfrom
claim/issue-6105

Conversation

@atomantic

@atomantic atomantic commented Sep 3, 2026

Copy link
Copy Markdown
Owner

Summary

A public-review stage is direct-only — spawnAgentForTask forces it off the CoS runner with one expression, and nothing pinned it:

const dispatchUseRunner = publicReview ? false : useRunner;

That line is load-bearing because the two halves of a vendor's no-tool posture are enforced in different places. The argv is declared on the vendor row and resolved inside buildVendorSpawnConfig, so it survives any dispatch path — but OpenCode's posture lives entirely in the config content buildCliChildEnv writes from the safetyProfile it is handed, and the runner payload (composeProviderEnv at spawnAgentViaRunner) carries no safetyProfile. A stage that reached the runner would still look enforced (right flag, right provider, gate passed) while running tool-enabled against contributor-authored PR text. Silent, and green in CI.

No production change — the routing itself is what gets pinned. Threading safetyProfile into the runner payload as a belt was considered and declined: it would make routing a public-review stage through the shared runner look supported, and the runner may inherit ambient tool configuration.

What changed

server/services/agentLifecycle.postureGate.test.js only:

  • Extended the mock set so a public-review spawn actually reaches the dispatch — PATHS.cosAgents re-rooted at a temp dir via the existing makePathsProxy helper, plus stubs for the leaves between workspace prep and dispatch (readPublicReviewInputSnapshot, buildAgentPrompt, createAgentRun, buildCliSpawnConfig, workspaceContext.snapshotOnRepoSwitch, the two agentPromptBuilder predicates the registerAgent projection reads). The orchestrator itself stays the production one.
  • New case: a public-review stage with runner mode on still goes to spawnDirectly, carrying its safetyProfile, and spawnAgentViaRunner is never called.
  • New control: with the same mock set, an ordinary task does reach the runner — so the negative above cannot pass merely because runner mode never took effect.
  • De-vacuumed the sibling case. spawns a public-review stage on a TUI provider headless, never as a PTY session passed its negatives because the flow never reached a spawner at all. It now runs to the dispatch and asserts spawnDirectly was called.

Test plan

  • server/services/agentLifecycle.postureGate.test.js — 7 passed.
  • Mutation-checked: changing dispatchUseRunner to plain useRunner turns the new case red on the assertion that names the invariant (expected spawnAgentViaRunner not to be called, 1 call), and green again on restore. The control and the other five cases stay green either way, so the failure points at the routing rather than at the scaffold.
  • Full server suite (cd server && npm test): 1917 files passed, 38719 tests passed, 14 skipped.

Closes #6105

https://claude.ai/code/session_01RA3pD5YM2dukQwbZ3pC6WA

… runner (#6105)

A public-review stage is direct-only, and nothing pinned that. The two halves
of a vendor's `no-tool` posture are enforced in different places: the argv is
declared on the vendor row and survives any dispatch path, but OpenCode's
posture lives entirely in the config content `buildCliChildEnv` writes from the
`safetyProfile` it is handed — and the CoS runner payload carries no
`safetyProfile`. A stage that reached the runner would still look enforced
(right flag, right provider, gate passed) while running tool-enabled against
contributor-authored PR text. Silent, and green in CI.

Extends the posture-gate suite's mock set so a public-review spawn reaches the
dispatch (temp `PATHS.cosAgents`, resolved snapshot/prompt/run leaves) and adds
the case: with runner mode on, the stage still goes to `spawnDirectly` carrying
its `safetyProfile`, and `spawnAgentViaRunner` is never called. A control case
proves runner mode genuinely routes an ordinary task to the runner in the same
mock set, so the negative is not vacuous.

The sibling "headless, never as a PTY session" case had the same vacuity — its
negatives passed because the flow never reached a spawner at all. It now runs
to the dispatch too and asserts `spawnDirectly` was called.

No production change.

Claude-Session: https://claude.ai/code/session_01RA3pD5YM2dukQwbZ3pC6WA
@atomantic
atomantic merged commit 95dec1a into main Sep 3, 2026
7 checks passed
@atomantic
atomantic deleted the claim/issue-6105 branch September 3, 2026 22:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pin the invariant that a public-review stage never dispatches through the CoS runner

1 participant