Skip to content

Antigravity: fix native subagent lifecycle, surface full-history native subagents, model switches, and collapsible plan cards - #1229

Merged
Tryanks merged 3 commits into
Tryanks:mainfrom
ClanEver:fix/antigravity-subagents-and-orchestrator-ux
Dec 5, 2026
Merged

Tryanks merged 3 commits into
Tryanks:mainfrom
ClanEver:fix/antigravity-subagents-and-orchestrator-ux

Conversation

@EverClan

@EverClan EverClan commented Dec 5, 2026

Copy link
Copy Markdown

Summary

  1. Fix Antigravity native subagent lifecycle, background tasks, retries, and exact binding

    • Read active SQLite step states (RUNNING = 6, GENERATING = 8) in antigravity::record so background commands/timers and in-flight generations do not prematurely complete subagents or proactive turns, preventing false watchdog kills on waiting parent sessions.
    • Track child GENERIC RUNNING tools as backgrounded items (ItemBackgrounded), settle them on <child>/task-<step> completion messages (parsing exit_code), reconcile silent/killed tasks against SQLite running_steps, and map GENERIC ERROR to ItemStatus::Failed.
    • Bind invoke_subagent directly to the conversationId and workspaceUris returned in its ACP completion ack (WatcherCommand::SpawnBound), emit SessionMoved for child worktrees, track nested subagents recursively, and decode truncated JSON tool arguments cleanly.
    • Filter transient retry ERROR_MESSAGE steps, capture real error messages in failure summaries, and reactivate subagents when late wakeups/retries arrive (emitting ItemUpdated(InProgress) before new child items).
    • Keep parent provider processes alive across idle grace / parked LRU eviction / deferred restarts while native subagents are running, reload evicted mirrors on reactivation, and count running native subagents in Agents::summary().
  2. Surface full-history native subagents independently of client timeline pagination

    • Add NativeSubagentStatus and SessionStatus::native_subagents (populated from the host's complete session.timeline, with compact bounded previews) and document it under Unreleased in crates/protocol/src/lib.rs.
    • Update Agents::of to read status.native_subagents first (deduplicating against loaded timeline.entries for backwards compatibility and in-flight updates) and stably order running native subagents ahead of finished ones. Earlier or still-running native subagents no longer disappear when above the virtualized history window, and counts no longer jump while scrolling up.
  3. Surface Antigravity Orchestrator served-model switches and make plan cards collapsible

    • Tail the parent session's transcript.jsonl (ParentModelTailer) to emit AgentEvent::ServedModel when Antigravity switches models mid-session (e.g. gemini-pro-orchestrator-neon <-> gemini-flash-worker-agy, stripping thought-level suffixes so plain sessions do not emit false switches), rendering Tcode's existing inline ModelChanged divider.
    • Make timeline Plan cards collapsible via their header (with a single-line preview subtitle when collapsed and an independent Copy button), defaulting to collapsed under Antigravity Orchestrator models unless awaiting a user decision.

Verification

  • cargo fmt --all --check
  • mbx clippy --workspace --all-targets --locked -- -D warnings
  • mbx test -p tcode-protocol --locked (12 passed)
  • mbx test -p agent --locked antigravity (24 passed, including new unit tests for RecordState, ParentModelTailer, backgrounded subagent tasks, SpawnBound + worktree + nested spawns, and transient retries/reactivation)
  • mbx test -p tcode-runtime --locked mirrors (12 passed, including running_native_subagent_holds_idle_reap_until_done and session_status_lists_all_native_subagents_from_full_history)
  • mbx test -p tcode-ui --locked agents_panel (5 passed, including native_subagents_outside_loaded_history_window_stay_visible_and_do_not_duplicate)
  • mbx test -p tcode-ui --locked plan_card_collapses (1 passed)
  • mbx test -p tcode-ui --locked a_plan_is_decided (1 passed)

ClanEver and others added 2 commits December 6, 2026 00:51
…ve subagents, model switches, and collapsible plan cards
- Plan cards no longer default to collapsed by testing for Antigravity and
  an "orchestrator" model name in the UI (Principle 4). Every plan opens
  expanded and collapses from its header; the test covers that contract.
- The active-step query in the Antigravity record now propagates its errors
  like the last-step query does. A failed read had counted as "nothing
  running", which settled background tasks early. Fixtures use the real
  `status` column, which agy 1.5.25 writes.
- A nested invoke_subagent whose child cannot be named, and nested spawns
  still open when a turn yields or the session closes, now end with a
  terminal status. Left open, they held their lead's process alive.
@Tryanks

Tryanks commented Dec 5, 2026

Copy link
Copy Markdown
Owner

Review: I pushed 39b8341 to this branch with these fixes.

  • The UI branched on the provider (Principle 4). plan_default_collapsed tested for ProviderKind::Antigravity and an "orchestrator" model substring. It also read running_model, which ServedModel changes on every planner/worker handoff, so plan cards would have flipped open and closed and inverted the user's toggles. Now every plan opens expanded and collapses from its header. The test covers that contract.
  • read_record_state swallowed active-step query errors. It used if let Ok, justified by older fixtures. A failed read counted as "nothing running", which settles background tasks early, the very bug this PR fixes. Errors now propagate like the last-step query's. Fixtures use the real status column (checked against an agy 1.5.25 database).
  • Nested spawns could stay running forever. A nested invoke_subagent with no parseable ack had no terminal event, nor did nested spawns drained when a turn yields or the session closes. The new idle, restart and reap gates on running native subagents then held the lead's process alive indefinitely. These now end Completed, Failed or Interrupted.

Accepted as is: ParentModelTailer reads the transcript tail synchronously inside session_update. Reads are incremental and small.

file:///tmp/wt-two names no file path on Windows, so the ack carried no
worktree and no SessionMoved was announced there. The test now uses a
directory under its scratch dir, which every platform can round-trip.
@Tryanks
Tryanks merged commit c3b2ba0 into Tryanks:main Dec 5, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants