Skip to content

[Bug]: Antigravity native subagents stay stuck as running in Lineage after completion/kill during active or steered turns #44083

Done

Description

@aleksesipenko

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

  1. Start an Antigravity (antigravity-acp, agy 1.5.18) thread in T3 Code (Windows 11 x64, full-access mode).
  2. During a long-running parent turn (one that remains active across multiple tool calls / delegated tasks / context compaction / steers via steersWithPrompt), have the parent spawn several native subagents via invoke_subagent (e.g. Subagents A–F over several hours).
  3. Let Subagents A–E finish and report back via send_message (delivering messages to the parent inbox), and explicitly terminate them via manage_subagents(Action="kill") (which updates their on-disk metadata to "state": "SUBAGENT_STATE_KILLED").
  4. Continue working in the same active/steered turn (e.g. sending follow-up steers or receiving completions from other delegated tasks that steer the parent turn) while only 1 subagent (Subagent F) remains genuinely alive.
  5. Call manage_subagents(Action="list") and compare its output against T3 Code's Lineage panel and orchestration_v2_projection_subagents.

Expected behavior

Once a native Antigravity subagent reports back to the parent inbox or is explicitly killed via manage_subagents(Action="kill" | "kill_all"), T3 Code should reconcile its status promptly so it transitions out of running and stops ticking in the Lineage panel — even while the parent turn remains active or is repeatedly steered.

Actual behavior

Killed and already-reported native Antigravity subagents remain permanently stuck in status: "running" (completed_at: null) in orchestration_v2_projection_subagents and in the Lineage panel, with their elapsed timers continuously ticking (1.5h, 3.4h, 6.7h, etc.):

  • In a live session, manage_subagents(Action="list") reported 1 active subagent, while T3 Code's Lineage panel simultaneously showed Lineage · 6 running — including 5 subagents that had already reported back to the parent inbox and been explicitly killed via manage_subagents(Action="kill") (both before and after conversation context compaction).
  • On disk under antigravity-acp/brain/<rootSessionId>/.system_generated/subagents/<childId>.json, all 5 killed subagents already have "state": "SUBAGENT_STATE_KILLED" and have messages in the parent's inbox. None of them are running or consuming CPU/tokens inside Antigravity.

Root cause (verified on main @ 3fcfcaee2)

PR #39519 (fixing #39513) already updated readAntigravityChildrenAtWork in apps/server/src/provider/acp/AntigravityChildWork.ts to exclude children whose metadata has state === "SUBAGENT_STATE_KILLED" or that have already reported to the parent inbox. Running readAntigravityChildrenAtWork's exact logic against the affected session's on-disk files correctly returns only the 1 genuinely active child (excluding all 5 killed subagents).

The bug is that idleReportedSubagents(context) in packages/provider-acp/src/server/adapter.ts is never invoked during an active or repeatedly steered Antigravity turn. Across the entire adapter, idleReportedSubagents is only called in three places:

  1. handleSessionUpdate on usage_update (packages/provider-acp/src/server/adapter.ts:6746-6749) — gated by context.promptSettled:

    if (update.sessionUpdate === "usage_update") {
      context.replyOpen = false;
      if (context.promptSettled) yield* idleReportedSubagents(context);
      yield* rearmDeferredFinalize(context);
    }

    While a session/prompt is in flight (or after steerWithPrompt resets context.promptSettled = false at line 10970), context.promptSettled is false, so every usage_update skips idleReportedSubagents(context).

  2. followPrompt on session/prompt resolution (packages/provider-acp/src/server/adapter.ts:10288, 10370) — skipped when superseded() is true:

    if (context.finalized || followsAgentWorkState || superseded()) return;
    ...
    yield* idleReportedSubagents(context);

    Because Antigravity uses steersWithPrompt: antigravitySteersWithPrompt (AntigravityAdapterV2.ts:271), each steer increments context.promptSequence (adapter.ts:10206-10207) and resets context.promptSettled = false (adapter.ts:10970) before the prior session/prompt finishes resolving (~10–50 ms later in server traces). Every superseded session/prompt therefore exits at line 10288 without ever calling idleReportedSubagents(context).

  3. Continuation run wakeBuffer drain (packages/provider-acp/src/server/adapter.ts:10787) — only runs after a turn actually finalizes and a new continuation run starts.

Additionally, completing a manage_subagents (Action: "kill" / "kill_all") tool call via tool_call_update never triggers idleReportedSubagents(context).

As a compounding side effect, because those killed/reported subagents remain "running" in context.subagents, promptInactivityPaused (adapter.ts:9864-9866) and hasDeferredBackgroundWork (adapter.ts:5311-5315) continue treating them as active background work until a session/prompt finally resolves without being superseded.

Suggested fix direction

Run idleReportedSubagents(context) (when flavor.subagentsOutlivingPrompt !== undefined and context.subagents has active entries) at one or more mid-turn boundaries rather than exclusively when context.promptSettled === true on an unsuperseded prompt return, for example:

  • On usage_update in handleSessionUpdate (adapter.ts:6748) even when !context.promptSettled (possibly throttled/gated on having active subagents), and/or
  • When a manage_subagents tool call completes via tool_call_update, and/or
  • Inside steerWithPrompt (or before early-returning on superseded() in followPrompt).

Relation to existing issues / PRs

Impact

Major degradation or frequent failure

Version or commit

Observed on T3 Code server 0.1.12 (Desktop 0.0.24); root cause verified unfixed on main @ 3fcfcaee2 (2026-11-27)

Environment

Windows 11 x64 (10.0.26200), T3 Code Server 0.1.12 / Desktop 0.0.24, Provider: Antigravity ACP (agy 1.5.18), Model: gemini-4-neon, Runtime mode: full-access

Logs or stack traces

# Live state observed in the same thread during an active/steered Antigravity turn:
# 1. Antigravity manage_subagents(Action="list") -> 1 active subagent
# 2. T3 Code Lineage panel -> "Lineage · 6 running" (timers at 1.5h, 3.4h, 6.7h, etc.)
# 3. On-disk Antigravity state for those 6 subagents:
#    - 5 subagents: state = "SUBAGENT_STATE_KILLED", reportedInParentInbox = true
#    - 1 subagent:  state = "SUBAGENT_STATE_ALIVE" (the genuinely active one)
# 4. Server traces (server.trace.ndjson) across 38 consecutive AcpAdapterV2.steerTurn spans
#    on this thread show 0 AcpAdapterV2.idleReportedSubagents spans executed: each prior
#    session/prompt resolves 8–50 ms after the next steerWithPrompt increments promptSequence
#    and resets promptSettled = false, hitting the early `if (... || superseded()) return;`
#    at packages/provider-acp/src/server/adapter.ts:10288.

Screenshots, recordings, or supporting files

No response

Workaround

Letting the parent turn finish completely without any further steers (or stopping the parent turn) forces finalization and clears the stuck running subagents.

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

Metadata

Metadata

Assignees

No one assigned

    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