Repository navigation
Agent suggestions
Public previewDescription
Environment
- VS Code:
1.135.0(commit08d4889f9ec4a1685d257b9b95de036c8e1ce1e5), Stable - Remote: WSL2 (Ubuntu 24.04), Windows host
- Claude Agent SDK (
@anthropic-ai/claude-agent-sdk-linux-x64):0.3.220 agentHostextension host running via VS Code's built-in Agent/Chat sessions feature (not a marketplace chat extension)- Model backend: Bedrock-hosted Claude (via
claudeCLI,--permission-mode bypassPermissions)
Summary
When sending consecutive messages into the same agent chat session over a working span of ~30+ minutes, the chat UI eventually stops showing new agent output/status (looks permanently "thinking"/stuck), while the underlying agent turn has actually completed successfully. Inspecting the host process list shows multiple claude CLI processes concurrently resuming the exact same session id, and agentHost.log shows a sendMessage failed ... Canceled: Canceled + truncateChat pair each time this happens.
The only currently-known workaround is a full wsl --shutdown, which kills all other running dev processes in the WSL instance as collateral damage.
Evidence
1. Multiple live processes resuming the same session
At the time of investigation, ps showed 4 separate claude CLI processes all launched with --resume=<same-session-id>, ages ranging from ~13 to ~43 minutes old, all still consuming CPU:
PID 5166 etimes=2586s --resume=<session-A>
PID 8283 etimes=1809s --resume=<session-A> --resume-session-at=<checkpoint>
PID 11108 etimes=764s --resume=<session-A>
PID 11117 etimes=764s --resume=<session-A>
Each of these was still actively producing output (visible via /proc/<pid>/fd open sockets + steady CPU%), i.e. none were hung — they were all independently live and working against the same session transcript.
2. Each new user message spawns a new resume process instead of reusing/cleanly closing the previous one
Every time a new message was sent into the chat while a previous claude resume process for that session was still alive, agentHost.log recorded this pair of lines:
[error] [AgentSideEffects] sendMessage failed for session=ahp-chat://.../<session-A>: code=undefined, message=Canceled: Canceled, type=Canceled Canceled
...
[info] [Claude:<session-A>] truncateChat kept [0..<turn-id>] (anchor=<checkpoint>)
...
[info] [Claude] session <session-A>: resume rebuild agent=(none)
This pattern recurred 4 times across a single chat session (observed at roughly 13, 16, 26, and 43 minutes into the session), each one correlating with a newly spawned claude --resume=<session-A> process that was never torn down — leaving the previous one running in the background, orphaned from the UI.
3. The agent turn actually completes; the UI just never reflects it
Reading the on-disk session transcript (~/.claude/projects/.../<session-A>.jsonl) directly confirmed the most recent assistant message had "stop_reason": "end_turn" and contained a complete, well-formed multi-paragraph response ending in a question to the user — i.e. the agent was not stuck at all, it had finished normally. The chat UI in VS Code, however, continued showing no new content/status, consistent with the UI having subscribed to (or being blocked by) a stale/orphaned process rather than the one that actually produced the final message.
Steps to reproduce (best known)
- Open an agent/Claude chat session in VS Code (Bedrock-backed Claude, WSL2 remote).
- Have a long-running conversation (30+ min) involving multiple tool calls / sub-agent dispatches.
- Periodically send follow-up messages while the agent may still be mid-turn or shortly after a turn completes.
- After several such messages, the chat UI stops updating (looks stuck "thinking"), even though:
ps aux | grep claudeshows multiple processes with identical--resume=<sessionId>still running and consuming CPU.agentHost.logshows asendMessage failed ... Canceled: Canceledimmediately followed by atruncateChat/resume rebuildfor that session id, once per "new" process spawned.
- Confirm via the on-disk
~/.claude/projects/**/<sessionId>.jsonltranscript that the latest assistant message hasstop_reason: end_turnand is a complete response — the turn is not actually hung.
Workaround
wsl --shutdown from Windows forcibly kills all WSL processes (including the orphaned claude resume processes), after which the chat UI reconnects properly on next launch. This also kills unrelated dev servers running in the same WSL instance, which is a heavy-handed workaround for what looks like a chat-session/process-lifecycle bug.
Expected behavior
Sending a new message into an existing agent chat session should not spawn an additional concurrent claude --resume process against the same session id while a previous one is still alive; the previous process should be cleanly terminated/reused, and the UI should always be wired to the currently-live process's output stream so completed turns are reflected without requiring an environment-level restart.
Activity
g27182818 commentedon Sep 30, 2026
Same root cause here, with a different and more destructive symptom: the per-message
resume rebuildkills in-flight background subagents (and anything else the oldclaudeprocess was holding), and the message that triggers the rebuild gets swallowed.Environment
2242ebbb54efeeb0129e08e919e7e8d43033cd83), Remote SSH to Linux (6.5.0-1024-aws)@anthropic-ai/claude-agent-sdk0.3.280 (bundledclaude2.1.280)Repro
Agentwithrun_in_background: truewhose only job issleep 240, then end the turn.status?).Actual
agenthost.loglogsresume rebuildand a newclaude --resume=<id>process starts (pid 556485 → 559155, same session id).sleepreturns "The user doesn't want to take this action right now". The resumed session then reports it asstopped: "didn't finish before the previous session ended".isMeta"Continue from where you left off.", answers it with"No response requested.", and that turn consumes the user's message.status?had to be sent twice.Control: the identical prompt in the terminal CLI (Claude Code 2.1.285, same machine) keeps one process across the follow-up message. The subagent sleeps the full 240 s and reports back.
Suggested fixes:
toolDiffdirty when the effective tool set actually changes, so a no-op re-registration doesn't restart the process;Related: #332073 (subagent registry is in-process and dies with the host), #333174 (Claude harness lacks interrupted-turn detection on restore), and anthropics/claude-code#89265 / #89820 (the injected continuation is always answered "No response requested." and can orphan subsequent messages).