Skip to content

feat: add antigravity provider#2144

Merged
arnestrickmann merged 5 commits into
mainfrom
antigravity-cli-fozin
May 20, 2026
Merged

feat: add antigravity provider#2144
arnestrickmann merged 5 commits into
mainfrom
antigravity-cli-fozin

Conversation

@janburzinski
Copy link
Copy Markdown
Collaborator

summary

  • adds support for antigravity cli
  • updates classifier
  • support equals-style (e.g. conversations=...) for provider command arguments

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 20, 2026

Greptile Summary

This PR adds Antigravity as the 30th supported provider, introducing a CLI classifier, provider registry entry, and UI metadata. It also generalises the buildAgentCommand helper to support equals-style session-ID flags (e.g. --conversation=<id>) used by Antigravity.

  • Antigravity classifier (antigravity.ts): fixes the mixed-coordinate-system issue from prior review by converting all match indices to text-global offsets before comparison; scopes error and auth_success detection to the current chunk only; uses a Generating... gate to suppress stale state; tightens the permission-prompt regex to approve|reject|run command? instead of the previously flagged broad allow|confirm patterns.
  • appendSessionId helper: new function that detects trailing-= flags and appends the session ID inline (e.g. --conversation=session-1), while falling back to the existing space-separated behaviour for all other providers.
  • conversation-manager.ts: immediately marks a new conversation as working when an initial prompt is present, eliminating the brief idle-state flash on launch.

Confidence Score: 5/5

Safe to merge; all changed paths are well-tested and the refactored session-ID logic preserves existing provider behaviour.

The coordinate-system and permission-prompt false-positive bugs flagged in prior review rounds have been addressed with matching regression tests. The appendSessionId refactor is straightforward and all existing provider test cases still pass. The one remaining note — permissionPromptIndex using first-match search rather than last-match — is an edge case that would only surface if a permission prompt appeared twice in the tail window straddling a Generating... block.

src/main/core/agent-hooks/classifiers/antigravity.ts — the permissionPromptIndex first-vs-last match inconsistency noted above.

Important Files Changed

Filename Overview
src/main/core/agent-hooks/classifiers/antigravity.ts New classifier for Antigravity CLI. Correctly addresses the mixed-coordinate-system bug and avoids allow/confirm false positives in the permission-prompt regex. Minor inconsistency: permissionPromptIndex uses first-match search while readyPromptIndex uses last-match Math.max.
src/main/core/agent-hooks/classifiers/antigravity.test.ts Comprehensive test suite covering offset-mixing fix, error/auth-success chunk-scoping, false positive patterns, and the Generating... gate.
src/main/core/conversations/impl/agent-command.ts Adds appendSessionId helper to handle equals-style flags and refactors the resume/fresh session-ID branching. Behavior for all existing providers is preserved.
src/main/core/agent-hooks/classifiers/base.ts Minimal, backward-compatible signature extension: ClassifyFn gains a second chunk parameter and createProviderClassifier forwards the ANSI-stripped chunk.
src/shared/agent-provider-registry.ts Adds the antigravity provider definition with sessionIdFlag: '--conversation=', consistent with the rest of the registry.
src/renderer/features/tasks/conversations/conversation-manager.ts Sets the new conversation to working state immediately when an initialPrompt is provided.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[classify chunk] --> B[append to buffer, strip ANSI]
    B --> C{buffer > 4 KB?}
    C -- yes --> D[trim to last 4 KB]
    C -- no --> E[compute tail = last 700 chars]
    D --> E
    E --> F[compute indices\npermissionPromptIndex tail.search\nauthSuccessIndex chunk.search\nerrorIndex chunk.search\nreadyPromptIndex Math.max of 3 tail.search\ngeneratingIndex tail.lastIndexOf]
    F --> G[compute lastActionableIndex\nmax of all indices converted to text-global]
    G --> H{Generating... present AND\ntailStart+generatingIndex > lastActionableIndex?}
    H -- yes --> I[return undefined]
    H -- no --> J{permissionPromptIndex >= 0?}
    J -- yes --> K[return permission_prompt]
    J -- no --> L{authSuccessIndex >= 0?}
    L -- yes --> M[return auth_success]
    L -- no --> N{errorIndex >= 0?}
    N -- yes --> O[return error]
    N -- no --> P{readyPromptIndex >= 0?}
    P -- yes --> Q[return stop]
    P -- no --> R[return undefined]
Loading
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
src/main/core/agent-hooks/classifiers/antigravity.ts:5-20
**`permissionPromptIndex` uses first-match `search` while `readyPromptIndex` uses last-match `Math.max`**

`readyPromptIndex` is deliberately computed as the *latest* matching position (via `Math.max`) so the gate correctly identifies whether a ready prompt is more recent than the last `Generating...`. `permissionPromptIndex` uses `tail.search(regex)`, which returns the *first* match.

In the edge case where a `run command?` prompt appears in the tail both before *and after* a `Generating...` block, `permissionPromptIndex` points to the earlier occurrence. That position will satisfy `tailStart + generatingIndex > lastActionableIndex` (Generating... is between the two prompts), so the later — and valid — permission prompt gets incorrectly suppressed. For consistency and correctness, consider returning the index of the *last* match, mirroring the `Math.max` approach used for `readyPromptIndex`.

Reviews (2): Last reviewed commit: "fix antigravity classifier review issues" | Re-trigger Greptile

Comment thread src/main/core/agent-hooks/classifiers/antigravity.ts Outdated
Comment thread src/main/core/agent-hooks/classifiers/antigravity.ts
@janburzinski
Copy link
Copy Markdown
Collaborator Author

@greptileai

Copy link
Copy Markdown
Contributor

@arnestrickmann arnestrickmann left a comment

Choose a reason for hiding this comment

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

thanks! lgtm

@arnestrickmann arnestrickmann merged commit f7987d9 into main May 20, 2026
1 check 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.

2 participants