# Claude background subagent stays Running in Lineage for hours after its task_notification reports completed · Issue \#18910 · pingdotgg/t3code

[View on GitCafe](https://git.cafe/pingdotgg/t3code/issues/18910)

Repository: [pingdotgg/t3code](https://git.cafe/pingdotgg/t3code)

Visibility: public

State: completed

Priority: 0

## Description

[Discussion and activity](https://git.cafe/pingdotgg/t3code/issues/18910)

---

### What happened

In a Claude thread, a background subagent (launched with `Agent` + `run_in_background`) kept showing as **Running** in the Lineage panel for about 5 hours after it had finished, with its timer still counting. The root agent had already received the subagent's result and worked with it, and Claude Code reported the task as completed. `TaskStop` on it failed with "No task found" and then "is not running (status: completed)", so the user could not clear the row. It cleared only after the root agent sent the subagent a `SendMessage` ("reply with done"): that resume emitted a new `task_started` and `task_notification`, and T3 settled the row then.

The user reports this happens on every T3 Code thread that uses agents.

Lineage panels from two threads: one stuck subagent at 5.5h, and another thread with 19 subagents Running at 4.6h.

<img width="308" height="146" alt="Lineage panel: one subagent stuck Running at 5.5h" src="https://github.com/user-attachments/assets/adf46313-8fa2-4972-a82d-84657e773992" />

<img width="301" height="636" alt="Lineage panel: 19 subagents Running at 4.6h" src="https://github.com/user-attachments/assets/922d3c75-920a-495e-b641-dcbea58bbfcf" />

### Diagnosis

The provider event log for the thread shows the Claude SDK delivered the completion on time. T3 received it, but the subagent stayed `running` in T3 until a later resume of the same task.

Timeline for task `ad1627c7f38089711`. There was one provider session for the whole window (no session replacement), the provider was Claude throughout, and the subagent was top level (`spawn_depth: 1`, `is_backgrounded: true`):

| Time (UTC) | Event |
|---|---|
| 21:34:14 | `task_started`, `tool_use_id` = the `Agent` launch (`toolu_011kw…`) |
| 21:45:01 | root `SendMessage` to the running subagent; the result is "Message queued for delivery … at its next tool round". No `task_started` follows. |
| 22:03:45 | root turn ends (`result`) |
| 22:04:48.983 | `task_updated` `{status: completed}` |
| 22:04:48.986 | `task_notification` `status: completed`, `tool_use_id` = the original launch id |
| 22:04:49 | wake continuation turn starts (`init`); the root receives the result |
| *(5 h)* | T3 Lineage still shows the subagent Running |
| 03:05:53 | root `SendMessage` (`toolu_01BMK…`); `task_started` with that `tool_use_id`, then `task_updated` and `task_notification` completed at 03:05:55; T3 settles the row |

A sibling subagent in the same thread (`aba11457a64a94fc4`) followed the same pattern and settled correctly. It was launched in the same turn, got a mid-run `SendMessage` at 21:45:06, and finished while the root was idle (`task_notification` at 21:57:12, then a wake turn). So neither the queued mid-run `SendMessage` nor finishing while the root was idle explains this on its own. I could not find the projection write for the stuck completion. `orchestration_v2_projection_subagents` now holds only the state from the 03:05 resume (`runId …:ordinal:22`), because the resume overwrote the earlier row.

Relevant code: `apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts`. The diagnosis is against `main` (80664d52); the user runs a nightly, so line references may be approximate.

- `bufferWakeMessage`: wake evidence for subagent notifications while the root is idle.
- The subagent registry update with `isReopen` / `resumeToolUseId` / `runToolUseId`, around L4880–L5060.

### Steps to reproduce

Not reproduced deterministically. The observed sequence was:

1. In a Claude thread, launch 2 or more background subagents (`Agent`, `run_in_background: true`).
2. While they run, have the root `SendMessage` each of them once (the messages are queued, not resumes).
3. Let the root turn end; let each subagent finish while the root is idle.
4. One subagent's row stays Running in the Lineage panel indefinitely, even though `task_notification` `completed` arrived.

### Version

0.0.46-nightly.20261010.2935 (desktop AppImage)

### Environment

NixOS 26.05, Linux 6.18, Node 24.15.0, Claude Code 2.1.281, model claude-opus-5-5

### Evidence

```shell
# provider event log, events.<thread>.log*, lifecycle frames for the stuck task (trimmed)
21:34:14.744Z system/task_started      task_id=ad1627c7f38089711 tool_use_id=toolu_011kw… is_backgrounded=true spawn_depth=1
21:45:01.786Z assistant tool_use SendMessage to=ad1627c7f38089711 (toolu_01Ha6…)
21:45:01.805Z tool_result "Message queued for delivery to ad1627c7f38089711 at its next tool round."
22:03:45.711Z result (root turn end)
22:04:48.983Z system/task_updated      task_id=ad1627c7f38089711 patch={status:"completed"}
22:04:48.986Z system/task_notification task_id=ad1627c7f38089711 tool_use_id=toolu_011kw… status=completed
22:04:49.130Z system/init (wake turn)
03:05:21.733Z tool_use TaskStop -> "No task found with ID: ad1627c7f38089711"
03:05:53.941Z system/task_started      task_id=ad1627c7f38089711 tool_use_id=toolu_01BMK… prompt="Stop now: reply with just \"done\"…"
03:05:55.747Z system/task_notification task_id=ad1627c7f38089711 tool_use_id=toolu_01BMK… status=completed summary="done"

# orchestration_v2_projection_subagents (after the resume)
task%3Aad1627c7f38089711  completed  started 03:05:53.951Z  completed 03:05:55.747Z  runId …:ordinal:22
task%3Aaba11457a64a94fc4  completed  started 21:34:31.148Z  completed 21:57:12.456Z  runId …:ordinal:17
```

### Related issues

#16355 (nested subagent stays Running), #17099 (wake continuation runs on another provider), and #18877 (Running after session replacement) end in the same stale-Running state. This case has none of their triggers: the subagent was not nested, the provider was Claude throughout, and there was no session replacement.

### Fix applied or workaround

None on the server. Workaround: have the root agent `SendMessage` the stuck subagent with "Reply with just done, no tool calls". The resume's own `task_started` and `task_notification` settle the row.

### Filed by

claude (claude-opus-5-5) in Claude Code, following the `t3 triage` playbook (`.github/triage/PLAYBOOK.md`)

---

> [!NOTE]
>
> _This AI-generated response on behalf of @tunnckoCore._
> _**Harness:** ClaudeCode (via T3 Code). **Model:** Claude Opus 5.5_

