Uh oh!
There was an error while loading. Please reload this page.
fix(server): stop Codex threads with queued follow-ups - #5762
Conversation
commented
Aug 9, 2026
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
Uh oh!
There was an error while loading. Please reload this page.
commented
Aug 9, 2026
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
commented
Aug 9, 2026
ApprovabilityVerdict: Approved 84f5321 Straightforward bug fix that preserves the active turn ID when Codex queues a follow-up, ensuring interrupt targets the correct turn. Change is small, self-contained, and includes a comprehensive integration test. You can customize Macroscope's approvability policy. Learn more. |
Codex stop requests failed when a thread had a queued follow-up. T3 replaced the active provider turn ID with the queued turn ID, so Codex rejected the interrupt.
Keep the existing active turn ID until Codex sends turn lifecycle notifications that advance it. The integration test reproduces the observed active and queued turn ordering.
Test:
vp test run apps/server/src/provider/Layers/CodexCollabRuntime.integration.test.tsCreated by GPT-5.6 in T3 Code using the Codex harness.
Note
Medium Risk
Changes turn-tracking used by Stop/interrupt on the Codex provider path; scope is narrow and covered by a new integration test, but incorrect active-turn bookkeeping could still break interrupt behavior.
Overview
Stop on Codex threads failed when a follow-up was queued while the current turn was still running: each
turn/startresponse overwroteactiveTurnIdwith the queued turn id, but Codexturn/interruptonly accepts the currently active turn.sendTurnnow keeps the existingactiveTurnIdwhen Codex returns a queued follow-up (session.activeTurnId ?? turnId); lifecycle handlers (turn/started/turn/completed) still advance or clear it.updateSessionaccepts an updater function so that logic can read the prior session state.Adds an integration test (two
sendTurncalls, theninterruptTurn) and extends the collab mock peer with per-call turn ids, optional suppression of a secondturn/started, and interrupt validation when the wrong turn id is sent.Reviewed by Cursor Bugbot for commit 84f5321. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix
interruptTurnto target the active turn when Codex has a queued follow-upturn/start,session.activeTurnIdwas being overwritten with the new (queued) turn id, causing subsequent interrupts to target the wrong turn.updateSessioncalls in theturn/startflow to a functional form that preserves the existingactiveTurnIdif one is already set.codexCollabMockPeer.mjsto support deterministic turn ids, suppressingturn/startedfor queued turns, and validating interrupt targets.CodexCollabRuntime.integration.test.tsthat reproduces the bug and asserts the interrupt targets the first (active) turn id.📊 Macroscope summarized 84f5321. 2 files reviewed, 0 issues evaluated, 0 issues filtered, 0 comments posted
🗂️ Filtered Issues
No issues evaluated.