Skip to content

feat(antigravity): show active subagents, swarm workers, model, and live tools in sidebar - #43695

Open
be0hhh wants to merge 2 commits into
stablyai:mainfrom
be0hhh:feat/antigravity-subagents-swarm
Open

be0hhh wants to merge 2 commits into
stablyai:mainfrom
be0hhh:feat/antigravity-subagents-swarm

Conversation

@be0hhh

@be0hhh be0hhh commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

ELI5

When Antigravity (agy) spawns subagents or a Swarm of parallel workers, Orca now shows the coordinator's model and an active +N badge just like Codex — and expanding the row lists each currently running worker or subagent with its name/role, model, and live tool (read_file, run_command, etc.), while automatically hiding sleeping (wake_mode: "mentions") and finished helpers.

What Changed

  • Shared live child tool preview (AgentSubagentSnapshot): Added optional toolName and toolInput fields to AgentSubagentSnapshot (normalized with AGENT_STATUS_TOOL_NAME_MAX_LENGTH = 60 / AGENT_STATUS_TOOL_INPUT_MAX_LENGTH = 160, included in subagentRosterDigest for relay change detection and agentSubagentsEqual), and wired them into buildLegacyAgentChildRowModels as operation details rendered by DashboardAgentRow.
  • Antigravity brain metadata & active-only roster:
    • Added bounded readers in src/shared/agent-hook-listener/providers/antigravity/antigravity-brain-metadata.ts reusing Orca's existing bounded file/transcript helpers (readNodeFileSyncWithinLimit, readTranscriptDirectory, readFirstTranscriptRecord, readLastTextFromTranscriptOnce) to classify root (USER_EXPLICIT/USER_INPUT) vs child (SYSTEM/SYSTEM_MESSAGE) transcripts, extract non-"auto" models from PLANNER_RESPONSE, inspect <brainDir>/.system_generated/swarm/members.json and .system_generated/subagents/*.json, and check child transcript tails (step_index settlement & pending tool_calls).
    • Added antigravity-pane-state.ts and antigravity-subagent-roster.ts to track per-child hook state (model, toolName, toolInput, ask_question/ask_permission waits) and reconcile active-only snapshots (excluding killed workers, parked wake_mode: "mentions" board workers, and completed SUBAGENT_STATE_ALIVE subagent turns).
  • Root preservation, helper tools, model retention & 1s polling (local + WSL/SSH):
    • Expanded helper tool recognition in antigravity-event-rules.ts (invoke_subagent, send_message, manage_subagents, swarm, swarm_wait, read_board, run_workflow).
    • Updated antigravity-events.ts, provider-dispatch.ts, and pane-provider-session.ts so in-session child hooks update the folded parent row without clobbering parent prompt, tool, model, providerSession, or host turn-end timing, while cold post-restart child hooks remain isolated (providerSession: undefined).
    • Added antigravity-transcript-poll.ts and wired it into transcript-poll-policy.ts, AgentHookServerStatusRetries (main server), and AgentHookResultRetryScheduler (WSL/SSH relay) so swarm worker wake/sleep transitions and live tools update on a 1s cadence between coordinator hooks.
  • Tests & Component Fixtures: Added integration coverage in server-antigravity-subagents-swarm.test.ts and Antigravity swarm/subagent fixtures in WorktreeCardSubagents.fixture.tsx.

Why

Previously, child agy conversations sharing ORCA_PANE_KEY either had their hooks dropped, lacked statusAdmissionSession mapping for active root sessions, omitted modelName, ignored swarm/swarm_wait lifecycle metadata on disk, and only checked invoke_subagent/send_message. Polling Antigravity's .system_generated/{swarm,subagents} metadata alongside child hook reconciliation brings parity with Codex without breaking existing cold-child resume isolation or background run_command monitoring holds.

Linked Issue

Fixes #43692

Visual Proof

Rendered via WorktreeCardSubagents component fixtures (UI visual representation of the new Antigravity Swarm / Subagents status payload):

