Skip to content

fix(antigravity): stream large stdout protocol lines instead of failing at 16 MiB - #42150

Open
chyax98 wants to merge 2 commits into
pingdotgg:mainfrom
chyax98:fix/antigravity-large-stdout-protocol-lines
Open

chyax98 wants to merge 2 commits into
pingdotgg:mainfrom
chyax98:fix/antigravity-large-stdout-protocol-lines

Conversation

@chyax98

@chyax98 chyax98 commented Nov 24, 2026

Copy link
Copy Markdown

Problem

When an Antigravity ACP thread produces a large tool output (for example, an unbounded rg search that stores an ~8.8 MiB step payload in Antigravity's conversation SQLite DB), antigravity-acp emits a JSON-RPC notification line larger than 16 MiB on stdout.

makeAntigravityStdoutTransform in apps/server/src/provider/antigravityAuthSupport.ts buffers every stdout line in full until \n just to check the 56-byte ANTIGRAVITY_AUTH_STDOUT_PREFIX, and rejects any line over maxStdoutLineBytes (16 MiB) with AcpTransportError: Antigravity sent a protocol line that is too large.. Because the oversized step stays persisted in the Antigravity conversation DB, every subsequent turn (session/load + session/prompt, model switch, or compaction) replays that step and fails again within ~140 ms, permanently bricking the thread with Provider turn failed..

Downstream packages/effect-acp/src/protocol.ts (makeStrictNdJsonRpcParser) already handles multi-megabyte NDJSON lines without a 16 MiB cutoff.

Change

  • Rewrote makeAntigravityStdoutTransform as a 3-state streaming prefix matcher (prefix → passthrough / auth) instead of buffering entire protocol lines.
  • Non-auth lines (including all JSON-RPC frames, which mismatch on the first byte {) are forwarded chunk-by-chunk with zero line buffering as soon as a byte disagrees with the 56-byte ANTIGRAVITY_AUTH_STDOUT_PREFIX.
  • Lines that do match ANTIGRAVITY_AUTH_STDOUT_PREFIX remain bounded by maxBrowserHelperLineLength (~16 KiB) and fail fast with "Antigravity returned an invalid Google sign-in URL." if exceeded, preserving bounded memory in the transform.
  • Updated apps/server/src/provider/antigravityAuthSupport.test.ts to cover >16 MiB streamed JSON-RPC lines followed by a login line, cross-chunk partial prefix mismatches, and oversized login line rejection.

Scope

Small, focused bug fix for a real failure observed in T3 Code Nightly when an Antigravity thread hit the 16 MiB stdout transform limit and became permanently unusable. No separate issue needed per CONTRIBUTING.md.

Verification

Ran focused checks in /apps/server with Node 26.13.1:

  • vp test run src/provider/antigravityAuthSupport.test.ts — 33 passed (including streaming a 17 MiB JSON-RPC line followed by an auth URL line, cross-chunk partial prefix mismatches, and oversized login line rejection).
  • vp test run src/provider/acp/AntigravityAcpSupport.test.ts src/provider/AntigravityAuth.test.ts src/provider/AntigravityProvider.test.ts — all passed (97 tests across 3 files).
  • vp fmt --check apps/server/src/provider/antigravityAuthSupport.ts apps/server/src/provider/antigravityAuthSupport.test.ts — clean.
  • vp lint --report-unused-disable-directives apps/server/src/provider/antigravityAuthSupport.ts apps/server/src/provider/antigravityAuthSupport.test.ts — 0 warnings, 0 errors.
  • effect-tsgo tsrs -p tsconfig.json --noEmit in apps/server — exit 0.

Not run: repo-wide vp run check:changed (only server/scripts/oxlint workspace dependencies were installed locally; CI covers the full suite).

Implemented with Gemini 4 Neon via Antigravity harness in T3 Code.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-25T06:04:55.550924Z 2780adb New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Nov 24, 2026
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The Antigravity stdout transform now segments authentication candidates incrementally. It passes unrelated bytes through, processes recognized authentication lines, and applies the browser-helper line limit to candidate lines. Tests cover large protocol messages, partial prefix matches, and oversized authentication lines.

Changes: Antigravity stdout authentication parsing

Layer / File(s) Summary
Prefix-aware stdout transform and coverage
apps/server/src/provider/antigravityAuthSupport.ts, apps/server/src/provider/antigravityAuthSupport.test.ts
The transform passes through nonmatching bytes and buffers candidate authentication lines. It processes completed and final partial authentication lines, and reports an invalid sign-in URL error when a candidate exceeds the browser-helper line limit. Tests cover a 17 MiB protocol message, following JSON, authorization URL capture, partial prefix matches, and an oversized unfinished authentication line.

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

Change: Bug fix

Suggested reviewers: juliusmarminge, mameli

Merge Risk: Minimal · up to 2780a

Large Antigravity protocol messages are now streamed through instead of failing at 16 MiB, and sign-in line handling stays bounded. No actionable merge risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: large stdout protocol lines are now streamed instead of failing at the 16 MiB limit. It follows the conventional commit format and matches the raw summary, which says …
Description check Passed The description follows the template. It has Problem, Change, Scope, and Verification sections, each filled with specific content. The Problem section gives the failure, the reproduction context, and …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: large stdout protocol lines are now streamed instead of failing at the 16 MiB limit. It follows the conventional commit format and matches the raw summary, which says the 16 MiB protocol-line limit was removed and replaced by streaming pass-through.

Full details: Description check

Explanation

The description follows the template. It has Problem, Change, Scope, and Verification sections, each filled with specific content. The Problem section gives the failure, the reproduction context, and the expected behavior. The Change section explains the 3-state streaming prefix matcher and the bounded auth line limit. The Scope section explains why no issue is linked and cites CONTRIBUTING.md. The Verification section lists the commands run, their results, and what was not run. It also names the model and harness, as the template asks. The Scope section does not link an issue, but it gives a reason, which the template allows for small obvious fixes.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 94d7987 and 2780adb.

Files selected for processing: 1

  • apps/server/src/provider/antigravityAuthSupport.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.

@imetn

imetn commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

+1 — hit this exact issue in a long-running iOS development thread using Antigravity ACP (agy 1.5.20, macOS 26.6.2).

After several xcodebuild runs, individual tool step outputs persisted in Antigravity's native conversation history reached 16–26.7 MiB. Once the ACP runtime restarted and T3 Code issued session/load, the replayed JSON-RPC line exceeded maxStdoutLineBytes (16 MiB) in antigravityAuthSupport.splitStdoutLines and terminated the stream:

[11:07:49Z] antigravityAuthSupport.splitStdoutLines -> Failure
  AcpTransportError: ACP transport operation failed: Antigravity sent a protocol line that is too large.

[11:07:48Z] session/load -> Failure
  ~effect/rpc/RpcClientError: RpcClientDefect: ACP protocol terminated.

[11:07:42Z] AcpAdapterV2.startTurn -> Failure
  ProviderAdapterTurnStartError: Failed to start run <run-id> on antigravity provider thread <provider-thread-id>.
  cause: { _tag: "AcpTransportError", detail: "Antigravity sent a protocol line that is too large." }

I verified locally that switching makeAntigravityStdoutTransform to stream non-auth lines without buffering past the 56-byte ANTIGRAVITY_AUTH_STDOUT_PREFIX (while keeping auth lines bounded) cleanly unblocks session/load on 20+ MiB JSON-RPC lines. Would love to see this merged!

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

size:L 100-499 changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants