Skip to content

[Bug]: Antigravity native schedule pins turns in running indefinitely, starving queued runs and scheduled automations #41467

Open

Description

@Luzivog

Before submitting

Area

apps/server

Summary

When an Antigravity (agy acp) agent calls its native schedule tool (for example, a 3-hour one-shot timer with DurationSeconds: 10800), T3 Code keeps the active run (status: "running") and provider_turn open for the entire duration of the timer, even after session/prompt succeeds and Antigravity is completely idle. Because postSettleCommandHold (30 minutes) explicitly excludes ANTIGRAVITY_SCHEDULE_TITLES, the turn never finalizes, startNextQueuedRun never fires, and all queued runs (T3 scheduled automations, user-queued messages, t3_thread_send(..., mode: "queue"), freshContext: true, /compact) starve for hours, while delegated sub-agent completions keep jumping ahead of the queue via steer_active.

Steps to reproduce

  1. Open a T3 Code thread on the Antigravity provider (agy 1.5.14, e.g., gemini-4-neon).
  2. Have the agent call Antigravity's native schedule tool (e.g., DurationSeconds: 10800) and finish its turn (session/prompt returns succeeded / end_turn).
  3. Queue a message on the thread: either let a bound T3 scheduled task fire (thread_mode: "continue", where sendBound hardcodes mode: "queue"), queue a message in the composer, or call t3_thread_send with mode: "queue".
  4. Optionally, have an async delegate_task child complete on the same thread while the queued run is waiting.

Actual behavior

  • session/prompt finishes cleanly (status: "succeeded"), Antigravity is idle, and closeTextStreams(context) clears the active generation indicator, yet the run and provider_turn stay in status: "running" indefinitely (red Stop button remains active).
  • Queued runs never start until the native timer expires (hours later) or the user manually clicks Send now (queued-message.promote-to-steer).
    • Observed live on 0.1.12-nightly.20261122.5111: run 190 started at 11:11:51Z, the agent set a 3-hour native schedule (DurationSeconds: 10800) at 11:31:59Z, and a bound T3 scheduled automation queued as run 191 at 11:30:17Z sat undelivered for ~2 hours until manually promoted at 13:29:49Z. During those 2 hours, session/prompt completed cleanly over a dozen times with 5 to 10+ minute idle gaps. The same lock occurred earlier on the same thread in run 92 (DurationSeconds: 6060 pinned run 92 from 02:23Z to 04:05Z, blocking queued run 93 at 03:28Z).
  • Every delegate_task completion jumps ahead of the queued run via provider-turn.steer (steerWithPrompt), causing indefinite FIFO queue starvation.
  • Because AntigravityAdapterV2 does not populate pendingBackgroundTasks for active Run schedule tools, the UI hides what is actually holding the run open (if an unrelated sub-agent has a pending background task, the Waiting · banner displays only that sub-agent, making the parent thread appear idle and merely waiting on sub-agents while refusing to deliver queued messages).