Before After (Collapsed) After (Expanded)
Before After Collapsed After Expanded

Testing

Ran locally on Linux / WSL2 with Node:

  • pnpm test src/shared/agent-status/ src/shared/agent-hook-listener/ src/main/agent-hooks/server/testing/providers/antigravity/ --maxWorkers=2 → 40 test files passed, 167 tests passed (scoped instead of repo-wide vitest related fan-out caused by touching agent-status-types.ts, per AGENTS.md).

  • pnpm test src/wsl-guest/agent-hooks/ src/renderer/src/components/sidebar/workspace-card/activity/ src/main/agent-hooks/server/testing/presence/server-idle-process-owner.test.ts --maxWorkers=2 → passed (AgentHookResultRetryScheduler, sidebar row projection, and Antigravity/idle owner tests).

  • pnpm tc → passed across all TypeScript projects (tsconfig.node.json, tsconfig.tc.web.json, tsconfig.tc.cli.json).

  • pnpm check:changed --maxWorkers=2 → 37/38 checks passed (changed-code quality, format, oxlint, all ratchets including main-sync-fs-ratchet and max-lines-ratchet, import boundaries, localization, react-compiler-compat); only unit tests (vitest related) was superseded by the scoped Vitest runs above due to agent-status-types.ts fan-out.

  • Headless fixture visual verification via fixtures-shot.mjs (antigravityBefore, antigravitySwarmCollapsed, antigravitySwarmExpanded).

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • Every added test fails without this change and avoids the test anti-patterns

Risk

