Repository navigation
fix(codex): decide the store and the Kiro guard from the read made now - #2782
Conversation
A Chat poll's earlier process read could choose a store another Codex started since does not use, or miss a Kiro wrapper the pane runs now. The Codex seen now must write to the store an earlier read chose (the caller's or the lookup's own), agent.get's own process read decides the Kiro guard and serves the rollout binding, and a failed read there shows no conversation. Fixes #2774.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 14 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
…the queued-question reader's store Review of #2782: reusing agent.get's read when herdr gave no process facts hid a nested Codex the next read proves; the queued-question reader chose its store without the check.
|
Review round on 41a29af: the omo review was CLEAR. A Codex (Terra) adversarial review reproduced four MEDIUMs; one was introduced by this PR, and three also happen on main. Fixed in the next commit:
Left out, both on main and both in
|
|
Merge note: merged on the omo review (CLEAR at this head), Codex Terra (no HIGH; reproduced findings fixed, the rest in the PR comments or follow-up issues) and green required checks (Integration and browser passed). Jobs still shown as in progress or queued were stuck by GitHub's Actions incident (steps already succeeded) or are non-required macOS jobs waiting for runners. For contract changes, review findings and resolutions are in the PR comments. |
Fixes #2774.
#2764 lets a Chat command poll hand its own
pane.process_inforead to the Codex transcript lookup. The pane can change between that read and the lookup, and two decisions still rested on the earlier read. A review of this branch found two more cases of the same kind, which also exist on main; they are fixed here too.What was wrong
CODEX_HOME.placedstayed true, so nothing checked B against store A, and a screen match could show A's conversation in B's pane, and bind it there.codexAgentInfoskipped the nested guard, which allowed the weaker short-exchange match.paneCodexHomePlacedmakes its own read beforeopenRolloutsmakes the next, so the same swap applied to every caller.Change (
server/codex.ts,server/conversation.ts)codexTranscriptPathtakeshomeFromEarlierRead.resolveTranscriptsets it whenever a Codex process placed the store (placed && !codexHome). The first Codex of the fresh read must then write to that store (processCodexHome ?? defaultCodexHome(), the rulepaneCodexHomePlacedplaces by), or the lookup returns null and the terminal stands in.codexAgentInforeads the pane's processes itself again, after agent.get, and never takes the caller's read. It returns that read asprocessRead, andopenRolloutsreuses it, so the Kiro guard and the rollout binding rest on the same fresh read. A Codex command poll still makes 2pane.process_infocalls, as the test from fix(outcome): reuse the poll's process read in Codex, omp and gjc lookups #2764 pins.codexTranscriptPathreturns null. An answer that came back without process facts is asked again, as on main.server/prompt.tschecks the store the same way (paneCodexHomePlaced, thenhomeFromEarlierRead).codexOpenRolloutand the other callers that pass nothing behave as before, apart from the store check in 3.Not changed: a Codex with no
CODEX_HOMEwhose ownHOMEdiffers from the server's still counts as writing to the default store. Telling them apart means readingHOMEinprocessCodexHome, which every caller uses. The same review also noted a LOW: theagent_not_foundfallback makes 3 process reads per poll. Neither is in this PR.Tests (
server/codex-processes.test.ts)Five new tests use the file's fake herdr socket. The two store tests use real
sleepprocesses with their ownCODEX_HOME. Each test fails without its part of the fix (the promise resolves to the other store's rollout):failedReadsto fail a chosen process readValidation
bun run check fastat the final head: passed (unit: 11184 pass, 0 fail, 44 skip). At 41a29af: passed (unit: 11183 pass, 0 fail, 44 skip; typecheck, build and generated files ok).bun test server/codex-processes.test.ts server/outcome.test.ts server/conversation.test.ts server/codex.test.ts server/dsh-http.test.ts: 551 pass, 0 fail, 3 runs in a row. One earlier run had a single failure that did not come back.bun run check full.