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
- On nightly
0.1.12-nightly.20261123.5138(Windows desktop app), open a Claude (claudeAgent) thread with a large context, so that compacting takes longer than 2 minutes or close to it. I saw this at about 130k and about 420k tokens. - Send
/compact. - Wait.
Expected behavior
The session stays alive until the compaction finishes, and the thread continues from the compacted context.
Actual behavior
About 120 s after /compact is sent, ProviderSessionManager.releaseIfStillIdle closes the Claude session while the compaction is still running. The compaction is lost or never recorded. It looks like the 2-minute idle release from #41174 doesn't count a running /compact as activity, even though Claude Code keeps sending system/status: compacting every 30 s.
This build is the first with #41174. On the previous build, 20261123.5124, the same thread was released after exactly 30 minutes idle (07:24:47 → 07:54:47 UTC). On 5138, idle releases happen at 2 minutes. Before the update, every manual compaction on this machine finished in 32 to 105 s, so none of them reached a 2-minute limit.
All times below are UTC.
Case 1: about 420k tokens of context
- 13:05:11.808:
/compactsent.system/status: compactingat 13:05:11, 13:05:41 and 13:06:11. - 13:07:11.853:
ProviderSessionManager.releaseIfStillIdle→closeScopeWithin→ClaudeAdapterV2.interruptTurn→query.close(13:07:11.860). That is 120.0 s after/compact. - The turn fails with "The provider event stream closed unexpectedly. Retry the turn; if it keeps failing, check the provider and server logs."
- No
compact_boundarywas written to the session transcript. The next turn started with 423,790 input tokens, so the compaction was lost. The thread itself kept working.
Case 2: about 131k tokens of context, which leaves the thread unusable
- 11:36:59.019:
/compactsent.system/status: compactingat 11:36:59, 11:37:29 and 11:37:59. - 11:37:59.702: Claude Code writes the
compact_boundaryto the session transcript (durationMs60664, with a preserved segment). T3's provider event log records nocompact_boundaryorresultframe for it. - 11:38:59.060:
query.close, 120.0 s after/compact. The provider turn is recorded asinterrupted. (The server trace for this minute has already rotated out, so I can't confirm it wasreleaseIfStillIdlehere as well, but the timing is the same.) - 11:39:55: I sent
/compactagain. This one completed at 11:40:40 (45 s, small context). - 11:40:57: T3 sets the provider thread's
nativeConversationHeadRefto2a9a1da3-…. That is the final assistant message of the second-to-last completed turn (10:25:55). The last completed turn,a7a4f28f-…(11:36:18), was skipped, even though it is in the first compaction's preserved segment.2a9a1da3-…is not on the chain Claude Code loads after either boundary. - From then on, every send fails within about 1 s with "The provider could not start this turn. Retry the turn; if it keeps failing, check the provider setup and server logs." This happened for 6 runs in a row, and the thread could not be recovered from the UI.
Related:
- perf(server): idle agent sessions free their memory after 2 minutes #41174 introduced the 2-minute idle release. Its description says a running turn keeps the session alive, but a
/compactrun apparently doesn't. - [Bug]: Reverting past a Claude compaction breaks the thread: every send fails with "No message found with message.uuid" #17423 reports the same "No message found with message.uuid" after the resume point lands before a compaction boundary, but there the trigger is a revert. Here no revert happened.
- [Bug]: Claude request and compaction phases can remain stuck indefinitely #24842 is the opposite problem: compaction phases that never end.
Impact
Major degradation or frequent failure
Version or commit
0.1.12-nightly.20261123.5138 (desktop). Not seen on 0.1.12-nightly.20261123.5124, which still released idle sessions after 30 minutes.
Environment
Windows 11, T3 Code desktop app, Claude Code CLI 2.1.330, claude-opus-5-5 (effort high, 1M context window).
Logs or stack traces
# Case 1: provider event log (stream_event frames omitted)
13:05:11.808Z outgoing prompt.offer /compact
13:05:11.852Z incoming system/status compacting
13:05:41.880Z incoming system/status compacting
13:06:11.880Z incoming system/status compacting
13:07:11.860Z outgoing query.close # 120.0 s after /compact
# Case 1: server trace at the close
13:07:11.853Z ProviderSessionManager.releaseIfStillIdle
13:07:11.858Z ProviderSessionManager.closeScopeWithin
13:07:11.863Z ClaudeAdapterV2.interruptTurn # parent: RunExecutionService.startRootRun of the /compact run (13:05:11.727Z)
13:07:11.866Z RunExecutionService.interruptLostToolCalls
# Case 2: provider event log
11:36:59.019Z outgoing prompt.offer /compact
11:36:59.043Z incoming system/status compacting
11:37:29.050Z incoming system/status compacting
11:37:59.051Z incoming system/status compacting
# (transcript: compact_boundary written at 11:37:59.702Z, never seen by T3)
11:38:59.060Z outgoing query.close # 120.0 s after /compact
# Case 2: every later turn
ProviderAdapterTurnStartError (driver claudeAgent)
cause: ProviderAdapterProtocolError: Claude provider query ended before the turn could start.
cause: ClaudeAgentSdkQueryRunnerError: Claude Code returned an error result:
No message found with message.uuid of: 2a9a1da3-e21d-43c6-bd34-e32f8147565aWorkaround
Don't /compact long Claude threads on this build. If a compaction is cut off as in case 1, the thread stays usable at its old size. If a thread ends up as in case 2, start a new thread and carry the context over by hand.
Activity
juliusmarminge commentedon Nov 23, 2026
I tried to reproduce this on the current build and could not.
Commit d1a6c35 (origin/main). A live Claude /compact could not be run: no VM has first-party Claude sign-in. Instead I reproduced it against the real ProviderSessionManager in apps/server/src/orchestration-v2/ProviderSessionManager.test.ts. The fake runtime gained compactThread. The new test 'keeps a session alive past idle while /compact runs' opens a session with idleTimeoutMs 1000, starts a /compact turn through runtime.compactThread with no turn.terminal, advances TestClock 2 s and asserts manager.isLive. It fails on main ('expected false to be true'): the session is released while the compaction is still running. As a control, the same test calling runtime.startTurn passes. Command, from apps/server:
vp test run src/orchestration-v2/ProviderSessionManager.test.ts -t "while /compact". This matches the reporter's trace, where releaseIfStillIdle closes the session 120.0 s after /compact (the 2-minute native-resume idle timeout from #41174). The Claude adapter emits activity for only the first 'system/status: compacting' while a compaction runs (ClaudeAdapterV2.ts ~11526), so later status frames do not push the timer back.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.
Fussely commentedon Nov 23, 2026
Thanks for looking into this! I think the closing verdict may be a mix-up: the comment describes reproducing the bug rather than failing to. The new test "keeps a session alive past idle while /compact runs" fails on main (the session is released while the compaction is still running), while the
startTurncontrol passes. It also points to the cause: the Claude adapter only emits activity for the firstsystem/status: compactingframe (ClaudeAdapterV2.tsaround line 11526), so later status frames don't push the idle timer back.It still happens on
0.1.12-nightly.20261123.5138with the steps in the report: a/compacton a Claude thread large enough that compaction takes over 2 minutes. Could this be reopened?