claude-code - 💡(How to fix) Fix [BUG] Completed subprocess/subagent work can leave visible task state stuck in_progress; follow-up prompts no-op

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

A Claude Code session can get stuck after long-running subprocess or subagent work completes: the underlying work has finished, but the visible task/todo state remains in_progress / running, and subsequent user prompts cause Claude Code to think briefly and then stop without recovering.

This looks like a broader lifecycle synchronization issue rather than a problem with one specific command or workflow. The common shape is that a subprocess, background task, remote command, or subagent appears to finish, but Claude Code does not reliably reconcile that completion back into the task/todo state that drives the session.

Related issues that seem to describe adjacent symptoms:

  • #44783: parent session deadlocks when subagent tool execution hangs
  • #48312: completed background Bash tasks stay "Running" in Tasks sidebar
  • #55893: background Bash tasks get stuck post-completion/across sessions
  • #58637: zombie "running" background subagents cause stop-hook loops
  • #59900: stale task list / in_progress tasks leak into future context

Error Message

If reconciliation fails, a follow-up prompt should still allow the session to recover by checking task status, clearing stale state, or surfacing a clear error/recovery path.

Root Cause

A Claude Code session can get stuck after long-running subprocess or subagent work completes: the underlying work has finished, but the visible task/todo state remains in_progress / running, and subsequent user prompts cause Claude Code to think briefly and then stop without recovering.

This looks like a broader lifecycle synchronization issue rather than a problem with one specific command or workflow. The common shape is that a subprocess, background task, remote command, or subagent appears to finish, but Claude Code does not reliably reconcile that completion back into the task/todo state that drives the session.

Related issues that seem to describe adjacent symptoms:

  • #44783: parent session deadlocks when subagent tool execution hangs
  • #48312: completed background Bash tasks stay "Running" in Tasks sidebar
  • #55893: background Bash tasks get stuck post-completion/across sessions
  • #58637: zombie "running" background subagents cause stop-hook loops
  • #59900: stale task list / in_progress tasks leak into future context
RAW_BUFFERClick to expand / collapse

Summary

A Claude Code session can get stuck after long-running subprocess or subagent work completes: the underlying work has finished, but the visible task/todo state remains in_progress / running, and subsequent user prompts cause Claude Code to think briefly and then stop without recovering.

This looks like a broader lifecycle synchronization issue rather than a problem with one specific command or workflow. The common shape is that a subprocess, background task, remote command, or subagent appears to finish, but Claude Code does not reliably reconcile that completion back into the task/todo state that drives the session.

Related issues that seem to describe adjacent symptoms:

  • #44783: parent session deadlocks when subagent tool execution hangs
  • #48312: completed background Bash tasks stay "Running" in Tasks sidebar
  • #55893: background Bash tasks get stuck post-completion/across sessions
  • #58637: zombie "running" background subagents cause stop-hook loops
  • #59900: stale task list / in_progress tasks leak into future context

Expected behavior

When subprocess, background, remote, or subagent work reaches a terminal state, Claude Code should reliably reconcile that state into all relevant layers:

  1. process / task runner state,
  2. UI task state,
  3. model-visible task/todo state,
  4. stop-hook or session lifecycle state.

If reconciliation fails, a follow-up prompt should still allow the session to recover by checking task status, clearing stale state, or surfacing a clear error/recovery path.

Actual behavior

The underlying work reached a terminal state, but Claude Code continued to show the related task as in_progress / running.

Follow-up prompts did not recover the session. Claude Code appeared to think briefly and then stopped without running commands, updating todos, marking the task complete, or explaining what stale state was blocking progress.

Generalized evidence pattern

The specific workload is not important here and may contain private project details. The relevant evidence pattern was:

  • The underlying subprocess / remote command / subagent had already reached a terminal state.
  • Completion could be verified independently outside the visible Claude Code task state.
  • Expected output or completion side effects were present.
  • No corresponding live worker process was observed for the completed work.
  • Despite that, Claude Code's visible task/todo state still showed the associated item as in_progress / running.
  • Subsequent prompts did not trigger a reconciliation pass or provide a way to clear the stale state.

This suggests the issue is likely in the completion-event propagation or reconciliation path between task execution, background/subagent lifecycle state, UI state, and model-visible todo/task state.

Why this may be broader than existing reports

Many related issues appear to involve one layer of this same class of problem:

  • stale Tasks sidebar entries,
  • background Bash tasks that cannot be stopped or queried after completion,
  • subagent registry entries that remain marked running,
  • stop hooks that believe completed work is still active,
  • old in_progress task state leaking into later context.

This report is about the cross-layer version: completed work leaves stale visible in_progress task state, and the next user prompt no-ops instead of reconciling or surfacing a recovery path.

Suggested improvements

A robust fix likely needs one or more of:

  1. A single source of truth for task/subprocess/subagent lifecycle state, or explicit reconciliation between the existing registries.
  2. A bounded recovery path when completion events are dropped or arrive out of order.
  3. A session-level reconciliation pass when the user sends a follow-up prompt and visible task state conflicts with process/task-runner state.
  4. A user-accessible way to inspect and dismiss stale in_progress / running entries that no longer correspond to live work.
  5. Clear terminal states such as completed, failed, stale_orphaned, or acknowledged, rather than leaving stale entries permanently in_progress.

Environment

  • Claude Code version observed locally while preparing this report: 2.1.139
  • Affected session version may differ; this issue appears related to reports across multiple recent versions.
  • Platform: observed around long-running subprocess / remote / subagent-style work.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

When subprocess, background, remote, or subagent work reaches a terminal state, Claude Code should reliably reconcile that state into all relevant layers:

  1. process / task runner state,
  2. UI task state,
  3. model-visible task/todo state,
  4. stop-hook or session lifecycle state.

If reconciliation fails, a follow-up prompt should still allow the session to recover by checking task status, clearing stale state, or surfacing a clear error/recovery path.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] Completed subprocess/subagent work can leave visible task state stuck in_progress; follow-up prompts no-op