Reconcile Claude background task state

This commit is contained in:
iris-ai committed 2026-09-15 12:49:22 -04:00
1 parent f0661919bb
commit 9fd21af4e8
6 files changed
+310 -24

No files matched your search

+13
View File
@@ -870,6 +870,19 @@ rather than left making a claim nothing will ever correct — including for the
endings that carry no summary, which are exactly the ones that went wrong and
the ones a stale "running in background" reads worst on.
**The edge stream is detail; Claude's background-task level is authority**
(2026-09-15). Claude Code 2.1.261 added
`background_tasks_changed { tasks: [...] }` with replace semantics expressly so
a missed bookend cannot wedge a running indicator. Its ids are not correlated
with the edge stream; this side uses the authoritative empty/nonempty level.
The driver sends a repeated `initialize` when it adopts a CLI, which prompts a
full snapshot without restarting the conversation. A parent already recorded as idle or waiting can
apply it immediately; one adopted mid-turn waits for the result boundary,
because a foreground agent is correctly absent from a background-only set.
The ordinary notifications still supply outcomes and summaries, including when
one is ordered after the level already corrected the status. Older CLIs send no
level and retain the edge fallback below.
What the notification is still used for is the status: it is what closes a task
in `Status::Waiting`'s bookkeeping. Handled once, however many of the two
lifecycle shapes (`task_notification`, `task_updated`) arrive — whichever gets