Skip to content

fix(protocols): account for Antigravity direct Chat IR - #7724

Merged
lidge-jun merged 3 commits into
lidge-jun:devfrom
luvs01:fix/antigravity-direct-chat-retained-budget-20261025
Oct 26, 2026
Merged

lidge-jun merged 3 commits into
lidge-jun:devfrom
luvs01:fix/antigravity-direct-chat-retained-budget-20261025

Conversation

@luvs01

@luvs01 luvs01 commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Charge retained conversation IR to the shared translation-buffer budget on the Antigravity direct Chat Completions path. Previously, the settings-only projection omitted this retained conversation from hard accounting, including reasoning data that expands during decoding.

Over-budget requests now receive HTTP 413 with translation_buffer_limit before adapter dispatch. The normal direct and bridge flows, budget disposal and refusal logging keep their existing contracts. This measures retained serialized bytes after decoding; it does not claim to prevent the initial decode allocation or impose a heap-size cap.

The protocol guide documents the direct Chat rejection.

Verification

Candidate: 1b42fc6c577c04ee9752c471b4f3d4ac79f92520, a normal integration with dev 8ebe46b2. Runtime and test runner are Bun 1.4.4.

  • Direct Chat regression file: 16 passed / 153 assertions, including ordinary direct/bridge behavior and oversized-IR rejection with zero upstream dispatches.
  • Removing only the new retained-IR charge made the new handler case fail at the expected 413 assertion (observed 502). The fixed run also checked the error code and zero upstream dispatches. The original source bytes were restored and matched the committed blob before final checks.
  • The isolated Desktop compatibility regression file passed 62 tests / 361 assertions, including the stop/start case that failed in an earlier CI run. This single passing observation does not establish the cause or resolution of that earlier port-rebind failure.
  • Reference TypeScript, structure, scoped privacy/file-size and committed-diff checks passed. All nine execution units, including the expected-failing counterfactual, have explicit native exits and both output streams completed.
  • Independent source review found no concrete bypass or regression.
  • Documentation validation completed with a frozen lockfile: 593 pages built / 84,872 internal links checked. The generated HTML contains the retained-IR, HTTP 413 and pre-upstream rejection description.

The full local suite has not been rerun during the shared Windows validation queue; focused behavior checks are mandatory and broader platform coverage remains with CI. No real provider requests, installed application, account, certificate trust store or global configuration were changed.

Checklist

  • Changed direct Chat admission and normal behavior have focused coverage.
  • Counterfactual rejection and independent review are documented.
  • Documentation build and final local gates passed with their scope documented.
  • Exact-head CI 40193487288 passed. Hosted Windows/macOS lanes were skipped by CI selection; the local Windows evidence above is separate.
  • Required maintainer review before merge.

Summary by CodeRabbit

  • Bug Fixes
    • Direct Chat requests with very large conversations are now rejected with a clear error when they exceed the translation size limit.
    • Requests rejected for exceeding this limit are stopped before being sent to the upstream provider.

@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 8ebe46b and 1b42fc6.

Files selected for processing: 3
  • docs-site/src/content/docs/guides/protocol-paths.md
  • src/server/chat-completions.ts
  • tests/responses/protocol-antigravity-direct-chat.test.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.

Walkthrough

The direct Chat lane now counts the retained decoded conversation toward the translator budget. If the size exceeds the budget, the request receives HTTP 413 with translation_buffer_limit before reaching an upstream provider.

Changes: Direct Chat budget enforcement

Layer / File(s) Summary
Charge retained conversation and reject overflow
src/server/chat-completions.ts, tests/responses/protocol-antigravity-direct-chat.test.ts, docs-site/src/content/docs/guides/protocol-paths.md
The direct Chat lane charges the retained IR conversation’s UTF-8 JSON size as a request copy. A regression test checks that a 12 MiB reasoning_content value returns HTTP 413 with translation_buffer_limit and sends no upstream request. The guide documents this behavior.

Priority: Normal

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

Change: Bug fix

Merge Risk: Minimal · up to 1b42f

The direct Chat budget enforcement has no established merge-blocking risk.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "fix(protocols): account for Antigravity direct Chat IR" names the main change: retained decoded conversation IR on the Antigravity direct Chat path is now charged against the shared transla…
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 "fix(protocols): account for Antigravity direct Chat IR" names the main change: retained decoded conversation IR on the Antigravity direct Chat path is now charged against the shared translation-buffer budget. The changeset adds that charge in src/server/chat-completions.ts, documents it in the protocol-paths guide, and adds a regression test for the 413 translation_buffer_limit refusal. The title is specific and concise, and it uses the same terms as the objectives. It is somewhat terse, since "account for" does not say that over-budget requests are refused with HTTP 413, but that detail is not required in a title.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Oct 25, 2026
@luvs01
luvs01 marked this pull request as ready for review October 25, 2026 12:49

@Ingwannu Ingwannu left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Reviewed the complete three-file diff at 1b42fc6c577c04ee9752c471b4f3d4ac79f92520. Independent official Bun 1.4.4 run with matching frozen dependencies/private homes and cgroup caps: bun test --isolate tests/responses/protocol-antigravity-direct-chat.test.ts -> 16 pass, 0 fail, 153 assertions. The new oversized reasoning case returns 413 translation_buffer_limit with zero upstream sends; the existing direct/bridge Chat response and policy controls also pass.

The direct conversation is retained outside the settings-only core projection, so charging it separately closes the accounting gap without changing routing. This measures retained serialized IR after decoding; it is not a pre-allocation or total-heap ceiling, and the updated public contract does not claim one. Existing shared budget ownership/finalization stays in place.

Exact-head Cross-platform CI 40193487288, Typecheck and docs-site build succeeded; current review threads were empty and no maintainer objection was present. The focused regression file was used under the documented resource exception rather than repeating the full local suite; hosted CI supplies broader evidence. No real Google account, model request or Codex Security scan was used.

@lidge-jun

Copy link
Copy Markdown
Owner

Maintainer dev integration record (release 2.93 dev-merge loop).

  • Exact head: 1b42fc6, approved by @Ingwannu at that head; 0 unresolved review threads.
  • Required CI on the exact head: CI run 40193487288 (gates, test 1/4–4/4, docker smoke, npm-global, api usage, storage policy, docs site build: pass), PR gates run 40195048323 (enforce-target: pass), Catalog async contracts 40193487308: pass.
  • Base: origin/dev 8ebe46b at merge time; mergeStateStatus CLEAN. Changed files are under the file-size ratchet threshold and do not overlap other queued landings.

@lidge-jun
lidge-jun merged commit 88f7a77 into lidge-jun:dev Oct 26, 2026
38 of 39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants