Skip to content
Source
Sign inSign up
pingdotgg/t3code

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

Closedyashranaway(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/8629/headopened View on GitHub

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](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, 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.
    1. 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.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    3. 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).
    4. juliusmarminge closed this

    5. 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.