Repository navigation
[Bug]: Claude /goal shows complete while a background subagent is still running #16611
Description
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
- apps/server
Steps to reproduce
- On a Claude thread (Orchestrator V2), start a background subagent: the Agent tool with
run_in_background: true. - While it is still running, send
/goal <condition>. Mine was a multi-round review/implement loop. - Claude sets the goal ("Goal set: …"), acknowledges it, and ends the turn to wait for the background subagent.
Expected behavior
The goal stays active. Claude Code skips the goal's Stop hook check while a subagent or background shell runs, and checks again on a later turn (https://code.claude.com/docs/en/goal#background-work-defers-evaluation). The goal is still set in Claude.
Actual behavior
The composer goal row shows Goal complete as soon as the turn ends, with only Clear offered. No goal check has run and no work toward the goal has started.
Cause: finalizeActiveTurn in apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts infers completion from a normal turn end plus an empty background-task roster. The roster only holds local_bash work; subagents are deliberately kept off it, so a running background subagent never blocks the inference.
Impact
Minor bug or occasional failure
Version or commit
0.0.46-nightly.20261006.2735 (includes #15592)
Environment
macOS 27.0, T3 Code Nightly desktop, Claude Code 2.1.292, Claude Opus 5.5
Logs or stack traces
Captured with the Claude Agent SDK against Claude Code 2.1.292 (condensed, ms from start):
40592 system/task_started task=a59ddc913b6aade35 type=local_agent is_backgrounded=true
42092 assistant "Waiting for the new subagent's completion notification ..."
42113 result/success terminal_reason=completed <- no Stop hook feedback: check skipped
43282 system/task_notification task=a59ddc913b6aade35 status=completed
43334 system/init (wake turn)
47091 result/success terminal_reason=completed <- no feedback: goal passed
Replaying these frames through the adapter on main marks the goal complete at 42113.
Screenshots, recordings, or supporting files
The composer goal row reads Goal complete while the assistant in the same thread says the background subagent (Opus) is still coding and no review round has started:
Workaround
Ignore the label while background work runs, and don't press Clear: the goal is still active in Claude. Run bare /goal to see Claude's real status.
Fix proposed in #16598.

Activity
juliusmarminge commentedon Oct 6, 2026
Note
Grok responding on behalf of Julius.
Confirmed on current
main: a Claude/goalcan flip to complete when the turn ends while a background subagent is still running.Cause
In
finalizeActiveTurn, an active goal is markedcompletewhen the turn completes withterminal_reasonunset/completed, the adapter thinks a goal check ran, and the native-thread background roster is empty.That roster only admits opaque
local_bashwork (CLAUDE_OPAQUE_BACKGROUND_TASK_KINDS). Background subagents (local_agent) are deliberately kept off it so they are not double-counted with the normal subagent lifecycle — so a running background subagent never keeps the roster non-empty.Separately,
goalCheckedTurnsis set on any root non-synthetic assistant message while a goal is active, not only when Stop-hook feedback actually arrives. Claude Code defers the real Stop-hook check during background work, so the turn can end ascompletedwith no hook feedback — and T3 still infers completion.That matches the reported SDK replay: goal marked complete at the first turn end while the subagent is still running.
Not a duplicate of #16610 (same author): that one is about a background Claude subagent that resumes itself and stays showing Completed.
Fix in flight: open #16598 (
Fixes #16611) — a Claude/goalno longer reads as complete while a background subagent runs.Labeling
bug+via-triage.