Skip to content

fix(server): show a readable message when Antigravity's proxy drops a stream - #11705

Closed
pujitha24 wants to merge 1 commit into
pingdotgg:mainfrom
pujitha24:auto/issue-11670
Closed

pujitha24 wants to merge 1 commit into
pingdotgg:mainfrom
pujitha24:auto/issue-11670

Conversation

@pujitha24

@pujitha24 pujitha24 commented Sep 14, 2026 •

Copy link
Copy Markdown

What Changed

When Antigravity's local agy_acp_server proxy drops a streamGenerateContent call mid-turn, the adapter now shows a short, readable message instead of forwarding the raw Go transport string. mapAntigravityError in apps/server/src/provider/Layers/AntigravityAdapter.ts gains a branch that recognizes that specific error text (AcpRequestError messages containing both streamGenerateContent and EOF) and replaces it with a friendly "Antigravity lost its connection to the model. Send your message again to retry." message before it reaches the user.

Why

#11670 reports that a dropped Antigravity stream surfaces to the user as:

Agent execution error: model unreachable: doRequest: error sending request: Post "http://127.0.0.1:<port>/v1beta1/projects/<id>/locations/us/publishers/google/models/gemini-3.8-flash-high:streamGenerateContent?alt=sse": EOF

That raw string comes straight from the proxy binary (not this repo) via mapAcpToAdapterError's fallback branch, which sets detail: error.message unchanged for any AcpRequestError. Users read "model unreachable" and assume the network or model is down, when it's actually the local proxy dropping the stream.

Scope note — this is a partial fix. The maintainer's triage on the issue identified three separate problems and a three-part fix: (1) classify this class of error and show a readable message, (2) retry startSession with backoff, (3) treat a clean in-runtime WebSocket close as a recoverable disconnect instead of a fatal one-way latch. This PR implements only part (1), for the specific streamGenerateContent ... EOF string reported in the issue. It does not add retry/backoff, and does not touch the separate Failed to rebuild agent: received 1000 (OK) failure, which happens in ProviderService.recoverSessionForThread during session recovery — a different, larger code path that a maintainer flagged needs session-lifecycle changes beyond a small, surgical fix. That half of the issue (no automatic reconnect, still have to resend the prompt) remains open after this PR.

Validation

  • vp test run apps/server/src/provider/Layers/AntigravityAdapter.test.ts — added a test, "replaces a dropped streamGenerateContent transport error with a readable message", that fails a native prompt with the exact reported raw string via Deferred.fail on the harness's prompt result, drives it through the real sendTurn → mapAntigravityError path, and asserts the surfaced message contains the new friendly text and no longer contains doRequest/EOF. Confirmed this test fails on the pre-fix code (assertion mismatch showing the raw string) and passes after the fix — a true failing-then-passing reproduction, not just an assertion of the implementation.
  • Full file: vp test run apps/server/src/provider/Layers/AntigravityAdapter.test.ts — 28 of 29 tests pass (all except my new test, then all 29 including it after the fix). The one other failure, "serves client file reads and writes only inside the session roots", fails identically on main with no changes applied (confirmed via git stash) — a pre-existing macOS /var vs /private/var temp-directory symlink mismatch in that test's own setup, unrelated to this change.
  • vp -C apps/server run typecheck — clean (no errors; only pre-existing repo-wide lint suggestions unrelated to the changed lines).
  • vp lint --report-unused-disable-directives on both changed files — clean.
  • Not run: no reproduction of the actual Antigravity proxy dropping a live stream (needs the real agy_acp_server binary and a live Gemini backend, not available in this environment). The fix is a pure string-classification change with no behavior depending on live network conditions, so the targeted test above is a full reproduction of the code path in question.

UI Changes

None — this changes which text reaches an existing error surface, not any UI structure. No screenshots.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes (not applicable — no UI change)
  • I included a video for animation/interaction changes (not applicable — no UI change)

Fixes #11670

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of interrupted Antigravity responses by showing a clear retry message instead of exposing technical transport or end-of-file error details.
    • Preserved existing error handling for sign-in issues and other provider errors.

… stream

Antigravity's local agy_acp_server proxy can drop a streamGenerateContent
call mid-turn. Today that raw Go transport error (e.g. "model unreachable:
doRequest: error sending request: Post ...: EOF") reaches the user
unchanged, because mapAcpToAdapterError's fallback sets detail to
error.message with no branch for this class of error. Users read "model
unreachable" and assume the network or model is down, when it is the
local proxy dropping the stream.

mapAntigravityError now recognizes AcpRequestError messages that contain
both "streamGenerateContent" and "EOF" and replaces them with a short,
readable message before they reach the chat.

This is a partial fix. The issue's triage identified a second, separate
problem in a different code path: a clean WebSocket close during session
recovery (ProviderService.recoverSessionForThread) surfaces as a fatal
"Failed to rebuild agent: received 1000 (OK)" with no retry, forcing the
user to resend the prompt. That requires session-lifecycle and retry
changes well beyond a small, surgical fix, and is left open here.

Validation: added a test that fails a native prompt with the exact
reported raw string via Deferred.fail, drives it through the real
sendTurn -> mapAntigravityError path, and asserts the surfaced message
contains the new text and no longer contains "doRequest"/"EOF". Verified
this test fails on the pre-fix code and passes after the fix. Ran
`vp test run apps/server/src/provider/Layers/AntigravityAdapter.test.ts`
(28/29 pass; the one other failure is a pre-existing macOS temp-directory
symlink issue unrelated to this change, reproduces identically on main)
and `vp -C apps/server run typecheck` and `vp lint` on both changed files
(both clean).

Report: pingdotgg#11670
Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>
Assisted-by: claude-sonnet-5 (via Claude Code)
@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Sep 14, 2026
@macroscopeapp

macroscopeapp Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 69790d1

Macroscope's review found this PR approvable — This is a small, self-contained Antigravity error-message fix with unchanged behavior for other errors and targeted test coverage. It introduces no schema, configuration, deployment, security, billing, or static-analysis changes.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Sep 14, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: a73446f0-4762-4331-920a-55309fbcbf30

📥 Commits

Reviewing files that changed from the base of the PR and between e3792a5 and 69790d1.

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

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


📝 Walkthrough

Walkthrough

The Antigravity adapter now detects streamGenerateContent EOF failures and maps them to a retry message. A test verifies that raw doRequest and EOF details are not exposed.

Changes

Antigravity stream error handling

Layer / File(s) Summary
Stream disconnect error mapping
apps/server/src/provider/Layers/AntigravityAdapter.ts
Adds a disconnect message and detection for streamGenerateContent EOF failures. Existing sign-in and generic ACP error mappings remain unchanged.
Stream disconnect mapping test
apps/server/src/provider/Layers/AntigravityAdapter.test.ts
Adds coverage for the mapped ProviderAdapterRequestError and verifies that raw doRequest and EOF details are omitted.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: t3dotgg

Merge Risk: ⚪ Minimal · up to 69790

The targeted stream EOF error is presented as a readable retry message without breaking the adapter error shape. No concrete merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning Issue #11670 requires three coding outcomes: readable errors, retry with backoff for dropped streamGenerateContent requests, and reconnect after a clean ACP WebSocket close. The PR implements the re… Implement and test retry with backoff for dropped streamGenerateContent requests. Implement and test recovery after a clean ACP WebSocket close (1000 OK).
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: showing a readable message when Antigravity drops a stream.
Description check ✅ Passed The description includes the required What Changed, Why, UI Changes, and Checklist sections. It explains the scope, validation, known unrelated test failure, and unresolved retry and reconnection work…
Out of Scope Changes check ✅ Passed The changed AntigravityAdapter.ts mapping and its regression test directly address the readable-error objective in issue #11670. The changes do not introduce unrelated functionality.
Full details: Linked Issues check

Explanation

Issue #11670 requires three coding outcomes: readable errors, retry with backoff for dropped streamGenerateContent requests, and reconnect after a clean ACP WebSocket close. The PR implements the readable-error outcome for the streamGenerateContent plus EOF pattern. AntigravityAdapter.test.ts adds regression coverage and verifies that raw doRequest and EOF details are not exposed. The PR does not implement retry, backoff, or session reconnection, so the issue requirements are incomplete.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@pujitha24

Copy link
Copy Markdown
Author

This is approved with green CI and no outstanding comments as far as I can tell — ready whenever you have a moment. Happy to rebase first if you'd like it freshened.

@juliusmarminge

Copy link
Copy Markdown
Member

Thanks for the PR. We're not taking changes to the orchestration and provider layers right now: that part of the server is being rewritten for V2, and merging into the current code would either conflict with or be thrown away by that work.

Closing for now. If this is still an issue once V2 lands, please reopen (or open a fresh PR against the new code) and we'll take a proper look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Antigravity turn ends on a dropped ACP stream: raw proxy error shown, no reconnect after a clean WebSocket close (1000)

2 participants