fix(agents): stop the codex dispatchers paying twice for the same reasoning - #657
Merged
Conversation
…soning The dispatchers redirect Codex to a file, but the read step told them to start at the last 200 lines and widen. A transcript interleaves reasoning with the answer, so that pulls the reasoning in regardless, and the caller pays for it twice: once through Codex, again through the subagent. Codex now writes its own bounded report to a separate file and keeps the findings out of its final message. The subagent reads that file and nothing else. Two capped exceptions remain: the last 50 lines on a non-zero exit or a missing report, and the last 20 lines for a liveness check. codex-analyst moves from -s read-only, which cannot write a report file, to -s workspace-write with writable_roots scoped to the temp directory alone. The repository stays unwritable in practice, and never widening those roots to the repository is now stated rather than left to judgement. Claude-Session: https://claude.ai/code/session_01DsDFRG6NVWb2VBNNtVkQ6N
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.
The dispatcher subagents redirect Codex to a file and never pipe it, but the step that reads the result said:
That instruction cannot be followed. A transcript interleaves the reasoning with the answer, so "read the tail and widen" pulls the reasoning in regardless. The caller is then charged twice for the same thinking: once through Codex, again through the Claude subagent relaying it.
The fix: two files, not one
<slug>-transcript.txt<slug>-report.mdThe brief now tells Codex to write its own bounded report and to keep the findings out of its final message. The subagent reads that file and nothing else.
Two exceptions survive, both capped so neither can grow into reading the run:
Consequence worth reviewing
codex-analystran-s read-only, which cannot write a report file. It now uses-s workspace-writewithsandbox_workspace_write.writable_rootsscoped to the temp directory alone, so Codex can write its report and nothing else. The repository stays unwritable in practice and the prompt still saysREAD-ONLY.That is a wider sandbox than before, so "never widen
writable_rootsto the repository" is now stated explicitly rather than left to judgement.codex-implementerkeeps its git verification step unchanged and still mandatory: the git state is the authority on what landed, while the report is only what Codex believes it did.scripts/check-harness: 1268 passed, 2 xfailed.https://claude.ai/code/session_01DsDFRG6NVWb2VBNNtVkQ6N