[Bug]: Large Codex resume buffers full turn history and wedges the local backend #6399
Before submitting#
- I searched existing issues and PRs for the same Codex resume path.
- I reproduced the failure and separated it from T3 projection hydration.
Area#
apps/server, Codex provider
Environment#
- T3 Code desktop: 0.0.34.0
- OS: Windows
- Codex CLI: 0.147.0
Summary#
Resuming a sufficiently large Codex thread can make T3's local backend stop answering HTTP even though port 3773 remains listening. The desktop then reports:
Remote environment endpoint http://127.0.0.1:3773/.well-known/t3/environment timed out after 10000ms
The Codex provider sends thread/resume without the app-server's experimental excludeTurns option. The app-server therefore rebuilds and returns the complete historical thread.turns array, while T3's JSON-RPC transport retains the complete response line before parsing it. For a very large rollout, the local backend becomes memory-bound/event-loop-starved before session/ready.
Reproduction and evidence#
- Open a T3 task backed by a large Codex rollout, close it, then resume it after a desktop restart/update.
- The provider log reaches
session/connectingbut never emitssession/ready. - Port 3773 remains listening, but
/.well-known/t3/environmentproduces no response within 10?12 seconds. - In the reproduced case the T3 backend reached approximately 1.8 GB private bytes and accumulated
CLOSE_WAITsockets. - The affected T3 task itself had only 6,287 projected activities and about 2.3 MB of activity payload, ruling out the separate unbounded T3 activity-hydration path for this occurrence.
Current resume code:
client.request("thread/resume", {
threadId: resumeThreadId,
...startParams,
})
Codex documents excludeTurns: true for clients that only need thread metadata and the live resume subscription. T3 already persists and renders its own projected transcript and initializes Codex with capabilities.experimentalApi: true, so the historical provider turn array is unused here.
Expected behavior#
T3 should resume the Codex session without requesting the complete historical turn array, and the local environment endpoint should stay responsive while a large thread is reopened.
Proposed focused fix#
- Send
excludeTurns: trueonthread/resumethrough the raw protocol path because the generated non-experimental request schema omits that experimental field. - Decode the raw response with the existing
V2ThreadResumeResponseschema. - Preserve fresh-start and recoverable stale-resume fallback behavior.
- Add a focused regression test asserting the wire payload.
Related work#
- #5351 and #6153 cover oversized T3 activity hydration, a different layer.
- #4773 demonstrates that an open listener can coexist with environment-endpoint starvation.
- #3601 reports the same unbounded provider-history class for OpenCode.
- pingdotgg/t3code#5147 bounded other replay/snapshot hydration paths but not this Codex resume response.
- OpenAI Codex added
excludeTurnsin openai/codex#19014.
t3dotgg(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
Note
🤖 GPT-5.6 Sol in Codex responding on behalf of Theo
Closing as a duplicate of #7075. Both buffer a large Codex history during resume and exhaust server memory.
Track the remaining work in #7075.