Repository navigation
Description
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/server
Steps to reproduce
- Use a Claude provider thread whose provider session has been released, so the next prompt goes through
resumeTurn. Leaving the thread idle for the 30-minute timeout is one way to get there. - Send a prompt whose turn runs longer than 30 minutes.
- At about 30:00 the Claude Code process exits with code 143, and the run is marked failed.
A /compact turn takes the same path through compactThread.
Expected behavior
A resumed or compacting turn should be marked busy like any other turn. The provider session's idle timer should not release the session while the turn is running.
Actual behavior
The session is released at the idle timeout. The process group receives SIGTERM, Claude exits 143, and the run fails.
Impact
Major degradation or frequent failure: any resumed Claude turn longer than 30 minutes is killed, so long analyses, builds, and batch jobs cannot finish.
Version or commit
T3 Code 0.1.10. The same code is on main at the time of filing.
Environment
Linux x64, T3 Code 0.1.10, claudeAgent provider, Claude Code 2.1.293. Model DeepSeek-V4.1-Flash[1m] through the same Claude Agent SDK path.
Logs or stack traces
Five failed runs in one thread lasted 30.01–30.06 minutes. Across the same database, 142 completed runs had a maximum duration of 24.81 minutes. One failed run started at 2026-11-20T02:49:20.664Z and failed at 2026-11-20T03:19:21.519Z; the provider turn record stayed running until 03:19:21.477Z, and provider events streamed until 03:19:18Z.
Sanitized server log:
[11:19:21.480] WARN: orchestration-v2.claude-query-stream-failed
providerThreadId: 'provider-thread:provider:claudeAgent:native-thread:pending...'
providerTurnId: 'provider-turn:...ordinal:14...'
cause: 'ClaudeAgentSdkQueryRunnerError: Claude Agent SDK query failed.
[cause]: Error: Claude Code process exited with code 143'
The 30:00.855 gap matches DEFAULT_IDLE_TIMEOUT_MS in ProviderSessionManager.ts.
Root cause
ProviderSessionManager.decorateRuntime spreads the adapter runtime and overrides only startTurn. The Claude adapter also exposes resumeTurn and compactThread; both call its internal startTurn. The spread leaves those methods unwrapped, so ProviderTurnStartService and RunExecutionService call them directly. The session never gets markBusy or observeActivity, so busyTurns stays empty. When the idle timer fires, releaseIfStillIdle sees an idle session and releases it.
Relevant paths:
apps/server/src/orchestration-v2/ProviderSessionManager.ts(decorateRuntime,startTurn,releaseIfStillIdle)apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts(resumeTurn,compactThread)apps/server/src/orchestration-v2/ProviderTurnStartService.ts(preferssession.resumeTurnwhen present)
Workaround
No reliable workaround inside T3. Keep a turn under 30 minutes, or run long work through the claude CLI outside T3.
Activity
juliusmarminge commentedon Nov 20, 2026
I tried to reproduce this on the current build and could not.
Commit 59651c1 (origin/main). No live Claude run: the VM has no first-party Claude sign-in and the turn would have to run for 30 minutes. Reproduced instead against the real ProviderSessionManager in apps/server/src/orchestration-v2/ProviderSessionManager.test.ts. The fake runtime gained resumeTurn and compactThread. One case per method opens a session with idleTimeoutMs 1000, calls resumeThread, starts a turn through runtime.resumeTurn or runtime.compactThread, sends no turn.terminal, advances TestClock by 2 s and asserts manager.isLive. Both cases fail on main ('expected false to be true'): the session is released while its turn is still running. The same check through runtime.startTurn passes (I dropped that control case before committing). Command:
vp test run src/orchestration-v2/ProviderSessionManager.test.ts -t "past idle"from apps/server. Code reading: decorateRuntime returns{...runtime, startTurn: <wrapped>}, so resumeTurn and compactThread are the adapter's own functions with no markBusy. RunExecutionService calls session.resumeTurn when input.resume is true and session.compactThread for '/compact'. Likely reason the reporter's runs died 30:00 after the start even though events kept arriving: command_output deltas return before touchActivity in the event pump, so a long command that only streams output never resets the idle timer (not confirmed with a test).Closing as not planned. If it still happens for you, reply with the exact steps and the version you are on and it will be looked at again.
SeasonPilot commentedon Nov 20, 2026
Thanks for testing this against the real manager. That failing case is the bug: on 59651c1 both
resumeTurnandcompactThreadleavebusyTurnsempty becausedecorateRuntimespreads the adapter runtime and only wrapsstartTurn.The live run follows the same path. Exact setup:
claudeAgent, Claude Code 2.1.293.resumeTurn.runninguntil 03:19:21.477Z.Claude Code process exited with code 143.That is a 30:00.855 turn, matching
DEFAULT_IDLE_TIMEOUT_MS. Five failed runs in the same thread were 30.01–30.06 minutes; 142 completed runs maxed at 24.81 minutes.I have a small fix that wraps
resumeTurnandcompactThreadwith the sameobserveActivity/markBusyhandling asstartTurn, plus regression tests for both entry points. The new tests fail on 59651c1 and pass with the fix. Would you reopen this if I send the PR?SeasonPilot commentedon Nov 27, 2026
Reopening isn't available to me as the issue author, so commenting here with a repro on the version that contains #41490.
I am on 0.1.13 (server started 2026-11-27T04:14:39Z), which includes #41490. The 30-minute release still happens, and it is not on the resume/compact path.
Five runs failed at 30.01–30.05 minutes today. All were ordinary startTurn runs: attempt reason
initial,manualContinuationOfRunIdempty, and the message was not/compact.For one of them: requested 2026-11-27T04:18:53.754Z, started 04:18:54.102Z, failed 04:48:55.093Z (30:00.95). The provider turn stayed
runninguntil 04:48:55.055Z, and provider events were still arriving at 04:48:40.116Z — 15 seconds before the kill.The original 0.1.10 run has the same shape: run 14, attempt reason
initial, nomanualContinuationOfRunId, normal prompt (not/compact); started 2026-11-20T02:49:20.664Z, failed 03:19:21.519Z (30:00.855); provider events until 03:19:18.249Z; provider turnrunninguntil 03:19:21.477Z.All of these call
session.startTurn, which was already wrapped withmarkBusybefore #41490. #41490 does not change this path.One correction to the issue's steps: a released provider session does not by itself route the next prompt through
resumeTurn.resumeTurnis used only for a manual continuation (manualContinuationOfRunId, the Resume button) or a pending-context delivery; a normal prompt usesstartTurn.Your
runtime.startTurncontrol test passes, so the wrapper itself marks busy in the test. Could you take another look at whyreleaseIfStillIdlesees no busy turn for a normalstartTurnin the real lifecycle, or what clears the busy key while the provider turn is still running? I can provide more DB rows or sanitized provider logs.