Skip to content

[Bug]: Antigravity turns never terminate when a native subagent goes idle without send_message #45094

Done

Description

@muhasaho

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 a thread in T3 Code using the Antigravity provider (antigravity-acp, agy 1.5.19, gemini-4-neon, full-access mode).
  2. In a turn, have the agent spawn a native self subagent via invoke_subagent whose prompt asks it to reply directly without calling send_message.
  3. Wait for the subagent to finish its reply and go idle. Antigravity delivers a wake-up message to the parent's inbox with sender: "system" and content: "Subagent <childId> has gone idle. This was the subagent's most recent response: ...", while leaving the detached subagent alive/idle on disk (not SUBAGENT_STATE_KILLED).
  4. Let the parent agent send its final response and stop calling tools.

Expected behavior

Once the subagent has gone idle and the parent finishes responding, T3 Code should transition the subagent out of running and finalize the turn (clearing the Thinking spinner and active stop button).

Actual behavior

The turn never terminates:

  • The self subagent item stays stuck in status: "running" indefinitely (even though a research subagent in the same turn that called send_message transitioned to idle).
  • The parent run stays status: "running" (completedAt: null), leaving the Thinking indicator and red stop button active in the UI after the assistant's final message is complete.
  • Every subsequent user message is steered into the same stuck run instead of starting a new turn, and the run still cannot finalize after those responses finish.

Root cause (verified on main @ ee43aabaa)

In apps/server/src/provider/acp/AntigravityChildWork.ts:1607-1621, readAntigravityChildrenAtWork determines whether a detached child is done only by checking:

  1. reported.has(childId) — built strictly from message.sender across the parent's inbox (.system_generated/messages/*.json),
  2. swarm killed / parked flags, or
  3. subagent?.state === "SUBAGENT_STATE_KILLED".

When an Antigravity subagent finishes with a normal reply and goes idle (rather than calling send_message), Antigravity writes the parent inbox notification with sender: "system" and puts the child's ID in sourceMetadata.conversationId (and in content):

{
  "id": "<messageId>",
  "recipient": "<rootSessionId>",
  "sender": "system",
  "priority": "MESSAGE_PRIORITY_HIGH",
  "content": "Subagent <childId> has gone idle. This was the subagent's most recent response: ...",
  "sourceMetadata": {
    "conversationId": "<childId>",
    "stepIndex": 1,
    "rootConversationId": "<rootSessionId>",
    "contentKind": "CONTENT_KIND_CONVERSATION"
  }
}

Because message.sender is "system" rather than <childId> and the subagent is idle rather than SUBAGENT_STATE_KILLED, readAntigravityChildrenAtWork continues returning the launching toolCallId as still at work. AcpAdapterV2.idleReportedSubagents therefore leaves the subagent in running, hasDeferredBackgroundWork returns true (with deferFinalizeForBackgroundWork enabled for Antigravity), and followPrompt returns early without calling finalizeTurn.

Suggested fix: In readAntigravityChildrenAtWork, also treat a child as reported/idle when the parent inbox contains a sender: "system" idle notification whose sourceMetadata.conversationId matches childId (respecting message ordering if the child is later woken again via send_message).

Impact

Major degradation or frequent failure

Version or commit

Observed on T3 Code Desktop/Server 0.1.13; verified unfixed on main @ ee43aabaa

Environment

macOS arm64 (Mac mini), T3 Code Beta 0.1.13, Antigravity ACP Server 1.5.19, Model gemini-4-neon (High), full-access mode

Logs or stack traces

# Parent inbox message when a `self` subagent finishes without calling `send_message`:
{"recipient":"<rootSessionId>","sender":"system","priority":"MESSAGE_PRIORITY_HIGH","content":"Subagent <childId> has gone idle. This was the subagent's most recent response: ...","sourceMetadata":{"conversationId":"<childId>","stepIndex":1,"rootConversationId":"<rootSessionId>","contentKind":"CONTENT_KIND_CONVERSATION"}}

# Thread state after parent finished replying (3 consecutive steered follow-ups later):
# - run:ordinal:4 stayed status="running", completedAt=null for ~18 minutes
# - `research` subagent (used send_message, sender=<childId>): status="idle"
# - two `self` subagents (idle notice, sender="system"): status="running"
# - Immediately after running manage_subagents(Action="kill_all") -> state="SUBAGENT_STATE_KILLED",
#   run:ordinal:4 completed cleanly at the end of that turn.

Workaround

Explicitly killing idle Antigravity subagents via manage_subagents(Action="kill_all") sets their on-disk state to SUBAGENT_STATE_KILLED, after which readAntigravityChildrenAtWork clears them and the stuck turn finalizes normally.

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