You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
2-minute idle release (#41174) makes the first turn after a pause take 20-60s for long-context Codex sessions #42123
I searched existing issues and did not find a duplicate.
I included enough detail to reproduce or investigate the problem.
Area
apps/desktop
Steps to reproduce
Use a long-context Codex thread (for example ~320K cached tokens, gpt-6.2-sol).
Complete a turn normally.
Wait more than 2 minutes without sending another message (for example ~6.5 minutes).
Send the next message.
Observe the UI showing "Resuming Codex session", and a much higher time-to-first-token than when sending within 2 minutes.
Expected behavior
The idle-release timeout should be configurable (in settings, or per provider), or native-resume providers should keep a longer default (for example 30 minutes), or the session should stay warm while the user is typing in the input box / the thread is visible. At minimum, the resume cost for long-context Codex sessions should be assessed more accurately than the roughly 1-second estimate.
Actual behavior
Starting in 0.1.12-nightly.20261123.5138 (#41174, merged 2026-11-23), providers that use native resume (Codex / Claude / Cursor / OpenCode) are released after 2 minutes of idle. The next turn then shows "Resuming Codex session" and the first token is very slow.
The PR estimated the restart cost at about 1 second. Measured on a long-context Codex thread (~320K cached tokens, gpt-6.2-sol):
Consecutive messages: TTFT 1.7–2.3s.
After a ~6.5 minute pause (18:50:59 → 18:57:27): TTFT ≈24s, while cached tokens were still 326K. This is not a cache miss; it is cold-start of app-server + thread/resume overhead.
Earlier observations: 44–67s.
Writing a detailed prompt often takes more than 2 minutes, so almost every carefully written prompt hits this delay.
Related: #41474, #41490, and #41700 are side effects of the same change. #41928 only added the hint copy.
Impact
Major degradation or frequent failure
Version or commit
0.1.12-nightly.20261123.5165
Environment
Windows desktop, Codex provider
Logs or stack traces
Screenshots, recordings, or supporting files
No response
Workaround
Sending the next message within 2 minutes avoids the delay, but that is impractical when writing a detailed prompt, which often takes longer than 2 minutes.
Hit this too, on 0.1.12-nightly.20261125.5222, with Claude.
My setup makes the cost easier to see than usual. T3 runs Claude inside a Docker container through a small wrapper, and the container only lives as long as that wrapper does. So when the 2-minute idle release kicks in, the whole container is removed. If I reply within 2 minutes, I get the same container and the same claude process back. If I take longer (it was 90+ minutes for me), a brand-new container starts with --resume. That's well beyond the "about a second" estimate in #41174.
I get why the default is short: idle sessions do hold memory. I'd just like a way to tune it. layerWithOptions already takes idleTimeoutMs, so reading something like T3CODE_PROVIDER_IDLE_TIMEOUT_MINUTES in the default layer would be around 15 lines. Keeping the thread I currently have open warm for longer would also work for me.
Happy to put up a PR if that's something you'd take.
Update from my side: I started a fresh thread and the very long first-token delay seems to be gone. I'm not sure whether it was related to context length. That old thread had been auto-compacted many times, and today it started timing out completely (stream disconnected before completion), to the point where I couldn't continue the conversation at all, so I switched to a new thread.
The cold-start cost is still there, though. The difference is very noticeable:
If I send the next message within 2 minutes, the reply comes back quickly with almost no work time.
After the idle release (a cold start), I wait anywhere from 3 to 10 seconds before the first token.
I have fast mode enabled, but it doesn't make up for the cold-start overhead. The experience just isn't smooth anymore.
+1 to @barakcoh-gong's suggestion. A configurable idle timeout (env var or setting), or keeping the currently open thread warm longer, would solve this for me.
🤖 Claude Opus 5.5 (Claude Code, via T3 Code triage) responding on behalf of Elliot
Same on Claude, Windows desktop, 0.1.12-nightly.20261124.5204. Still present in v0.1.13-nightly.20261125.5245: DEFAULT_IDLE_TIMEOUT_MS is still 2 * 60 * 1000.
From the provider event log for one ordinary Claude thread over about 3 hours today:
83 sends started the Claude CLI 19 times. Each query.close came exactly 120s after the previous turn's result, and the next send did a fresh query.open with SessionStart:resume.
query.open to Claude's system/init usually took 0.2–1s, which matches the PR's estimate. Once it took 9.4s.
+1 to making the idle timeout configurable (a setting, or an env var read in the default layer, since idleTimeoutMs is already plumbed through layerWithOptions). Writing a careful prompt regularly takes longer than 2 minutes, so the release hits the turns where you'd least want extra latency.
Same with Claude on Linux desktop, on the v0.1.12 release (beta AppImage, Fedora 44, Claude Code 2.1.332). main still has DEFAULT_IDLE_TIMEOUT_MS = 2 * 60 * 1000.
Until the app updated to 0.1.12 today, a follow-up in a thread went straight to Thinking. Now any send after a pause of more than 2 minutes shows "Starting Claude" and then "Connecting to Claude".
From server.trace.ndjson, 20 minutes of ordinary use today:
ProviderSessionManager.releaseIfStillIdle ran 6 times in 13 minutes across my open threads.
Every send after a release ran ClaudeAdapterV2.openSession and started a new claude --resume process.
Session opened (CET)
Process start and resume
"Connecting to Claude" shown
17:45:08
3.7 s
0.9 s
17:48:44
1.8 s
2.0 s
17:54:28
1.8 s
1.7 s
18:01:02
5.6 s
28.0 s
The second column is the time from openSession to the connecting phase, so it is the cost the idle release adds. It is 2 to 6 seconds here, not the "about a second" estimated in #41174.
The third column is the wait for the first API response. That wait is model latency and existed before, but it is now labelled as a connection step on every send after a pause. In the 28-second case the provider event log has no events at all during the wait. It reads as a connection problem when it is not one.
+1 to a configurable idle timeout, or to keeping the visible thread's session alive for longer.
Written by Claude Fable 5.2 (Claude Code, via t3 triage) and reviewed by the reporter before posting.
🤖 Gemini 4 Neon responding on behalf of justcarlson
Seeing the same cold-start friction on v0.1.12-nightly.20261123.5151 across Linux and macOS hosts with Claude and Codex: DEFAULT_IDLE_TIMEOUT_MS (2 min) forces a cold CLI respawn after short reading/review pauses.
Suggestion (judgment, not tested): derive the idle timeout in ProviderSessionManager.idleTimeoutFor from the existing BackgroundActivity profile rather than keeping a fixed 2-minute constant or adding a separate setting:
🤖 Claude Opus 5.5 (Claude Code, via T3 Code triage) responding on behalf of the reporter
Same with Claude on Linux desktop (Omarchy), 0.1.13-nightly.20261125.5258, Claude Code 2.1.332. Before #41174 a follow-up went straight to Thinking. Now any send after a pause of more than 2 minutes shows "Connecting to Claude Code" for several seconds.
Timings
From server.trace.ndjson and the provider event log over about 3 hours in one long-running thread:
Time to first token
Warm send, same thread
~1.6 s (turn start 40 to 130 ms)
Send after idle release, same thread
7.3 to 9.0 s (5 cold starts: 7.6, 9.0, 7.3, 7.7, 8.4 s)
Cold start on a brand-new thread
~1.1 to 1.2 s
Every ProviderSessionManager.releaseIfStillIdle fired exactly 120 s after the previous turn ended.
Why the cold start can take far longer than 1 second
Most of the delay comes from resuming a large transcript in a fresh CLI process. It is not a prompt cache miss. Cold turns read about 123k cached tokens and write about 150, the same as warm turns.
The slow thread's Claude transcript (~/.claude/projects/.../<session>.jsonl) is 152 MB. About 118 MB of it is 224 screenshots, stored as base64 images in tool results. I reproduced the cold start outside T3 with claude -p --resume <session> --fork-session --debug-file ... and got 7.2 s to the first token:
+0 to 1.9 s: the CLI loads the transcript before sending anything.
+1.9 s: [API REQUEST] /v1/messages is logged.
+2.0 to 5.2 s: the CLI logs nothing for 3.2 s, so the process looks busy locally with the image-heavy request.
+6.5 s: Stream started - received first chunk.
A fresh claude -p with no history gets its first token in about 1.1 s. Neither the claude.ai MCP connectors nor CLI boot (~50 ms) contributes: the connectors connect asynchronously and never block the first request.
So the restart cost grows with transcript size, and screenshot-heavy threads are the worst case. That explains the spread in this issue, from about 1 s on short threads to 20 s or more on long ones. The "about a second" estimate in #41174 only holds for short threads.
+1 to a longer or configurable timeout, or one tied to the background activity profile. A 10 to 30 minute default for native-resume providers would cover the common case of writing a careful prompt or reading a long reply.
I can confirm on main that the 2-minute idle timeout is wired only for native-resume providers (DEFAULT_IDLE_TIMEOUT_MS in ProviderSessionManager.ts) and that layer() has no settings/config override. Is the 2-minute release a hard memory trade-off from #41174, or would you accept a longer default for native-resume providers and/or a configurable timeout? I don't want to undo #41174 without your call.
Same with Claude on Linux desktop (AppImage, CachyOS), 0.1.13-nightly.20261125.5258, Claude Code 2.1.332, claude-fable-5-2.
From the provider event log for one long thread today, 23 of 34 sends came after an idle release. Each query.close came 120 s after the previous result. Time from prompt.offer to the first message_start:
Send
Cached tokens read
Time to first response
Warm (process reused)
any
1.0–1.7 s
After idle release
~68k
1.4 s
After idle release
111k–138k
21–31 s
After idle release
167k–234k
29–35 s
After idle release
290k–297k
68–74 s
query.open to system/init was 0.1–0.2 s every time, so process start is not the cost.
It is not a cache miss: cold sends read the full cached prefix and wrote under 5k new tokens, the same as warm sends.
The whole wait sits between status: requesting and message_start, with no events in between. The UI shows "Connecting to Claude" for all of it.
The session transcript is 36 MB.
A send within 2 minutes on the same 290k context takes about 1.5 s; one after 2 minutes takes over a minute. +1 to a longer or configurable timeout for native-resume providers.
Written by Claude Fable 5.2 (Claude Code, via t3 triage) and reviewed by the reporter before posting.
Written by Claude (Claude Code, via T3 Code) at my request, from data collected on my machine.
Same with Claude on macOS desktop, T3 Code 0.1.12 (beta), macOS 26.7.1, Claude Code 2.1.332. Any send after a pause of more than 2 minutes shows "Starting Claude" for 6–8 s, then "Connecting to Claude", before anything else happens.
Timeline from one thread
From logs/provider/events.<thread>.log and server.trace.ndjson:
11:54:35.412Z: query.close, 120.08 s after the result, with no user action in between.
Next send: a new claude process is spawned with --resume=<session>, then query.open with "resume".
The three sends before that, all within 2 minutes of each other, reused the same process and started immediately.
Why the restart is far more than ~1 s here
A respawn reruns everything the CLI does at startup, so its cost depends on the user's Claude Code setup and not only on T3:
SessionStart hooks run again on every resume. In this setup they add about 2.4 s, and a single plugin hook that shells out to gcloud accounts for 1.5 s of that.
Every user-scope MCP server reconnects. There were 16 stdio servers here, several of them going through an authenticating proxy, plus the claude.ai connectors and 14 plugins.
It costs functionality as well as latency. On the first turn after a release, most MCP servers are still "connecting", so their tools are missing when the model starts the turn and only show up partway through it.
I trimmed the setup, which cut the claude.ai connectors from ~50 to 4, but the floor is still several seconds. Since a carefully written follow-up regularly takes more than 2 minutes, nearly every such follow-up pays this cost.
Ask
Any of these would fix it for us:
A longer default for native-resume providers. The 30 min used for non-native-resume providers would do, as would the ~10 min "balanced" profile suggested above.
Keep the session warm while the thread is open or focused, or while the composer has a draft.
Same on Claude and OpenCode (v0.1.13, Linux, NFS home, HTTP proxy, 8 vCPU):
DEFAULT_IDLE_TIMEOUT_MS = 2 * 60 * 1000 (ProviderSessionManager.ts) applies to every driver with supportsNativeResume: true, including Claude and OpenCode.
Claude: after release, the next turn re-spawns the CLI, re-registers the t3-code MCP server and resumes history. We saw 20-60s of "Starting Claude" / "Starting Claude MCP servers", with orchestration.dispatchCommand held for more than 15s.
OpenCode: releasing the last session also lets OPENCODE_SERVER_IDLE_TTL (30s) stop the shared opencode serve. A cold opencode run measured 6.2s (4.8s CPU) before any model call. Every delegated task after a pause pays it again.
Workaround: patching the bundled constant to 1 hour (12e4 to 36e5) made follow-up turns immediate for both drivers.
Request: make the idle release configurable (setting or env var such as T3CODE_PROVIDER_IDLE_TIMEOUT_MS), or keep sessions warm while their thread is open in a client.
Seeing this with Claude too, not only long-context Codex sessions. On 0.1.14-nightly.20261128.5413 (macOS, M1 Pro), over 75 minutes with a handful of threads in use:
Earlier in the evening, single turn starts reached 9.7–10.2 s, almost all of it in ProviderInstallationGate.execute → ClaudeAgentSdkQueryRunner.open (6.5–7.5 s), plus discoverClaudeSkills at 0.6–2.6 s. Coming back to any thread after a short break costs this, so agents feel slow even on a machine with spare CPU and memory. A configurable idle timeout, or keeping the most recently used sessions warm, would help.
Checked on main (452355a): production wires ProviderSessionManager.layer = layerWithOptions() with no options, so idleTimeoutMs cannot be set from settings, env, or t3.json. Only the test harness passes it.
Request: expose idleTimeoutMs as a setting (global or per provider), so users who trade memory for latency can choose a longer window.
Activity
barakcoh-gong commentedon Nov 25, 2026
Hit this too, on
0.1.12-nightly.20261125.5222, with Claude.My setup makes the cost easier to see than usual. T3 runs Claude inside a Docker container through a small wrapper, and the container only lives as long as that wrapper does. So when the 2-minute idle release kicks in, the whole container is removed. If I reply within 2 minutes, I get the same container and the same
claudeprocess back. If I take longer (it was 90+ minutes for me), a brand-new container starts with--resume. That's well beyond the "about a second" estimate in #41174.I get why the default is short: idle sessions do hold memory. I'd just like a way to tune it.
layerWithOptionsalready takesidleTimeoutMs, so reading something likeT3CODE_PROVIDER_IDLE_TIMEOUT_MINUTESin the defaultlayerwould be around 15 lines. Keeping the thread I currently have open warm for longer would also work for me.Happy to put up a PR if that's something you'd take.
zhedream commentedon Nov 25, 2026
Update from my side: I started a fresh thread and the very long first-token delay seems to be gone. I'm not sure whether it was related to context length. That old thread had been auto-compacted many times, and today it started timing out completely (
stream disconnected before completion), to the point where I couldn't continue the conversation at all, so I switched to a new thread.The cold-start cost is still there, though. The difference is very noticeable:
I have fast mode enabled, but it doesn't make up for the cold-start overhead. The experience just isn't smooth anymore.
+1 to @barakcoh-gong's suggestion. A configurable idle timeout (env var or setting), or keeping the currently open thread warm longer, would solve this for me.
ElliotDrel commentedon Nov 25, 2026
Note
🤖 Claude Opus 5.5 (Claude Code, via T3 Code triage) responding on behalf of Elliot
Same on Claude, Windows desktop,
0.1.12-nightly.20261124.5204. Still present inv0.1.13-nightly.20261125.5245:DEFAULT_IDLE_TIMEOUT_MSis still2 * 60 * 1000.From the provider event log for one ordinary Claude thread over about 3 hours today:
query.closecame exactly 120s after the previous turn'sresult, and the next send did a freshquery.openwithSessionStart:resume.query.opento Claude'ssystem/initusually took 0.2–1s, which matches the PR's estimate. Once it took 9.4s.+1 to making the idle timeout configurable (a setting, or an env var read in the default
layer, sinceidleTimeoutMsis already plumbed throughlayerWithOptions). Writing a careful prompt regularly takes longer than 2 minutes, so the release hits the turns where you'd least want extra latency.nielsmaerten commentedon Nov 25, 2026
Same with Claude on Linux desktop, on the
v0.1.12release (beta AppImage, Fedora 44, Claude Code 2.1.332).mainstill hasDEFAULT_IDLE_TIMEOUT_MS = 2 * 60 * 1000.Until the app updated to 0.1.12 today, a follow-up in a thread went straight to Thinking. Now any send after a pause of more than 2 minutes shows "Starting Claude" and then "Connecting to Claude".
From
server.trace.ndjson, 20 minutes of ordinary use today:ProviderSessionManager.releaseIfStillIdleran 6 times in 13 minutes across my open threads.ClaudeAdapterV2.openSessionand started a newclaude --resumeprocess.The second column is the time from
openSessionto theconnectingphase, so it is the cost the idle release adds. It is 2 to 6 seconds here, not the "about a second" estimated in #41174.The third column is the wait for the first API response. That wait is model latency and existed before, but it is now labelled as a connection step on every send after a pause. In the 28-second case the provider event log has no events at all during the wait. It reads as a connection problem when it is not one.
+1 to a configurable idle timeout, or to keeping the visible thread's session alive for longer.
Written by Claude Fable 5.2 (Claude Code, via
t3 triage) and reviewed by the reporter before posting.justcarlson commentedon Nov 25, 2026
Note
🤖 Gemini 4 Neon responding on behalf of justcarlson
Seeing the same cold-start friction on
v0.1.12-nightly.20261123.5151across Linux and macOS hosts with Claude and Codex:DEFAULT_IDLE_TIMEOUT_MS(2 min) forces a cold CLI respawn after short reading/review pauses.Suggestion (judgment, not tested): derive the idle timeout in
ProviderSessionManager.idleTimeoutForfrom the existingBackgroundActivityprofile rather than keeping a fixed 2-minute constant or adding a separate setting:performance: 30 min (pre-perf(server): idle agent sessions free their memory after 2 minutes #41174 behavior)balanced(default): ~10 minbattery-saver: 2 minDominik-O22 commentedon Nov 25, 2026
Note
🤖 Claude Opus 5.5 (Claude Code, via T3 Code triage) responding on behalf of the reporter
Same with Claude on Linux desktop (Omarchy),
0.1.13-nightly.20261125.5258, Claude Code 2.1.332. Before #41174 a follow-up went straight to Thinking. Now any send after a pause of more than 2 minutes shows "Connecting to Claude Code" for several seconds.Timings
From
server.trace.ndjsonand the provider event log over about 3 hours in one long-running thread:Every
ProviderSessionManager.releaseIfStillIdlefired exactly 120 s after the previous turn ended.Why the cold start can take far longer than 1 second
Most of the delay comes from resuming a large transcript in a fresh CLI process. It is not a prompt cache miss. Cold turns read about 123k cached tokens and write about 150, the same as warm turns.
The slow thread's Claude transcript (
~/.claude/projects/.../<session>.jsonl) is 152 MB. About 118 MB of it is 224 screenshots, stored as base64 images in tool results. I reproduced the cold start outside T3 withclaude -p --resume <session> --fork-session --debug-file ...and got 7.2 s to the first token:[API REQUEST] /v1/messagesis logged.Stream started - received first chunk.A fresh
claude -pwith no history gets its first token in about 1.1 s. Neither the claude.ai MCP connectors nor CLI boot (~50 ms) contributes: the connectors connect asynchronously and never block the first request.So the restart cost grows with transcript size, and screenshot-heavy threads are the worst case. That explains the spread in this issue, from about 1 s on short threads to 20 s or more on long ones. The "about a second" estimate in #41174 only holds for short threads.
+1 to a longer or configurable timeout, or one tied to the background activity profile. A 10 to 30 minute default for native-resume providers would cover the common case of writing a careful prompt or reading a long reply.
TuanNancy commentedon Nov 26, 2026
I can confirm on main that the 2-minute idle timeout is wired only for native-resume providers (DEFAULT_IDLE_TIMEOUT_MS in ProviderSessionManager.ts) and that layer() has no settings/config override. Is the 2-minute release a hard memory trade-off from #41174, or would you accept a longer default for native-resume providers and/or a configurable timeout? I don't want to undo #41174 without your call.
Grant07 commentedon Nov 26, 2026
Same with Claude on Linux desktop (AppImage, CachyOS),
0.1.13-nightly.20261125.5258, Claude Code 2.1.332,claude-fable-5-2.From the provider event log for one long thread today, 23 of 34 sends came after an idle release. Each
query.closecame 120 s after the previousresult. Time fromprompt.offerto the firstmessage_start:query.opentosystem/initwas 0.1–0.2 s every time, so process start is not the cost.status: requestingandmessage_start, with no events in between. The UI shows "Connecting to Claude" for all of it.A send within 2 minutes on the same 290k context takes about 1.5 s; one after 2 minutes takes over a minute. +1 to a longer or configurable timeout for native-resume providers.
Written by Claude Fable 5.2 (Claude Code, via
t3 triage) and reviewed by the reporter before posting.xe-leon commentedon Nov 27, 2026
Note
Written by Claude (Claude Code, via T3 Code) at my request, from data collected on my machine.
Same with Claude on macOS desktop, T3 Code
0.1.12(beta), macOS 26.7.1, Claude Code 2.1.332. Any send after a pause of more than 2 minutes shows "Starting Claude" for 6–8 s, then "Connecting to Claude", before anything else happens.Timeline from one thread
From
logs/provider/events.<thread>.logandserver.trace.ndjson:11:52:35.333Z:resultfor the turn (end_turn).11:54:35.409Z:ProviderSessionManager.releaseIfStillIdlefires.11:54:35.412Z:query.close, 120.08 s after theresult, with no user action in between.claudeprocess is spawned with--resume=<session>, thenquery.openwith"resume".The three sends before that, all within 2 minutes of each other, reused the same process and started immediately.
Why the restart is far more than ~1 s here
A respawn reruns everything the CLI does at startup, so its cost depends on the user's Claude Code setup and not only on T3:
gcloudaccounts for 1.5 s of that.I trimmed the setup, which cut the claude.ai connectors from ~50 to 4, but the floor is still several seconds. Since a carefully written follow-up regularly takes more than 2 minutes, nearly every such follow-up pays this cost.
Ask
Any of these would fix it for us:
nappeheimer commentedon Nov 28, 2026
Same on Claude and OpenCode (v0.1.13, Linux, NFS home, HTTP proxy, 8 vCPU):
DEFAULT_IDLE_TIMEOUT_MS = 2 * 60 * 1000(ProviderSessionManager.ts) applies to every driver withsupportsNativeResume: true, including Claude and OpenCode.t3-codeMCP server and resumes history. We saw 20-60s of "Starting Claude" / "Starting Claude MCP servers", withorchestration.dispatchCommandheld for more than 15s.OPENCODE_SERVER_IDLE_TTL(30s) stop the sharedopencode serve. A coldopencode runmeasured 6.2s (4.8s CPU) before any model call. Every delegated task after a pause pays it again.Workaround: patching the bundled constant to 1 hour (
12e4to36e5) made follow-up turns immediate for both drivers.Request: make the idle release configurable (setting or env var such as
T3CODE_PROVIDER_IDLE_TIMEOUT_MS), or keep sessions warm while their thread is open in a client.ahrsn commentedon Nov 29, 2026
Seeing this with Claude too, not only long-context Codex sessions. On
0.1.14-nightly.20261128.5413(macOS, M1 Pro), over 75 minutes with a handful of threads in use:Earlier in the evening, single turn starts reached 9.7–10.2 s, almost all of it in
ProviderInstallationGate.execute→ClaudeAgentSdkQueryRunner.open(6.5–7.5 s), plusdiscoverClaudeSkillsat 0.6–2.6 s. Coming back to any thread after a short break costs this, so agents feel slow even on a machine with spare CPU and memory. A configurable idle timeout, or keeping the most recently used sessions warm, would help.hrncz commentedon Nov 30, 2026
Same with Claude on macOS desktop, T3 Code 0.1.13 (beta). From the server trace over 30 minutes of normal use:
ClaudeAgentSdkQueryRunner.opentook 5.3 to 7.5 s (15 cold opens). Before perf(server): idle agent sessions free their memory after 2 minutes #41174 these threads stayed warm for 30 minutes.main(452355a): production wiresProviderSessionManager.layer=layerWithOptions()with no options, soidleTimeoutMscannot be set from settings, env, ort3.json. Only the test harness passes it.Request: expose
idleTimeoutMsas a setting (global or per provider), so users who trade memory for latency can choose a longer window.