test: pin that a public-review stage never dispatches through the CoS runner (#6105) - #6135
Merged
Conversation
… 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A public-review stage is direct-only —
spawnAgentForTaskforces it off the CoS runner with one expression, and nothing pinned it:That line is load-bearing because the two halves of a vendor's
no-toolposture are enforced in different places. The argv is declared on the vendor row and resolved insidebuildVendorSpawnConfig, so it survives any dispatch path — but OpenCode's posture lives entirely in the config contentbuildCliChildEnvwrites from thesafetyProfileit is handed, and the runner payload (composeProviderEnvatspawnAgentViaRunner) carries nosafetyProfile. 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
safetyProfileinto 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.jsonly:PATHS.cosAgentsre-rooted at a temp dir via the existingmakePathsProxyhelper, plus stubs for the leaves between workspace prep and dispatch (readPublicReviewInputSnapshot,buildAgentPrompt,createAgentRun,buildCliSpawnConfig,workspaceContext.snapshotOnRepoSwitch, the twoagentPromptBuilderpredicates theregisterAgentprojection reads). The orchestrator itself stays the production one.spawnDirectly, carrying itssafetyProfile, andspawnAgentViaRunneris never called.spawns a public-review stage on a TUI provider headless, never as a PTY sessionpassed its negatives because the flow never reached a spawner at all. It now runs to the dispatch and assertsspawnDirectlywas called.Test plan
server/services/agentLifecycle.postureGate.test.js— 7 passed.dispatchUseRunnerto plainuseRunnerturns 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.cd server && npm test): 1917 files passed, 38719 tests passed, 14 skipped.Closes #6105
https://claude.ai/code/session_01RA3pD5YM2dukQwbZ3pC6WA