Skip to content

spike(server): Antigravity CLI provider protocol (#642) - #2

Merged
anonb3ll merged 1 commit into
mainfrom
codex/task-642-antigravity-provider
Aug 28, 2026
Merged

spike(server): Antigravity CLI provider protocol (#642)#2
anonb3ll merged 1 commit into
mainfrom
codex/task-642-antigravity-provider

Conversation

@anonb3ll

@anonb3ll anonb3ll commented Aug 28, 2026

Copy link
Copy Markdown
Owner

Summary

Spike for task pingdotgg#642 — protocol-only slice for Antigravity (Agy CLI) as a future T3 provider.

  • AntigravityCliProtocol.ts — availability probe, bounded launch/resume args, stream-json event normalization
  • AntigravityCliProtocol.test.ts — 9 focused tests (availability, init/step/result parsing, exit normalization)

Not a registered provider. Live builtInProviderCatalog unchanged. Do not merge until permission-round-trip and cancel wire shapes are captured (see vault spike decision record).

Verification

  • vp test run apps/server/src/provider/antigravity/AntigravityCliProtocol.test.ts — 9/9 pass
  • vp fmt --check + vp lint clean on both files
  • Live probe: agy 1.1.22, plan mode + stream-json verified on DesktopUbuntu

Governance note

--mode plan --sandbox still advertises mutating tools in init.tools. Containment is permission_mode: request-review only — adapter + Unified-Agent approval gate must enforce boundaries.

Test plan

  • Unit tests pass
  • Deliberate permission-request probe (blocks production adapter)
  • Live cancel mid-turn probe
  • Tool-call step shape capture

Links

  • Strategy: vault 00 - Inbox/Unified-Agent and Exocortex Executive Strategy and Roadmap 2026-08-27.md
  • Commit: 76b15948

Made with Cursor

Summary by CodeRabbit

  • New Features

    • Added support for integrating with the Antigravity CLI.
    • Improved detection of CLI availability and authentication status.
    • Added handling for streamed responses, conversation resumption, progress updates, and completed results.
    • Improved reporting for cancellation, failed commands, malformed responses, and missing terminal results.
  • Bug Fixes

    • Standardized Antigravity CLI errors and process exits into clearer terminal statuses.
  • Tests

    • Added comprehensive coverage for CLI arguments, streaming, failures, cancellation, and availability detection.

Establish the wire contract for driving the Antigravity (agy) CLI as a T3
provider: bounded plan-mode launch and resume argument construction,
unavailable/unauthenticated/available classification, stream-json event
parsing, and terminal-outcome normalization covering cancellation and
missing terminal results.

Protocol functions only. Nothing spawns a process or registers a provider,
so the live provider catalog is unchanged.

Verified against agy 1.1.22 by bounded read-only probe: init, step_update,
and result envelopes match the fixtures, and --conversation resume
continues step_index and reuses cached context.

Spike authored by Desktop_Codex; recovered from a disposable checkout,
independently re-verified, and committed by Laptop_Cursor. Task pingdotgg#642.
@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 872b5f40-7d52-4e2e-b274-32c6f24a632c

📥 Commits

Reviewing files that changed from the base of the PR and between 18d281e and 76b1594.

📒 Files selected for processing (2)
  • apps/server/src/provider/antigravity/AntigravityCliProtocol.test.ts
  • apps/server/src/provider/antigravity/AntigravityCliProtocol.ts

📝 Walkthrough

Walkthrough

Adds the Antigravity CLI protocol. The module builds CLI arguments, classifies availability, parses and normalizes stream events, and maps process exits to provider signals. Tests cover successful, failed, malformed, cancelled, and incomplete protocol flows.

Changes

Antigravity protocol

Layer / File(s) Summary
CLI contracts and availability probes
apps/server/src/provider/antigravity/AntigravityCliProtocol.ts, apps/server/src/provider/antigravity/AntigravityCliProtocol.test.ts
Defines public protocol types, builds bounded plan-mode stream arguments, forwards optional settings, and classifies unavailable, unauthenticated, and available CLI states.
Stream parsing and event normalization
apps/server/src/provider/antigravity/AntigravityCliProtocol.ts, apps/server/src/provider/antigravity/AntigravityCliProtocol.test.ts
Parses supported JSON events, ignores malformed or unsupported input, and emits session, content, completion, or abort signals.
Process-exit terminal handling
apps/server/src/provider/antigravity/AntigravityCliProtocol.ts, apps/server/src/provider/antigravity/AntigravityCliProtocol.test.ts
Maps cancellation, missing terminal results, successful exits, and nonzero exits to terminal provider signals while suppressing duplicates.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant AntigravityCLI
  participant ProtocolParser
  participant ProtocolNormalizer
  participant Provider
  AntigravityCLI->>ProtocolParser: Emit JSON stream line
  ProtocolParser->>ProtocolNormalizer: Return parsed CLI event
  ProtocolNormalizer->>Provider: Emit normalized provider signal
  AntigravityCLI->>ProtocolNormalizer: Report process exit
  ProtocolNormalizer->>Provider: Emit terminal abort or completion signal
Loading
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/task-642-antigravity-provider

Comment @coderabbitai help to get the list of available commands.

@anonb3ll
anonb3ll marked this pull request as ready for review August 28, 2026 05:02
@anonb3ll
anonb3ll merged commit 54c5fa5 into main Aug 28, 2026
1 check passed
@anonb3ll
anonb3ll deleted the codex/task-642-antigravity-provider branch August 28, 2026 05:02

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 76b159486c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

typeof value.result.conversation_id === "string" &&
typeof value.result.status === "string"
) {
return value as unknown as AntigravityResultEvent;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Validate result payload fields before returning them

Once this protocol is wired to an adapter, a version-skewed or malformed result line such as one with response: 7 passes this cast because only conversation_id and status were checked. The normalizer then returns a number where AntigravityProviderSignal.response promises a string, and likewise trusts the duration, turn count, and usage fields, so downstream rendering or accounting can receive invalid runtime data; validate or sanitize these optional fields at the protocol boundary.

AGENTS.md reference: AGENTS.md:L131-L131

Useful? React with 👍 / 👎.

Comment on lines +235 to +238
if (processExit.signal !== null) {
return {
type: "turn.aborted",
status: "CANCELLED",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Distinguish crashes from requested cancellation

Once wired, if agy dies from SIGSEGV/SIGABRT or receives SIGKILL from an OOM killer or service manager, every non-null signal is labeled CANCELLED even though the user did not cancel. This hides provider crashes and can produce incorrect failure or retry behavior; carry explicit cancellation intent or classify only an expected, requested termination as cancellation.

AGENTS.md reference: AGENTS.md:L131-L131

Useful? React with 👍 / 👎.

Comment on lines +135 to +137
if (probe.models === null || probe.models.exitCode !== 0) {
return {
status: "unauthenticated",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Do not treat every model-probe failure as logged out

When the version probe succeeds but agy models exits nonzero because of a transient network error, crash, incompatible CLI version, or another operational failure, this always reports unauthenticated. Future consumers will therefore direct the user to log in instead of surfacing the actual availability problem; return unauthenticated only for an identified authentication error and represent other failures as unavailable or unknown.

Useful? React with 👍 / 👎.

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.

1 participant