Root cause (traced in 0.1.12-nightly.20261122.5111)

  1. src/provider/acp/AntigravityProtocol.ts + AcpAdapterV2: antigravityToolOutlivesPrompt returns true for ANTIGRAVITY_SCHEDULE_TITLES (new Set(["Run schedule", "Running schedule"])), so followPrompt sees hasDeferredBackgroundWork(context) === true and skips finalizeTurn after session/prompt settles.
  2. No timeout on schedule holds: AntigravityAdapterV2 configures postSettleCommandHold: { timeout: "30 minutes", isCommand: antigravityCommandOutlivesPrompt } (from fix(antigravity): bound silent post-settle background command holds #40858 / Antigravity orphaned background commands hold completed turns in running with no UI indicator and deadlock delegated parent threads #39820), and antigravityCommandOutlivesPrompt explicitly returns false for ANTIGRAVITY_SCHEDULE_TITLES. Thus schedulePostSettleHoldExpiry never releases a schedule-held turn.
  3. Asymmetric dispatch causes queue starvation (Orchestrator.dispatchMessage):
    • delegatedCompletion wakes (completionWake === "always") are automatically upgraded from queue_after_active to steer_active whenever supportsActiveSteering && activeSteeringInterruptsTools !== true (antigravitySteersWithPrompt is true on agy >= 1.5.0).
    • Bound scheduled tasks (sendBound hardcodes mode: "queue"), user-queued messages, freshContext: true, and slash commands remain strictly queued and can only start in startNextQueuedRun after the active run reaches a terminal status.
  4. Comparison with ClaudeAdapterV2: When Claude calls ScheduleWakeup, ClaudeAdapterV2 finalizes the turn immediately (completed), exposes CLAUDE_SCHEDULED_WAKEUP_TASK in pendingBackgroundTasks, pins the subprocess against DEFAULT_IDLE_TIMEOUT_MS (30m) via hasPendingBackgroundWork, and lets the later wake run as a continuation turn. By contrast, AntigravityAdapterV2 already sets enablePostSettleContinuation: true, yet keeps deferFinalizeForBackgroundWork: true for ANTIGRAVITY_SCHEDULE_TITLES and does not implement extractBackgroundTaskId / pendingBackgroundTasks (likely as a workaround for [Bug]: A thread waiting on an agent-scheduled wake looks finished, and the wake is announced by a generic untranslated divider #39795, where a completed turn with a pending schedule looked finished in the UI).

Expected behavior / Suggested fix

  1. Match ClaudeAdapterV2's ScheduleWakeup architecture for Antigravity schedules (and ideally post-settle background work):
    • Do not hold activeTurn / run in running for ANTIGRAVITY_SCHEDULE_TITLES once session/prompt settles.
    • Track running Antigravity schedule tools in runningBackgroundTaskIds and publish them in pendingBackgroundTasks (giving the sidebar and Waiting · banner accurate visibility as requested in [Bug]: A thread waiting on an agent-scheduled wake looks finished, and the wake is announced by a generic untranslated divider #39795, and pinning the agy acp subprocess past the 30-minute idle timeout via hasPendingBackgroundWork).
    • Call finalizeTurn when session/prompt completes so startNextQueuedRun immediately drains queued messages and scheduled automations, and let bufferPostSettleWake + offerContinuationRun (enablePostSettleContinuation: true) start a continuation run when the schedule fires.
  2. Prevent queue starvation during post-settle hold: While a turn is in promptSettled === true idle hold (not actively mid-prompt), do not let newly arriving delegatedCompletion steers bypass older queued runs (or yield/finalize the idle hold when an unheld queued run is waiting).

Version and environment

  • T3 Code: 0.1.12-nightly.20261122.5111 (t3 serve)
  • Antigravity CLI: agy 1.5.14 (gemini-4-neon, full-access)
  • OS: Ubuntu 26.04 LTS (x86_64)

Activity

  1. Luzivog commented on Nov 24, 2026

    @Luzivog
    ContributorAuthor

    Update: Same starvation now hits non-daemon background run_command waits on agy 1.5.15–1.5.16 (bypassing #40858)

    After blocking Antigravity's native schedule tool locally via a PreToolUse hook, we hit the exact same queue starvation on non-daemon background run_command executions, which account for the vast majority of Antigravity queue stalls in production.

    Current behavior (t3 20261122.5111, agy 1.5.15/16) Proposed 3-part fix
    Before: Antigravity background command hold starving queued run for 27.8m After: Parked auto-drain via non-interrupting steerWithPrompt and visible pendingBackgroundTasks

    Root cause observed live (Nov 24, 0.1.12-nightly.20261122.5111)

    1. agy 1.5.15+ keeps session/prompt unsettled for the entire lifetime of a non-daemon background run_command (promptSettled === false):
    2. Why #40858 and the inactivity watchdog did not help:
      • #40858's 30-minute postSettleCommandHold timer only arms once promptSettled === true (and resets on any activity event). Because agy kept session/prompt open, #40858 never armed.
      • Pre-settle retireInactivePrompt is paused whenever any tool has status === "running" (promptInactivityPaused), leaving zero timeout or release valve.
    3. Asymmetric auto-steer + hidden blocker:
      • Antigravity negotiates supportsActiveSteering: true (via steersWithPrompt) and activeSteeringInterruptsTools !== true. When the user manually clicked Steer (promoteToSteer) at 16:27:16Z (after 27.8 min queued), agy acp accepted the steered session/prompt in 28 ms without interrupting the running background command.
      • Yet Orchestrator.dispatchMessage only auto-upgrades delegatedCompletion wakes (and t3_thread_send(mode: "auto")) to steer_active, leaving queue_after_active human replies (e.g. from external clients/mirrors) and pr-watch notifications starved behind the idle turn.
      • Meanwhile derivePendingBackgroundWork returns [] whenever hasActiveRun === true, hiding the blocking command from ThreadShell.pendingBackgroundTasks across web, mobile, and downstream clients.

    Fleet impact measured in statev2.sqlite (Nov 20 to Nov 24, 4.5 days)

    • Human messages queued >= 1 min: Antigravity had 83 waits (11.2 h total, 25 manual steers/cancels) vs Claude's 20 waits (54 min, 2 manual steers).
    • Non-human Antigravity wakes queued >= 1 min: 60 pr-watch runs (11.7 h) and 8 scheduled runs (2.4 h).
    • Blocker breakdown across all 85 Antigravity waits >= 5 min (30.6 h): native schedule was only 7.6% (4 runs, 140 min); background run_command holds (17 runs, 298 min), unended subagent waits (34 runs, 409 min), and long/stalled turns (30 runs, 987 min) accounted for 92.4%.

    Concrete 3-part fix

    1. Drain queued runs into non-interrupting steer_active when a turn is parked on background work: When an active run is in post-settle hold, waiting, or pre-settle quiet (no streaming assistant/reasoning activity, only background execute/subagent tools running) and the session supports supportsActiveSteering && activeSteeringInterruptsTools !== true, automatically promote queued human messages, pr-watch wakes, and scheduled runs via steerWithPrompt instead of letting only delegatedCompletion cut ahead.
    2. Finalize on prompt settle (matching Claude): Replace AntigravityAdapterV2's 30-minute deferFinalizeForBackgroundWork hold with immediate run finalization + pendingBackgroundTasks + enablePostSettleContinuation (aligning with open fix(antigravity): advertise supportsBackgroundWait and honor awaited: false #39990 and fix(antigravity): Show background command summaries and live output #40687).
    3. Expose running background commands on ThreadShell during active runs: Stop derivePendingBackgroundWork from returning [] unconditionally when hasActiveRun === true so UIs and mirrors show what is holding the turn open.
  2. skap3214 commented on Nov 24, 2026

    @skap3214

    Same bug on macOS 27.0.1 with T3 Code 0.1.12-nightly.20261123.5124, agy 1.5.14, gemini-4-neon, full access. Adding data for long, chained timers, where the hold never clears by itself.

    • One run has been running for 34 hours (since 2026-11-23T09:03Z, still running at 2026-11-24T19:50Z). Every session/prompt in that time returned succeeded, and the agent is idle between them.
    • Chained 24 h timers keep it open. The agent made 54 native schedule calls in the thread, 8 of them with DurationSeconds: 86400 (T+24h post-deploy checks). A 24 h timer has been pending without a gap since 2026-11-23T10:38Z, because the agent sets the next one before the previous one fires. Six are pending now, and the last fires at 2026-11-25T07:56Z.
    • Six PR-watch messages are starved. Runs with message:pr-watch:* user messages queued between 2026-11-23T09:22Z and 11:57Z are still queued more than 34 hours later.
    • User messages only arrive through Send now. With Follow-up behavior set to Queue, each message waits in the queue. After Send now, its run shows cancelled and the message is steered into the held run.
    • Nothing in the UI names the timers. The state has six dynamic_tool items titled Run schedule with status running, and the thread's pendingBackgroundTasks is empty. The thread looks like a reply that never finishes.

    An agent that verifies deploys at T+15m, T+1h and T+24h produces this pattern every time, so the thread stays in Working for as long as the agent keeps doing that work.

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