Skip to content

fix(server): avoid full history on Codex resume - #6400

Open
nickmatteo wants to merge 1 commit into
pingdotgg:mainfrom
nickmatteo:codex/fix-codex-large-resume
Open

fix(server): avoid full history on Codex resume#6400
nickmatteo wants to merge 1 commit into
pingdotgg:mainfrom
nickmatteo:codex/fix-codex-large-resume

Conversation

@nickmatteo

@nickmatteo nickmatteo commented Aug 12, 2026

Copy link
Copy Markdown

Summary

  • resume Codex threads with the app-server's excludeTurns: true option
  • decode the raw experimental response with the existing typed response schema
  • preserve fresh starts and recoverable stale-resume fallback behavior
  • add a regression test for the exact resume wire payload

Why

T3 already persists and renders its own projected transcript, so it does not use the historical thread.turns returned by Codex during provider resume. On sufficiently large Codex rollouts, rebuilding and buffering that full JSON-RPC response can starve the local server before session/ready; Desktop then reports that /.well-known/t3/environment timed out even though port 3773 is still listening.

Codex exposes excludeTurns specifically for clients that only need thread metadata and the live resume subscription. T3 already initializes Codex with capabilities.experimentalApi: true. The generated request binding omits experimental request fields, so this follows the existing raw-request-plus-schema-decode pattern used by turn/start collaboration 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.ts
  • pnpm vp test run apps/server/src/provider/Layers/CodexSessionRuntime.test.ts (21 passed)
  • cd apps/server && pnpm typecheck
  • git diff --check

The 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.request with experimental excludeTurns: true, then the payload is decoded with V2ThreadResumeResponse (same raw-request + schema pattern as turn/start). Fresh thread/start and 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 exercise raw.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

  • Changes openCodexThread to use client.raw.request for thread/resume instead of the typed client.request, adding excludeTurns: true to the resume payload to avoid sending full history.
  • Decodes the raw resume response via a new decodeV2ThreadResumeResponse schema decoder, mapping decode failures to CodexAppServerProtocolParseError.
  • Recoverable resume failures still fall back to thread/start as before.

Macroscope summarized 5d0bf6c.

@coderabbitai

coderabbitai Bot commented Aug 12, 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: 35572911-180f-4cf7-8c21-9f785fdb99da

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

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.

❤️ Share

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

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Aug 12, 2026
@macroscopeapp

macroscopeapp Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

This PR changes session resume behavior by adding excludeTurns: true, which prevents the backend from returning historical turns. While documented as a performance optimization, it materially affects what data is returned during resume. The author is not the primary maintainer of this file, suggesting additional review is warranted.

You can customize Macroscope's approvability policy. 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:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Large Codex resume buffers full turn history and wedges the local backend

1 participant