Skip to content

Antigravity native subagent killed via manage_subagents stays stuck in running and blocks turn finalization #39513

Closed

Description

@casperghost227

What happened

When an Antigravity parent agent spawns native detached subagents via invoke_subagent and terminates a stalled subagent via manage_subagents(Action: "kill" | "kill_all") before that subagent ever sends a message back to the parent, the killed subagent remains stuck in status: "running" in the T3 Code thread timeline UI.

Because the subagent remains running, the parent thread's run also never finalizes (status: "running", completedAt: null), even after manage_subagents(Action: "list") reports zero active subagents and multiple subsequent session/prompt turns complete.

Diagnosis

In apps/server/src/orchestration-v2/Adapters/AntigravityAdapterV2.ts (lines 246–250, 308–313), Antigravity sets deferFinalizeForBackgroundWork: true, subagentsIdleOnTurnCompletion: true, and subagentsOutlivingPrompt → readAntigravityChildrenAtWork.

At turn settlement (packages/provider-acp/src/server/adapter.ts, idleReportedSubagents at lines 4233–4264, invoked at lines 5624, 9072, and 9447), a running subagent is only transitioned out of running if its launching tool call ID is absent from readAntigravityChildrenAtWork. While any subagent remains running, hasDeferredBackgroundWork (lines 4220–4229) returns true, preventing finalizeTurn from running.

However, readAntigravityChildrenAtWork in apps/server/src/provider/acp/AntigravityChildWork.ts (lines 652–686) only checks whether each child has sent a message into the parent's inbox (antigravity-acp/brain/<rootSessionId>/.system_generated/messages/):

const reported = new Set(
  (await readInbox(profileRoot, input.rootSessionId)).map((message) => message.sender),
);
const atWork: Array<string> = [];
for (const childId of childIds) {
  if (reported.has(childId)) continue;
  for (const message of await readInbox(profileRoot, childId)) {
    const launch = detachedLaunchCall(message, input.rootSessionId);
    if (launch !== undefined && input.toolCallIds.includes(launch.id)) {
      atWork.push(launch.id);
    }
  }
}

It never reads the child metadata file at antigravity-acp/brain/<rootSessionId>/.system_generated/subagents/<childId>.json (and decodeDetachedSubagent at lines 519–530 does not decode the state field). When Antigravity 1.5.13 kills a subagent via manage_subagents, it writes "state": "SUBAGENT_STATE_KILLED" to subagents/<childId>.json, without sending a message to the parent inbox. As a result:

  • Subagents that sent a message to the parent before being killed (reported.has(childId) === true) transition cleanly to idle.
  • Any subagent killed before sending a message stays permanently in atWork, so idleReportedSubagents never settles it and hasDeferredBackgroundWork permanently blocks finalizeTurn on the parent run.

Checking state in subagents/<childId>.json inside readAntigravityChildrenAtWork (treating SUBAGENT_STATE_KILLED and any other non-running terminal states as no longer at work — and optionally distinguishing killed/cancelled vs idle) would resolve both the stuck subagent timeline item and the stuck parent run.

Steps to reproduce

  1. Start a thread in T3 Code using the Antigravity provider (agy 1.5.13).
  2. Have the parent agent spawn a native subagent via invoke_subagent.
  3. Before that subagent sends a message back to the parent's inbox, have the parent terminate it with manage_subagents(Action: "kill", ...) or manage_subagents(Action: "kill_all").
  4. Let the parent finish its turn (session/prompt succeeds).
  5. Observe that the killed subagent's timeline item remains stuck at status: "running" and the parent run never completes (subsequent turns keep running readAntigravityChildrenAtWork and never finalize the run).

Version

0.1.11-nightly.20261119.4954

Environment

Windows 11 (win32 x64 10.0.26300), T3 Code Desktop 0.1.11-nightly.20261119.4954, Node v24.22.1, Antigravity CLI (agy.exe) 1.5.13, model Gemini 4 Neon

Evidence

# On-disk Antigravity subagent metadata under:
# <stateDir>/providers/antigravity/<profile>/antigravity-acp/brain/<rootSessionId>/.system_generated/subagents/

--- 0a591388-d9d9-439d-a2a0-90932fd25b39.json (killed before reporting to parent inbox) ---
{"conversationId":"0a591388-d9d9-439d-a2a0-90932fd25b39", "subagentDescriptor":{"typeName":"research", "role":"Server and Website Reviewer"}, "state":"SUBAGENT_STATE_KILLED", "spawnStepIndex":11, "workspaceUris":["file:///<workspace>"]}

--- 76beeaa7-cd4a-4c72-9d61-9d71ed5c36a1.json (reported to parent inbox at 02:39:58Z, then killed) ---
{"conversationId":"76beeaa7-cd4a-4c72-9d61-9d71ed5c36a1", "subagentDescriptor":{"typeName":"research", "role":"Repo and Consistency Auditor"}, "state":"SUBAGENT_STATE_KILLED", "spawnStepIndex":11, "workspaceUris":["file:///<workspace>"]}

--- 9d86569f-a56c-4d8a-84e5-c33bc0f04d03.json (reported to parent inbox at 02:43:34Z, then killed) ---
{"conversationId":"9d86569f-a56c-4d8a-84e5-c33bc0f04d03", "subagentDescriptor":{"typeName":"research", "role":"Android App Reviewer"}, "state":"SUBAGENT_STATE_KILLED", "spawnStepIndex":11, "workspaceUris":["file:///<workspace>"]}

# Parent inbox messages/ contained senders 76beeaa7-... and 9d86569f-..., but never 0a591388-...

# statev2.sqlite (orchestration_v2_projection_subagents & orchestration_v2_projection_runs):
subagent call_2855009787698256757 ("Repo and Consistency Auditor"): status='idle', completed_at='2026-11-20T02:40:06.915Z'
subagent call_2855009787698254724 ("Android App Reviewer"):         status='idle', completed_at='2026-11-20T02:43:36.250Z'
subagent call_2855009787698256787 ("Server and Website Reviewer"):  status='running', completed_at=null, updated_at='2026-11-20T02:31:56.386Z'
manage_subagents(Action: 'kill_all'): completed at 2026-11-20T02:43:37.781Z
run ordinal:1: status='running', completed_at=null (despite 7 succeeded session/prompt requests through 2026-11-20T03:44:12.766Z)

# server.trace.ndjson.* continued running readAntigravityChildrenAtWork on every subsequent prompt/usage_update:
{"name":"readAntigravityChildrenAtWork","start":"2026-11-20T02:43:36.245Z","durationMs":3.4361}
{"name":"readAntigravityChildrenAtWork","start":"2026-11-20T02:43:47.743Z","durationMs":3.6398}
{"name":"readAntigravityChildrenAtWork","start":"2026-11-20T03:07:12.600Z","durationMs":4.5675}
{"name":"readAntigravityChildrenAtWork","start":"2026-11-20T03:40:32.143Z","durationMs":4.7123}

Related issues

Fix applied or workaround

Clicking Stop (interrupting the run) on the affected thread forces finalizeTurn(..., "interrupted"), which clears the stuck running state on both the subagent item and the thread run.

Filed by

Antigravity (Gemini 4 Neon) via t3 triage

Activity

  1. added a commit that references this issue on Nov 20, 2026
    5204fe0
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

    via-triageFiled through npx t3 triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions