Skip to content

[Bug]: Antigravity turns stay stuck in "running" for 30 minutes after final reply when an earlier backgrounded run_command is left running #43970

Backlog

Description

@xiaokening

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 using the Antigravity ACP provider (gemini-4-carbon or gemini-4-neon).
  2. Give a multi-step prompt where the agent invokes run_command without IsDaemon: true on a slow command that exceeds WaitMsBeforeAsync and backgrounds (e.g. a recursive glob/scan over a large directory, or a watcher started without IsDaemon: true).
  3. Rather than waiting on that backgrounded command, the agent works around it in subsequent steps, writes deliverables, emits its final user-facing summary, and finishes its turn (session/prompt resolves with end_turn, context.promptSettled = true) without calling manage_task(kill) on the abandoned command.
  4. Observe the thread status in the sidebar, the active Stop button, and follow-up prompt behavior.

Expected behavior

Once session/prompt settles (end_turn) after the agent has moved past the backgrounded command and emitted a complete final assistant reply, the run should finalize promptly (relying on enablePostSettleContinuation: true -> ProviderContinuationService "Background task completed." if the background task ever finishes later) or show a non-blocking background indicator without locking the primary run in running for 30 minutes.

Actual behavior

Even though the native Antigravity session has finished (PLANNER_RESPONSE DONE, tools = [], session/prompt settled) and the full final assistant reply is rendered:

  1. hasDeferredBackgroundWork(context) returns true (packages/provider-acp/src/server/adapter.ts:5246-5250) because antigravityToolOutlivesPrompt (apps/server/src/provider/acp/AntigravityProtocol.ts:66-77) treats every non-IsDaemon execute tool call still in "running" as blocking turn finalization.
  2. AntigravityAdapterV2 (apps/server/src/orchestration-v2/Adapters/AntigravityAdapterV2.ts:254-264) sets deferFinalizeForBackgroundWork: true + postSettleCommandHold: { timeout: "30 minutes", isCommand: antigravityCommandOutlivesPrompt }.
  3. schedulePostSettleHoldExpiry (packages/provider-acp/src/server/adapter.ts:9778-9808) keeps the settled turn locked in status = "running" for at least 30 minutes after context.lastProgressAt.
  4. Follow-up user prompts cannot start a normal next turn until the user manually clicks Stop.

Impact

Major degradation or frequent failure

Version or commit

0.1.12 & main (verified on 0.1.13 / main)

Environment

macOS & Linux (t3 serve v0.1.12), Antigravity ACP 1.5.14 (gemini-4-carbon / gemini-4-neon)

Logs or stack traces

Relevant code paths on `main`:
- `apps/server/src/orchestration-v2/Adapters/AntigravityAdapterV2.ts:254-264` (`enablePostSettleContinuation: true`, `deferFinalizeForBackgroundWork: true`, `postSettleCommandHold: 30 minutes`)
- `packages/provider-acp/src/server/adapter.ts:5244-5257`: `L5256-5257` skips `context.backgroundCommands` (`// Commands are as often a dev server as a wait; only their wake follows up`), yet `L5246-5250` right above it still returns `true` for any `"running"` `execute` tool via `flavor.toolOutlivesPrompt(tool)`, forcing a 30-minute hold via `schedulePostSettleHoldExpiry` (`L9778-9808`, `L10326-10350`) even though `enablePostSettleContinuation: true` is already active.

Screenshots, recordings, or supporting files

No response

Workaround

Manually click the red Stop button after confirming the final assistant reply has finished rendering (or kill the orphaned background child process).

Activity

  1. added
    bug
    needs-triage
    on Nov 27, 2026
  2. WangHunter commented on Dec 2, 2026

    @WangHunter

    I hit the same visible behavior on Windows 10 (build 19045) with T3 Code Nightly and Antigravity. An early repository search stayed open while the agent completed the work and reported the push. Follow-up messages were handled inside the same run. The search was terminated at 15:53:51 local time, and the original run reached completed at 15:54:04. I couldn't determine what made the search stall.

    I also reproduced the post-settle hold in an adapter regression test against main at f12298a646: a non-daemon command remains in_progress, a later tool finishes, the agent sends a final reply, and session/prompt returns end_turn. The test still sees no turn.terminal after advancing the test clock one minute.

    A local patch releases the earlier running command when a successful end_turn follows a later completed tool and a reply, unless the command was explicitly marked awaited. It uses the existing detached-command path, keeps the ACP session eligible for idle pinning while the command is still running, and preserves an eventual completion wake. The regression test passes with the patch, including a separate case where explicit waiting keeps the run open. The Antigravity and shared ACP adapter suites pass 233 tests on Windows. This is adapter-level verification with a mock ACP agent. I haven't verified the patched binary against live Antigravity.

  3. yeyunwen commented on Dec 2, 2026

    @yeyunwen

    Just hit this exact symptom on T3 Code Nightly 0.1.14-nightly.20261130.5465 (macOS 27.0.1 arm64) with bundled antigravity-acp 1.5.20, and there is an important protocol difference on agy 1.5.15+ worth flagging for any fix here:

    What happened on antigravity-acp 1.5.20

    1. During Run 8 (07:46:34Z), a non-daemon run_command stalled (broken shell pipeline where the downstream reader exited with SyntaxError, while upstream zsh -> git archive -> ssh stayed alive) and backgrounded (status: RUNNING).
    2. The agent worked around it with other commands and emitted its complete final reply (PLANNER_RESPONSE, status: DONE, tools: []) — without killing the abandoned background task.
    3. Crucial difference from 1.5.14: On 1.5.20, the original session/prompt from 07:46:34Z never resolved with end_turn at all (it stayed open for 36m 45s, past the 30-minute postSettleCommandHold window).
    4. All 7 follow-up user messages (07:53 through 08:20) sent session/prompt and resolved in 9–106 ms (succeeded), steered into the same unclosed Run 8.
    5. As soon as we sent SIGTERM to the orphaned child PIDs (08:23:05Z), the original 07:46:34Z session/prompt immediately resolved succeeded (08:23:19Z) and the thread transitioned cleanly to completed.

    Implication for T3 Code's fix

  4. WangHunter commented on Dec 2, 2026

    @WangHunter

    Live follow-up to my adapter test above. On Windows 10 with the real agy acp 1.5.17 and gemini-4-hydrogen, I ran the same smoke test against isolated copies of T3 at f12298a646, with and without the local patch. The agent started Start-Sleep -Seconds 90 with WaitMsBeforeAsync: 100 and IsDaemon: false, completed a second command, then emitted its final reply without waiting on the first command.

    T3 run Final reply to original session/prompt response
    Unpatched 88.6 s
    Patched 91.2 s

    Both runs stayed running until after the background command finished and agy answered the original request. A separate stdio ACP client with no T3 server reproduced the same ordering: final reply at 15.167 s, slow tool completed at 97.700 s, and session/prompt returned end_turn at 102.241 s.

    The candidate patch kicks in after end_turn, so it does not fix the live 1.5.17 reproduction. I have held back the PR. This matches the ACP behavior reported for 1.5.20 in google-antigravity/antigravity-cli#2130.

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

    bugneeds-triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions