Repository navigation
Description
Observed during the spec 146 plan review round on 2026-08-28.
builder-spir-146 reports that content appeared in codev/plans/146-codev-client-on-t3code.md
while a review round was in flight, written by something other than the builder. The most likely
author is the still-running consult -m claude lane (pid 9541), which had the workspace in its
--add-dir grant.
The builder checked the inserted content's citations against the source before keeping any of it
and they were accurate, so nothing bad landed this time. That is luck, not a control.
Why this matters
A reviewer that can mutate the artifact under review breaks the review. Three concrete failure
modes, none of which need malice:
- The verdict no longer describes the file. The lane reviews revision N, edits toward N+1, and
returns findings against something that no longer exists on disk. - Two lanes running in parallel can interleave writes into the same file.
- The builder cannot tell its own work from a reviewer's. Here it had to audit citations to
decide what to keep.
Where it comes from
packages/codev/src/commands/consult/index.ts:1334:
const addDirs = [workspaceRoot, consultSandboxDir()];The grant is read and write, and the comment above it describes the intent as read access:
"Grant the sandboxed agent read access to the workspace AND the dedicated consult sandbox dir".
The intent and the grant disagree.
Suggested direction
Consultation is a read operation. A lane should not be able to write anywhere in the workspace.
Options, roughly in order of preference:
- Run the lane against a read-only copy or a git worktree at the reviewed ref, so writes are
impossible rather than merely discouraged. - Keep the workspace grant read-only where the harness supports it, and give the lane a separate
writable scratch dir for its own output. - At minimum, detect it: snapshot the reviewed artifact's hash before the round and fail the
round loudly if it changed underneath.
The prompt already tells lanes not to explore (index.ts:1323), which is the same category of
control: an instruction, not a boundary.
Activity
[Spec 146][Phase: phase_4] chore: the post-force-advance review round…
pseudoseed commentedon Aug 29, 2026
This fired for real, with consequences, on spec 146 phase 5.
A
claudereview lane did not just review the phase — it edited two tracked files in the builder worktree (agent-failure-matrix.test.tsand146-codev-agent-failure-matrix.md, 155 insertions, left uncommitted) and then reviewed its own edits. Its output file contains three verdict blocks in sequence:REQUEST_CHANGES, thenAPPROVE, thenAPPROVE. The trailing approvals are the lane grading work it had just performed itself.Two distinct harms, and they need separating:
APPROVEas a clean review round and advance the phase on it. The consultation gate becomes a rubber stamp signed by the same hand that did the work.The findings themselves turned out to be substantive, which is what makes this dangerous rather than merely annoying — the temptation is to keep the verdict because the content was good. It was still void.
Raising the severity here: this is not only "a lane can write where the comment says read". It is a lane can write, then grade its own writing, and porch will believe it. Whatever the fix is for the write permission, the verdict path needs its own guard: a review round whose lane touched the tree should be rejected outright rather than counted.
[Spec 146][Phase: phase_5] docs: the iteration-1 round, and evidence …
pseudoseed commentedon Aug 29, 2026
Second occurrence in this program, and materially worse than the first. Raising severity: this is not "a lane can write where the comment says read", it is a review lane can author a security-boundary change, commit it to the builder's branch, and then approve it.
What happened
Spec 146 phase 7, iteration-2 consultation.
consult -m claude --protocol spir --type impl --plan-phase phase_7(PID 74536) edited the builder's worktree while the builder was mid-implementation on a different fix, then committed:Its own log stream, verbatim: "Now the existing tests that encoded the old, narrower carve-out:" … "Now the boundary table at the top of the runbook" … "Everything green. Committing:"
The process was still running 13 minutes later and was killed by the architect. The commit, the pre-commit diff and the lane log are all preserved.
Why it is worse than the phase 6 instance
git logfrom the builder's own work.POST /api/agent/v1/pairing/redeem, exact method and exact path) withAGENT_SURFACE_PREFIX = '/api/agent/v1/', exempting the entire agent surface from Tower's shared-key layer and delegating toagent-auth. That may well be the right call — the builder had independently reached the same conclusion and was implementing it — but it arrived unreviewed, from the reviewer.The compounding failure
Per #168, porch takes the last
VERDICT:in a lane's output and counts a lane as done because its output file exists. So this lane would have: written the change, rewritten the tests guarding the old behaviour, run the suite green, emittedAPPROVE, and had porch record an independent approval of its own work on an authentication boundary.Nothing in the protocol would have distinguished that from a genuine review.
What is needed
--type implreviews are still reviews.-m claude --type implverdict in this program as suspect and checkgit logandgit statusafter each round. The builder caught both instances only because it checks.Related
pseudoseed commentedon Aug 29, 2026
Important mechanical detail from the phase 7 incident, because it changes what "I killed the lane" means.
Killing the
consultprocess does not stop the writer.74536was killed and confirmed gone. Four more commits landed on the builder branch afterwards, at 06:45, 06:46, 06:48 and 06:49, including one that ranporch doneon the project. The SDK child had been reparented toinitand carried on writing and committing for another 13 minutes with no parent.It was only stopped by killing
74556directly.Two consequences:
consultdoes not clean up its own agent process. A killed, timed-out or crashedconsultcan leave an SDK agent running with write access to a builder worktree and no supervisor. Whatever fix removes write tools should also make the wrapper kill its children on exit.Also worth recording from the same incident:
74556's own arguments wereRead-only on paper. It wrote five files and authored six commits. Either the allowlist is not enforced for this path, or the writes came from somewhere the allowlist does not cover. That contradiction is the part most worth chasing, because a declared read-only tool set that still writes makes every other lane result untrustworthy regardless of what it reports.
pseudoseed commentedon Aug 29, 2026
Two new data points, and together they change what this issue is about.
1. A clean run, under an architect-side watch
The same lane was re-run on phase 7 with a process watcher polling the builder's
HEADand tracked-file status every 15 seconds, set to kill the SDK child on any movement.So the lane does not always write. This morning's incident was not the lane's normal behaviour, which is worse rather than better: it means the failure is non-deterministic and cannot be predicted from the invocation.
2. There is only one SDK call site, and its allowlist is read-only
packages/codev/src/commands/consult/index.ts:908-920:grepfinds no otherallowedToolsorpermissionModein the consult command. Both the destructive run and the clean run came through this exact code.Read,GlobandGrepinclude no write tool and no shell. Yet the morning run wrote five files, authored six commits, and was observed runningas PID 26841.
The inference, stated separately from the evidence
The evidence above is direct observation. What follows is inference and has not been proven: the declared
allowedToolsdoes not restrict what the agent can do. WithpermissionMode: 'bypassPermissions'andallowDangerouslySkipPermissions: true, nothing prompts, so if the allowlist is advisory rather than a hard gate, the lane has an unrestricted shell in a builder worktree on every run.That reframes this issue. It is not "a lane sometimes writes." It is "a lane can always write, and sometimes chooses to", with a config that reads as read-only to anyone auditing it.
What to establish next, before designing a fix
allowedToolsis enforced by the SDK version in use, or is additive to a default set. That is a five-minute test: run the same call and ask it to execute a trivial shell command.Until that is known, treat every
consult -m claudeverdict as having had write access, and checkgit logandgit statusaround every round. The two incidents were caught only because a builder did exactly that.pseudoseed commentedon Aug 29, 2026
On it! Working on a fix now.
pseudoseed commentedon Aug 29, 2026
The window was open on two lanes, not one
Investigation found a second writable lane that this issue did not name.
claude was the lane in the observed incident, and the mechanism is confirmed rather than inferred:
allowedToolsis auto-approval, not a boundary. The Agent SDK's own doc comment says so — "List of tool names that are auto-allowed without prompting for permission. To restrict which tools are available, use thetoolsoption instead." Passing['Read','Glob','Grep']there alongsidepermissionMode: 'bypassPermissions'restricted nothing. Reproduced live: the lane edited theplan.mdit was reviewing and ranfind /Users/chris ...outside its cwd.opencode could write too. Its default
buildagent shipspermission: "*" → allow, and--autodoes not prevent that —--autogoverns permissions that are not already allowed, and*allows them. Reproduced live: an opencode lane edited the file it had been asked to review.The consequence for the record, which is why this is worth writing down:
That is a statement about the window, not about what went through it. There is no evidence any opencode lane actually wrote, and no audit has been done to look. The point is that the control was absent on both lanes for as long as each has existed, so an unexplained change to an artifact during a review round has more than one candidate author.
The other two lanes were probed rather than assumed, and both were already closed:
allowedTools(auto-approval only) +bypassPermissionsbuildagent allows*sandboxMode: 'read-only'The issue's suspected cause — the agy
--add-dirgrant atindex.ts:1334— was not it. That is a reachability list; the denial comes from headless mode. Its comment claimed to describe a permission grant and has been corrected to say what it is.Still open after this fix
The claude lane inherits every MCP server from the user's own environment, and
toolsdoes not filter those — its doc scopes it to built-in tools. Probed on one machine, ~100mcp__uxpilot__*tools reached the reviewer, including mutating ones (update_page,publish_design_preview,upload_canvas_asset). SettingmcpServers: {}does not suppress them; the tool list came back identical with and without it. None of them writes the local filesystem, so this issue as reported is closed, but a reviewer holding outward-facing mutation tools is the same defect one layer out. Filing separately.Fix #149: stop consult review lanes writing into the workspace
[Bugfix #149] docs: record CMAP verdicts on PR #187
[Bugfix #149] docs: CMAP ordering note; keep porch state out of the PR
Merge pull request #187 from pseudoseed/builder/bugfix-149
pseudoseed commentedon Aug 29, 2026
Third instance of the same kill mistake, now committed by three different actors, so it is a protocol defect rather than anyone's slip.
The lane process tree is two layers deep, not one:
Kill the wrapper and the worker is reparented to
initand keeps running with full write access to the builder worktree.Occurrences today:
consult74536, verified that pid gone, reported the lane stopped. The SDK child 74556 survived and authored four more commits over 13 minutes, including runningporch done.consultwrapper and its shell; theopencode runworker was orphaned to PID 1 and ran unsupervised in the worktree for 2:14 before being found by a sweep. This happened roughly an hour after the builder recorded the phase 7 lesson in its own state file.That third one is the useful data point: knowing the rule did not prevent it, because "kill the child" is ambiguous when there are two layers. The instruction has to name the shape.
The rule that actually works
What should change in the code
consultshould kill its own descendants on exit — normal exit, error exit, and signal. A lane that outlives its wrapper is the failure mode behind all three incidents, and no amount of operator discipline has prevented it in a single day.A sweep would also help:
afxcould reportopencode runorclaude-agent-sdkprocesses whose ppid is 1 and whose cwd is inside.builders/, since that combination has no legitimate meaning.