fix(server): avoid loading Codex history on resume #8629
main fromrefs/pull/8629/head·opened View on GitHubWhat Changed#
Codex thread resume requests now send excludeTurns: true, so app-server returns thread metadata without reconstructing and serializing the complete turn history.
The generated protocol binding now includes the experimental excludeTurns field that the pinned Codex schema omits. T3 already negotiates the experimental API. Focused tests cover both the encoded request and the runtime resume payload.
Why#
T3 only reads the resumed thread id, working directory, and model. Loading every historical turn wastes memory and can exhaust the server heap on large, image-heavy Codex rollouts. Reporters reproduced the crash with histories between 673 MiB and roughly 1 GiB.
Fixes #7075
Testing#
vp test run packages/effect-codex-app-server/src apps/server/src/provider/Layers/CodexSessionRuntime.test.tspasses, 65/65vp run typecheckpasses inpackages/effect-codex-app-servervp run typecheckpasses inapps/server; it emits existing Effect suggestions outside the changed linesvp linton changed files passes; it emits five existingno-inline-schema-compilewarnings inschema.test.ts
Checklist#
- This PR is small and focused
- I explained what changed and why
- I included before/after screenshots for any UI changes
- I included a video for animation/interaction changes
Model: GPT-5.6 Sol Harness: Codex in T3 Code
Note
Medium Risk Changes Codex session resume on a hot path; behavior is narrower (metadata-only) but aligns with what the server already consumes and is covered by runtime and schema tests.
Overview
Codex session open now resumes with excludeTurns: true, so thread/resume returns thread metadata without serializing full turn history. Recoverable resume failures still fall back to thread/start; tests assert the resume payload includes excludeTurns plus the existing cwd/model/sandbox fields.
The effect-codex-app-server generator patches the pinned protocol schema to expose the experimental excludeTurns field on V2ThreadResumeParams, with generated types and an encode test so the flag is typed on the wire.
This targets server heap exhaustion when large Codex rollouts (hundreds of MiB to ~1 GiB of history) were loaded even though resume only needs the thread id and basic session fields.
Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 46c75dfee5b55c9b5dd2928d4f34dd1adc5264f7. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).Note
Set excludeTurns: true in thread/resume requests to skip loading Codex history#
- When resuming a Codex thread,
openCodexThreadnow sendsexcludeTurns: truein thethread/resumepayload, requesting metadata-only resume without populatingthread.turns. - Patches the generated schema in generate.ts via an
ExperimentalTopLevelSchemaPropertiesmap soV2ThreadResumeParamsincludes the new optionalexcludeTurns?: booleanfield. - Updates tests to assert the first
thread/resumerequest carriesexcludeTurns: trueand that the schema encoder preserves it. - Behavioral Change:
thread/resumeresponses will no longer include turn history; any consumer relying on populatedthread.turnsafter resume must now fetch turns separately.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
Approvability#
Verdict: Not approved
Macroscope's review found this PR not approvable — This focused fix changes every resumed Codex session to request metadata-only history loading, altering the product's default resume behavior. Although the change is small and tested, its unconditional default behavior change warrants human review.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).juliusmarminge closed this
Closing as part of the open-PR backlog sweep (wave 2).
Reason: Codex resume excludeTurns already on main. Related: #10421
Reopen if this is still wanted and you’re willing to rebase onto current
main.
Sign in to join this conversation.
Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
eca689c1-dda1-4d50-8ff8-92bced2edd7fYou can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
Comment `@coderabbitai help` to get the list of available commands.