Skip to content

fix(server): avoid loading Codex history on resume - #8629

Open
yashranaway wants to merge 1 commit into
pingdotgg:mainfrom
yashranaway:codex-resume-exclude-turns
Open

fix(server): avoid loading Codex history on resume#8629
yashranaway wants to merge 1 commit into
pingdotgg:mainfrom
yashranaway:codex-resume-exclude-turns

Conversation

@yashranaway

@yashranaway yashranaway commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

What 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.ts passes, 65/65
  • vp run typecheck passes in packages/effect-codex-app-server
  • vp run typecheck passes in apps/server; it emits existing Effect suggestions outside the changed lines
  • vp lint on changed files passes; it emits five existing no-inline-schema-compile warnings in schema.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 for commit 46c75df. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Set excludeTurns: true in thread/resume requests to skip loading Codex history

  • When resuming a Codex thread, openCodexThread now sends excludeTurns: true in the thread/resume payload, requesting metadata-only resume without populating thread.turns.
  • Patches the generated schema in generate.ts via an ExperimentalTopLevelSchemaProperties map so V2ThreadResumeParams includes the new optional excludeTurns?: boolean field.
  • Updates tests to assert the first thread/resume request carries excludeTurns: true and that the schema encoder preserves it.
  • Behavioral Change: thread/resume responses will no longer include turn history; any consumer relying on populated thread.turns after resume must now fetch turns separately.

Macroscope summarized 46c75df.

@coderabbitai

coderabbitai Bot commented Aug 29, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: eca689c1-dda1-4d50-8ff8-92bced2edd7f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Aug 29, 2026
@macroscopeapp

macroscopeapp Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Codex thread resume can exhaust server heap on large histories

1 participant