Skip to content

Duplicate claude --resume processes accumulate per-message in Agents window, causing turn to complete but UI to stay stuck on "Processing" #333799

Open

Agent suggestions

Public preview

Description

@danielbender1989

Environment

  • VS Code: 1.135.0 (commit 08d4889f9ec4a1685d257b9b95de036c8e1ce1e5), Stable
  • Remote: WSL2 (Ubuntu 24.04), Windows host
  • Claude Agent SDK (@anthropic-ai/claude-agent-sdk-linux-x64): 0.3.220
  • agentHost extension host running via VS Code's built-in Agent/Chat sessions feature (not a marketplace chat extension)
  • Model backend: Bedrock-hosted Claude (via claude CLI, --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)

  1. Open an agent/Claude chat session in VS Code (Bedrock-backed Claude, WSL2 remote).
  2. Have a long-running conversation (30+ min) involving multiple tool calls / sub-agent dispatches.
  3. Periodically send follow-up messages while the agent may still be mid-turn or shortly after a turn completes.
  4. After several such messages, the chat UI stops updating (looks stuck "thinking"), even though:
    • ps aux | grep claude shows multiple processes with identical --resume=<sessionId> still running and consuming CPU.
    • agentHost.log shows a sendMessage failed ... Canceled: Canceled immediately followed by a truncateChat / resume rebuild for that session id, once per "new" process spawned.
  5. Confirm via the on-disk ~/.claude/projects/**/<sessionId>.jsonl transcript that the latest assistant message has stop_reason: end_turn and 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

  1. g27182818 commented on Sep 30, 2026

    @g27182818

    Same root cause here, with a different and more destructive symptom: the per-message resume rebuild kills in-flight background subagents (and anything else the old claude process was holding), and the message that triggers the rebuild gets swallowed.

    Environment

    • VS Code server 1.139.0 (Stable, commit 2242ebbb54efeeb0129e08e919e7e8d43033cd83), Remote SSH to Linux (6.5.0-1024-aws)
    • Claude harness via the built-in Agent Host, @anthropic-ai/claude-agent-sdk 0.3.280 (bundled claude 2.1.280)
    • Model: Opus 5.5

    Repro

    1. In a Claude agent-host chat, ask it to launch one Agent with run_in_background: true whose only job is sleep 240, then end the turn.
    2. Within the 4 minutes, send any message (status?).

    Actual

    • agenthost.log logs resume rebuild and a new claude --resume=<id> process starts (pid 556485 → 559155, same session id).
    • The subagent's in-flight sleep returns "The user doesn't want to take this action right now". The resumed session then reports it as stopped: "didn't finish before the previous session ended".
    • The resumed CLI injects an 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.
    • Scheduled wakeups created before the rebuild never fire either.
    19:53:49.017 [Claude:c11a9bdf-…] result for sdkUuid=request_3a5d…        <- turn ends, subagent sleeping
    19:54:19.359 [Claude] session c11a9bdf-…: resume rebuild agent=(none)    <- 1st "status?"
    19:54:21.847 [Claude:c11a9bdf-…] result for sdkUuid=request_c887…        <- 2 s turn: "No response requested."
    19:54:28.805 [Claude] session c11a9bdf-…: resume rebuild agent=(none)    <- 2nd "status?", new pid
    

    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:

    • (a) only mark toolDiff dirty when the effective tool set actually changes, so a no-op re-registration doesn't restart the process;
    • (b) when a restart is genuinely needed and the live query owns running background tasks, defer the rebuild until they settle, or refuse with a visible notice, rather than killing them;
    • (c) the replacement process shouldn't consume the triggering user message on the synthetic "Continue from where you left off." turn.

    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).

    Image Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions