feat(antigravity): reuse a running agy language server for CLI usage - #1782
Conversation
|
Codex review: needs changes before merge. Reviewed July 1, 2026, 1:57 AM ET / 05:57 UTC. Summary Reproducibility: yes. from source inspection: current tests classify Review metrics: 2 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Broaden the warm-reuse identity check to cover CLI server shapes CodexBar already recognizes while preserving same-user, selected-account, owned-PID, one-shot-only, cancellation, timeout, and multi-install safety, then add a regression test. Do we have a high-confidence way to reproduce the issue? Yes, from source inspection: current tests classify Is this the best way to solve the issue? No, not quite yet. The warm-reuse design is narrow and well bounded, but the selected-binary guard needs to account for wrapper-spawned CLI server command lines before the PR fully solves the reported reliability issue. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 51eeae71bad8. Label changesLabel justifications:
Evidence reviewedAcceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c91c5cbb0f
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
…rmSession Move the existing spawn logic (beginProbe / waitForSnapshot / finishProbe with its 5s readiness deadline) into a dedicated `fetchBySpawning` method, and route `fetchUsingWarmSession` through a `spawnFetch` seam. Behavior is unchanged; this only isolates the spawn path so it can be substituted or observed by callers and tests.
One-shot CLI invocations spawn a fresh `agy` language server on every call. A fresh server binds its port quickly but `GetUserStatus` returns transient initialization failures for a few seconds, so the 5s readiness deadline is occasionally missed (~30% on Linux: endpoint not ready). Before spawning, discover an already-running authenticated `agy` CLI language server via the existing process detection and reuse its listening ports through the token-less CLI HTTPS endpoint. When no warm server is found (or none answers with parseable usage), fall through to the existing spawn path unchanged. The IDE/app servers require a CSRF token and are excluded from this reuse path.
In long-lived hosts (the app, `codexbar serve`) the warm scan could match the very `agy` CodexBar spawned and manages via AntigravityCLISession, reusing it through the token-less path and bypassing beginProbe/finishProbe. That left the idle timer un-cancelled, so stopIfIdle could tear the managed session down mid-poll. Filter the shared session's live pid out of the warm reuse candidates so only externally owned `agy` is reused.
ed9f79d to
9c5628c
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9c5628c08d
ℹ️ 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".
|
Landed in 46b493f. Thanks @junmo-kim for the contribution! Proof for exact PR head d8170bd:
No account identifiers, ports, cookies, tokens, or credentials are included in this report. |
Problem
codexbar usage --provider antigravity --source clistarts a freshagylanguage server for every one-shot invocation. Fresh servers bind quickly but can take several seconds before quota endpoints become ready, leaving little margin under the existing five-second readiness deadline.Design
Before a one-shot CLI fetch spawns
agy, CodexBar spends at most two seconds looking for a reusable warm server. Reuse is deliberately bounded:agybinary only, preserving explicit binary selection and multi-install behavior.AntigravityCLISession; external reuse is one-shot CLI only.Any ordinary discovery, port, or fetch miss falls through to the existing managed spawn path.
Verification
Exact head
d8170bd54d2c9ecbcb22c1610d59795f8d353778:swift test --filter AntigravityWarmAgyReuseTests: 15 passed.swift test --filter AntigravityCLIHTTPSFetchStrategyTests: 34 passed.swift test --filter AntigravityCLISessionTests: passed.make check: clean; SwiftFormat and SwiftLint reported no violations.make test: all 44 shards passed../Scripts/lint.sh lint-linux: clean.Live macOS provider/process proof used an existing authenticated user session and the exact release helper. Three consecutive calls returned usage in 0.68–1.45 seconds, all logged warm reuse, retained the same single external PID, and cleanup left zero processes. Cold fallback was also exercised separately: it started one managed process, returned usage, and left no process behind. No account identifiers or credentials were captured in this report.
Regression coverage includes warm reuse, ordinary fallback, IDE exclusion, managed-PID exclusion, same-user isolation, selected-binary isolation, selected-account routing, shared deadline behavior, cancellation propagation, and long-lived host lifecycle preservation.