Level: Low

  • What could break: Antigravity hook admission or idle-stop timing if a provider/version changes transcript origin markers (USER_EXPLICIT/SYSTEM), swarm/members.json structure, or subagents/*.json fields.
  • Safeguards & boundaries: Existing cold-child resume tests (server-antigravity-resume-identity.test.ts), idle process owner tests, and background command hold tests (server-antigravity-background-command-hold.test.ts) continue to pass unchanged; new readers use bounded sync I/O (256KB cap), guard against path traversal on childConversationId, stop 1s polling immediately once the parent row settles to done, and keep AgentSubagentSnapshot.toolName/toolInput optional for backwards wire compatibility with older relays and mobile clients.
  • Revert: A clean revert of this single commit restores prior Antigravity hook handling with no schema migrations or persisted settings impact.

AI Disclosure

Assisted by Google Gemini (via Antigravity CLI), with human review and local test/lint/fixture verification.

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Handles / and \ path separators for Linux, macOS, and Windows brain/transcript paths.
  • Local (AgentHookServer) and remote WSL/SSH (AgentHookResultRetryScheduler) servers share the exact same Antigravity reconciliation and polling logic.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Walkthrough

Antigravity status handling now reads brain metadata and child transcripts to track subagents and swarm workers. It folds child activity, including waiting and tool details, into the parent status and polls active sessions. Subagent snapshots carry tool names and input previews through status comparison and presentation. Tests cover swarm and child-session lifecycle behavior, and fixtures show Antigravity parent and worker rows.

Severity of issue fixed: Medium

Merge Risk: Moderate · up to fd2e4

Antigravity sidebar status can go stale or miss a newly spawned helper in specific sequences, for example when an earlier helper ends or a background command finishes while a new helper is still starting. The effect is limited to the Antigravity status display and can recover on a later event. Fix the discovery-hold handling before merging.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: Antigravity sidebar support for active subagents, swarm workers, model, and live tools. It matches the summarized changeset, which adds Antigravity child tracking, ros…
Description check Passed The description follows the repository template and covers ELI5, What Changed, Why, Linked Issue (Fixes #43692), Visual Proof with before/after images, Testing with commands and results, Risk with lev…
Linked Issues check Passed Linked issue #43692 has coding requirements only. The whole-PR summary (merge base bb2621a to head fd2e459) covers each requirement:
1. Model: normalizeAntigravityModel and `readAntigravityTranscrip…
Out of Scope Changes check Passed Each changed area maps to an objective of #43692 or supports one:
- Antigravity brain metadata, pane state, roster, event rules, events, and transcript poll modules implement model, helper-tool, child…
Full details: Title check

Explanation

The title names the main change: Antigravity sidebar support for active subagents, swarm workers, model, and live tools. It matches the summarized changeset, which adds Antigravity child tracking, roster reconciliation, model retention, tool fields on subagent snapshots, and fixtures. The title is long at 89 characters, but it stays specific and on-topic.

Full details: Description check

Explanation

The description follows the repository template and covers ELI5, What Changed, Why, Linked Issue (Fixes #43692), Visual Proof with before/after images, Testing with commands and results, Risk with level Low and a revert path, AI Disclosure, and the upstream boundary checkbox. The Testing and Visual Proof sections are detailed. The Risk section is clear. Minor gaps: the Visual Proof before/after images are hosted externally and cannot be verified from the diff, and the template's 'Level' wording is filled in. The description is mostly complete.

Full details: Linked Issues check

Explanation

Linked issue #43692 has coding requirements only. The whole-PR summary (merge base bb2621a to head fd2e459) covers each requirement:

  1. Model: normalizeAntigravityModel and readAntigravityTranscriptModel read non-"auto" models from hook payloads and PLANNER_RESPONSE. retainHookRootContext in pane-provider-session.ts keeps the prior Antigravity model.
  2. Helper tools: antigravity-event-rules.ts recognizes invoke_subagent, send_message, manage_subagents, swarm, swarm_wait, read_board, and run_workflow.
  3. Child hook admission: isAntigravityInSessionChildHook and the statusAdmissionSession mapping fold in-session child hooks into the parent row. Cold child hooks stay isolated.
  4. Brain metadata: antigravity-brain-metadata.ts reads .system_generated/swarm/members.json and .system_generated/subagents/*.json. antigravity-subagent-roster.ts builds active-only snapshots and excludes killed, parked wake_mode: "mentions", and settled entries.
  5. Waiting: child ask_question and ask_permission waits set the child to waiting. The parent folds this into its state.
  6. Tool preview: AgentSubagentSnapshot gains optional toolName and toolInput. These pass through buildLegacyAgentChildRowModels, subagentRosterDigest, and agentSubagentsEqual.
  7. Polling: antigravity-transcript-poll.ts is wired into transcript-poll-policy.ts, server-status-retries.ts (local), and agent-hook-result-retry-scheduler.ts (WSL/SSH). Polling stops when the parent reaches done.
  8. Tests: server-antigravity-subagents-swarm.test.ts covers swarm polling, wake-mode filtering, parent-state preservation, child ask_question, and completion retirement. Fixtures cover collapsed and expanded views.
    Changes since the previous review (9ff7f5b to fd2e459) add poll caching (unchangedWhen in node-bounded-file-reader.ts) and worker sleep and model fixes. These support the 1s polling and model requirements. Uncertainty: I did not read source hunks or rerun tests. This verdict relies on the whole-PR summary and the test results stated in the PR description.
Full details: Out of Scope Changes check

Explanation

Each changed area maps to an objective of #43692 or supports one:

  • Antigravity brain metadata, pane state, roster, event rules, events, and transcript poll modules implement model, helper-tool, child-hook, reconciliation, and polling requirements.
  • Shared contract changes (AgentSubagentSnapshot fields, length constants, digest, and equality) carry tool previews to the UI and detect relay changes.
  • node-bounded-file-reader.ts (unchangedWhen) supports the poll caching that the 1s polling requires.
  • Retry scheduler and server retry changes wire polling into the local and WSL/SSH paths.
  • listener-state.ts type changes follow from the new AntigravityPaneChildState type.
  • The fixture file and integration tests support the UI and behavior requirements.
    No unrelated feature or refactor appears in the summary. Conclusions rely on the summary, not on direct diff reads.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c2767e1d-664e-4ec8-9e55-21d5e2d5195b
Commits

Reviewing files that changed from the base of the PR and between 651f2ef and 9ff7f5b.

Files selected for processing: 19

  • src/main/agent-hooks/server/server-status-retries.ts
  • src/main/agent-hooks/server/testing/providers/antigravity/server-antigravity-subagents-swarm.test.ts
  • src/renderer/src/components/sidebar/workspace-card/activity/WorktreeCardSubagents.fixture.tsx
  • src/shared/agent-hook-listener/listener-state.ts
  • src/shared/agent-hook-listener/pane-provider-session.ts
  • src/shared/agent-hook-listener/provider-dispatch.ts
  • src/shared/agent-hook-listener/providers/antigravity/antigravity-brain-metadata.ts
  • src/shared/agent-hook-listener/providers/antigravity/antigravity-event-rules.ts
  • src/shared/agent-hook-listener/providers/antigravity/antigravity-events.ts
  • src/shared/agent-hook-listener/providers/antigravity/antigravity-pane-state.ts
  • src/shared/agent-hook-listener/providers/antigravity/antigravity-subagent-roster.ts
  • src/shared/agent-hook-listener/providers/antigravity/antigravity-transcript-poll.ts
  • src/shared/agent-hook-listener/transcript-poll-policy.ts
  • src/shared/agent-hook-listener/transport/agent-hook-relay.ts
  • src/shared/agent-status/contracts/agent-status-field-normalization.ts
  • src/shared/agent-status/contracts/agent-status-subagent-snapshot.ts
  • src/shared/agent-status/contracts/agent-status-types.ts
  • src/shared/agent-status/presentation/agent-child-row-model.ts
  • src/wsl-guest/agent-hooks/results/agent-hook-result-retry-scheduler.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 17cf51c7-8f2e-4fc6-88d2-e36464d60b76
Commits

Reviewing files that changed from the base of the PR and between 9ff7f5b and fd2e459.

Files selected for processing: 7

  • src/main/agent-hooks/server/testing/providers/antigravity/server-antigravity-subagents-swarm.test.ts
  • src/shared/agent-hook-listener/providers/antigravity/antigravity-brain-metadata.ts
  • src/shared/agent-hook-listener/providers/antigravity/antigravity-event-rules.ts
  • src/shared/agent-hook-listener/providers/antigravity/antigravity-events.ts
  • src/shared/agent-hook-listener/providers/antigravity/antigravity-pane-state.ts
  • src/shared/agent-hook-listener/providers/antigravity/antigravity-subagent-roster.ts
  • src/shared/file-content/node-bounded-file-reader.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Comment on lines +310 to +312
((eventName === 'Stop' && !stopStillBusy) || preservesDoneLead) &&
subagents.length === 0 &&
(paneState.commands?.size ?? 0) === 0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Major · Functional Correctness · Quick win

Retain pane state while helper discovery is pending.

If a background run_command finishes before a spawned helper appears, its PostToolUse can set preservesDoneLead=true. With no discovered subagents or remaining commands, this condition deletes the pane state even though awaitingInitialHelperDiscovery still makes the emitted payload working.

The next poll has no pane state and cannot discover the helper. Require the folded payload to be done, or also require no pending discovery, before cleanup. Keep cleanup for command completion when no discovery hold remains.

Comment on lines +269 to +270
if (diskSubagentById.size > 0 || swarmById.size > 0 || paneState.children.size > 0) {
paneState.awaitingInitialHelperDiscovery = false

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Major · Functional Correctness · Heavy lift

Do not treat an existing helper as discovery of a new helper.

If helper A is already tracked, spawning helper B sets awaitingInitialHelperDiscovery, but this check immediately clears it because A exists. If the root then stops with fullyIdle=false and A is killed before B appears in metadata, the next poll emits done and deletes the pane state. B is no longer discovered by polling.

Track discovery relative to the pending spawn. Clear the hold when a new helper is observed, not when any old child exists. Apply the same distinction to the reset in recordAntigravityChildHook.

This branch has not been deployed

No deployments
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.

Antigravity (agy) sidebar doesn't show active subagents, Swarm workers, model, or live tools

1 participant