Skip to content

[Bug]: Delegated Antigravity child is finalized and closed mid wake reply after 2 minutes of silence, so the parent gets the pre-wake "Waiting…" text #41529

Closed as not planned

Description

@OscarSwanros

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. From any parent thread, delegate_task to antigravity / gemini-4-neon with a brief that runs a command taking about 90 s (for example sleep 90; echo DONE) through run_command with WaitMsBeforeAsync: 10000, waits for it, and then reports its output.
  2. agy backgrounds the command as task-N. The child replies "Waiting for task-N to finish." and ends its turn. T3 correctly keeps the run open while the command runs.
  3. The command finishes. agy dequeues the wake and opens a model call for it, but nothing new streams for more than 2 minutes. We hit this with a long xhigh reply on a large context. To force it, put a Gemini proxy in front of agy (GOOGLE_GEMINI_BASE_URL) that holds the wake's streamGenerateContent response for 150 s.

Expected behavior

The run stays open while agy has a wake it has dequeued but not yet answered: the transcript ends with the wake's SYSTEM_MESSAGE and has no PLANNER_RESPONSE after it, which readAntigravityPendingReply already detects. The delegated task then reports the reply that comes after the wake. If T3 does give up on a silent reply, it should not report the pre-wake text as the child's finished result.

Actual behavior

Two minutes after agy's last update, T3 finalizes the run as completed. The delegated task completes with the pre-wake "Waiting for task-N to finish." as its result. Then releaseFinishedDelegateSessions sends session/close, and agy handles it with ForceStopCascadeTree (kill_background_tasks=true) and exits, which kills the reply that was still in flight. Nothing resumes the child. The parent has to message it again, and agy then says its background tasks were stopped by a server restart.

On main @ 8634955:

  • packages/provider-acp/src/server/adapter.ts:8824-8852: while replyOpen is true, scheduleDeferredFinalize sleeps ACP_OPEN_REPLY_QUIET_LIMIT (2 minutes) and then finalizes. hasPendingReply is consulted only when replyOpen is false. After its one extension (line 8846), replyOpen is true, so the next expiry finalizes without checking again.
  • apps/server/src/orchestration-v2/Orchestrator.ts:15060-15095: a finished delegate's session is released unless the child has pendingBackgroundTasks. A wake that agy has dequeued but not answered does not count.

Impact

Minor bug or occasional failure

Version or commit

0.1.12-nightly.20261120.5009. The same code is on main @ 8634955.

Environment

macOS 27.2.1 arm64, T3 Code Nightly desktop, agy 1.5.14, gemini-4-neon

Logs or stack traces

# one case, UTC; sources: agy acp-server log, the session's transcript.jsonl, T3 provider event log
02:58:46  run_command backgrounded as task-378
02:58:57  reply: "Waiting for ... (`task-378`) to finish."   # run stays open, correct
03:00:19  task-378 finishes; agy dequeues the wake (SYSTEM_MESSAGE, MESSAGE_PRIORITY_HIGH)
03:00:25  agy opens streamGenerateContent for the wake reply; T3 records reasoning until ~03:00:29
03:02:29  T3 finalizes the run as completed; delegated task result = the 02:58:57 reply
03:02:29  command:system:delegated-task-release:... provider-session.detach
03:02:30  agy: ACP Request received: session/close
03:02:30  agy: ForceStopCascadeTree requested ... Cancel requested for cascade ... (kill_background_tasks=true)
# transcript at close: last line is the task-378 SYSTEM_MESSAGE, with no PLANNER_RESPONSE after it

Workaround

None reliable. The parent has to send the child a message to restart it. Telling the child to wait in the foreground doesn't stick, because agy's design is to end the turn and be woken, and WaitMsBeforeAsync is capped at 10000.

Related

#39989 fixed the 3-second variant, where the wake lands while the previous reply is closing. We hit that one twice on 5009, and nightly 20261121.5038 and later include the fix. This report is the 2-minute path that remains. #40484 covers the same quiet-limit false completion when agy exits, not when it is still running mid reply. #39886 and #39958 are the same session/close kill, for swarm workers. #39820 is the opposite problem: holds that never end.

Activity

  1. juliusmarminge commented on Nov 23, 2026

    @juliusmarminge
    Member

    I tried to reproduce this on the current build and could not.

    Commit: origin/main 856b105.

    Failing test (pushed as factory/repro-41529, commit c49fc3f): vp test run src/orchestration-v2/Adapters/AntigravityAdapterV2.test.ts -t "quiet limit" in apps/server. The new case is "keeps the run open past the quiet limit while a dequeued wake is unanswered". The prompt settles while a WaitMsBeforeAsync=10000 command runs. 80 s later the transcript ends on the wake's SYSTEM_MESSAGE with no PLANNER_RESPONSE after it, the command completes and one agent_thought_chunk streams. Then 150 s of silence. On main the run reaches turn.terminal "completed" at 00:03:20, exactly 2 minutes after the last update (00:01:20), with only the reasoning and no wake reply. The assertion that the later reply "The command printed DONE." belongs to the run fails.

    Live attempt: a server built from source (node apps/server/src/bin.ts serve with T3CODE_DEV_SEED=0, a fresh --base-dir, Antigravity enabled with sign-in method gemini-api-key and GOOGLE_GEMINI_BASE_URL pointed at a local endpoint), agy 1.5.15 from PATH, threads started with t3 thread start --provider antigravity --model gemini-4-neon. Through the hub, Gemini 4 Neon, Gemini 4 Hydrogen and Gemini 3.8 Flash all returned 429 "Individual quota reached", so the local endpoint scripted the model instead. It returned a run_command call (sleep 90; echo $((6*7))XYZQ, WaitMsBeforeAsync 10000), then "Waiting for the background task to finish." On the wake request it held the reply for 150 s: in run 1 with no output, in runs 2-4 after streaming thought chunks first. In run 3 T3 recorded the reasoning live at 16:31:01-03, as in the report. agy backgrounded the command, and its transcript ended on the wake's SYSTEM_MESSAGE with no PLANNER_RESPONSE. In every run T3 kept the run open and it completed with "The command printed 42XYZQ." Not reproduced.

    The reason: on agy 1.5.15 the session/prompt request stays open across the background command and its wake. In run 3 it started at 16:29:30.345Z and resolved at 16:33:34.624Z, after the wake reply. Temporary logging in scheduleDeferredFinalize never fired. So the run is held by the open prompt and never enters the deferred-finalize path. The reporter's agy 1.5.14 returns end_turn after the pre-wake reply, which is the path the failing test exercises.

    Closing as not planned. If it still happens for you, reply with the exact steps and the version you are on and it will be looked at again.

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