fix(server): avoid full history on Codex resume - #6400
Conversation
|
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 |
ApprovabilityVerdict: Needs human review This PR changes session resume behavior by adding You can customize Macroscope's approvability policy. Learn more. |
Summary
excludeTurns: trueoptionWhy
T3 already persists and renders its own projected transcript, so it does not use the historical
thread.turnsreturned by Codex during provider resume. On sufficiently large Codex rollouts, rebuilding and buffering that full JSON-RPC response can starve the local server beforesession/ready; Desktop then reports that/.well-known/t3/environmenttimed out even though port 3773 is still listening.Codex exposes
excludeTurnsspecifically for clients that only need thread metadata and the live resume subscription. T3 already initializes Codex withcapabilities.experimentalApi: true. The generated request binding omits experimental request fields, so this follows the existing raw-request-plus-schema-decode pattern used byturn/startcollaboration mode.Fixes #6399
Related: #5351, #4773, #3601, #6153
Validation
pnpm vp fmt --check apps/server/src/provider/Layers/CodexSessionRuntime.ts apps/server/src/provider/Layers/CodexSessionRuntime.test.tspnpm vp test run apps/server/src/provider/Layers/CodexSessionRuntime.test.ts(21 passed)cd apps/server && pnpm typecheckgit diff --checkThe repository requests Node 24.13.1; these checks ran successfully on Node 26.5.1 with the package manager's engine warning.
Note
Medium Risk
Touches Codex session open/resume on the critical path; behavior is narrower (less data on resume) with fallback preserved, but resume parsing now depends on the experimental wire path.
Overview
Codex thread resume no longer asks the app-server to rebuild and return full historical turns. Resumes go through
client.raw.requestwith experimentalexcludeTurns: true, then the payload is decoded withV2ThreadResumeResponse(same raw-request + schema pattern asturn/start). Freshthread/startand recoverable stale-resume fallback to start are unchanged.Tests add a regression for the resume wire payload (
excludeTurns: true) and adjust mocks so resume failures/success exerciseraw.request; thread open fixtures align with the current v2 thread shape.Reviewed by Cursor Bugbot for commit 5d0bf6c. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Exclude historical turns when resuming a Codex thread
openCodexThreadto useclient.raw.requestforthread/resumeinstead of the typedclient.request, addingexcludeTurns: trueto the resume payload to avoid sending full history.decodeV2ThreadResumeResponseschema decoder, mapping decode failures toCodexAppServerProtocolParseError.thread/startas before.Macroscope summarized 5d0bf6c.