Repository navigation
Description
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
Impact
Major degradation or frequent failure
Summary
A delegated Antigravity run finalizes and closes while the agent is still working between two model steps. After the initial session/prompt settles, T3 Code keeps the run open only while a non-daemon execute command runs or while hasPendingReply sees an unread high-priority inbox wake or a trailing SYSTEM_MESSAGE in the transcript. Between a tool step such as a file edit and the next model response, no command is running and readAntigravityPendingReply returns false. scheduleDeferredFinalize then finalizes the run after the 3-second ACP_DEFERRED_FINALIZE_DEBOUNCE, and about 4 seconds later T3 Code sends session/close with kill_background_tasks=true.
Environment
- OS: Linux
- T3 Code version:
0.1.12-nightly.20261122.5111, still present onmainas of 2026-11-23 - Provider: Antigravity ACP
- Model:
gemini-4-neon
Steps to reproduce
- Start a delegated task in a project using the Antigravity ACP provider with
gemini-4-neon. - Let the agent run at least one backgrounded shell command so the initial
session/promptsettles and the run enters deferred finalization. - After the background command wakes the agent, let the agent run a multi-step sequence that includes a synchronous tool such as a file edit followed by a slow model response.
- Observe the run state while the model prepares its next response after the tool completes.
Expected behavior
The delegated run stays open while the agent waits for the next model response after a tool call or tool result. T3 Code does not finalize the turn or send session/close until the agent finishes its final model response.
Actual behavior
Once the initial session/prompt settles, packages/provider-acp/src/server/adapter.ts sets context.replyOpen = false on usage_update and arms ACP_DEFERRED_FINALIZE_DEBOUNCE for 3 seconds whenever no non-daemon execute command, schedule, or subagent is running.
When the 3-second debounce expires, scheduleDeferredFinalize calls hasPendingReply, which delegates to readAntigravityPendingReply in apps/server/src/provider/acp/AntigravityChildWork.ts. readAntigravityPendingReply returns true only when .system_generated/messages/ has an unread MESSAGE_PRIORITY_HIGH message or when the last line of .system_generated/logs/transcript.jsonl has type === "SYSTEM_MESSAGE". Between a completed tool step such as a file edit and the next model response, neither condition holds, so readAntigravityPendingReply returns false.
T3 Code emits turn.completed, creates a checkpoint, and sends session/close with kill_background_tasks=true about 4 seconds later. The delegated task closes with incomplete work. Sending a new message to the thread resumes the session without losing context.
Evidence
- Observed on several consecutive runs of one delegated task in my project at durations of 19 minutes, 47 minutes, 57 minutes, and 62 minutes.
- Between two model steps, for example a file edit followed by a model response taking about 60 seconds, T3 Code finalized the run with
turn.completedand a checkpoint, sentsession/closewithkill_background_tasks=trueabout 4 seconds later, and the model response arrived about 1 second after the run closed. - The Antigravity language-server log contained no stop reason, no max-tokens error, and no context or auth error.
- Verified on
mainas of 2026-11-23 thatreadAntigravityPendingReplyinapps/server/src/provider/acp/AntigravityChildWork.tslines 763 to 783 checks only unread high-priority inbox messages and a trailingSYSTEM_MESSAGEline intranscript.jsonl.
Suggested fix
Update readAntigravityPendingReply in apps/server/src/provider/acp/AntigravityChildWork.ts to treat the turn as unfinished when the last step in transcript.jsonl is a tool call or a tool result without a following model response. Return true when the trailing transcript record is a tool execution step, a tool result step, or a PLANNER_RESPONSE carrying tool_calls with no subsequent PLANNER_RESPONSE.
That allows scheduleDeferredFinalize to extend into the 2-minute ACP_OPEN_REPLY_QUIET_LIMIT while the model generates the next step, matching the existing bound used for queued background wakes in #39989.
Workaround
Send a new message to the delegated thread to resume the Antigravity session. Context is not lost.
Related
- fix(antigravity): keep turns open when a background wake is still pending #39989 added
hasPendingReplyandreadAntigravityPendingReplyfor unread inbox wakes and trailingSYSTEM_MESSAGEsteps, but it does not cover tool-call or tool-result boundaries. - fix(server): Antigravity threads keep going after a background command finishes #38864 and fix(server): Antigravity threads stay working while a background command runs, and Stop ends it #38916 enabled post-settle continuation and deferred finalization on Antigravity.
- [Bug]: Delegated Antigravity child tasks prematurely report completed to parent when waiting on a background run_command #40487 reports delegated Antigravity children completing early while waiting on a running background
run_command, whereas here no background command is running.
Activity
juliusmarminge commentedon Nov 23, 2026
I tried to reproduce this on the current build and could not.
Commit 7180578 (origin/main). Live attempt: fresh worktree,
T3CODE_DEV_SEED=0 GOOGLE_GEMINI_BASE_URL=<hub> vp run dev, added an Antigravity instance in Settings > Providers > Add provider with sign-in method 'Gemini API key', added a scratch git project, and started threads viat3 thread start --provider <antigravity instance> --model <m>with a prompt asking for a backgroundsleep 45command, then file edits and a long reply. All three hub models (gemini-4-neon, gemini-4-hydrogen, gemini-3.8-flash) failed the first turn immediately with HTTP 429 'Individual quota reached ... reset in 64h', so the background/tool-boundary sequence never ran. Code-level reproduction: extended the existingreadAntigravityPendingReplycase in apps/server/src/provider/acp/AntigravityChildWork.test.ts with a transcript ending on a PLANNER_RESPONSE carrying tool_calls, and on that tool call followed by its GENERIC result step.vp test run src/provider/acp/AntigravityChildWork.test.ts -t 'detects unread high-priority'fails on main: expected true, got false at the trailing tool-call assertion. Pushed as factory/repro-41345 (b93922b).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.