Skip to content

feat(protocols): Antigravity direct lane for Chat (no internal Responses hop) - #7080

Merged
lidge-jun merged 4 commits into
devfrom
feat/antigravity-direct-protocols
Oct 13, 2026
Merged

lidge-jun merged 4 commits into
devfrom
feat/antigravity-direct-protocols

Conversation

@lidge-jun

@lidge-jun lidge-jun commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

Summary

Closes the Chat half of #7079.

A Chat Completions request routed to Google Antigravity used to be translated twice in each direction: Chat body → internal Responses body (serialized and replayed as POST /v1/responses) → IR → Google wire, and back through Responses SSE unless directEncoders was on. Antigravity's google adapter has the other wire, so neither native lane could take it.

With the new rollout switch protocols.rollout.antigravityDirect (default off), an eligible Chat request to one concrete Antigravity route goes chat → ir → other and back other → ir → chat:

  • Request. The ingress decodes the conversation straight into the IR with chatConversationToIr (src/protocols/codecs/chat-ir.ts) and gives the Responses core only the request settings (chatSettingsToResponsesBody: input: [], no instructions/tools). The bridge body and the settings-only body come from one applyChatSettings, so settings and their validation can't drift. Routing, Antigravity account rotation and failover, effort pins and caps, tier, spend, usage and logging still read the same settings in the same places. At the parse seam, directRequest.decode replaces the empty conversation.
  • Response. The lane always uses the PF-09 direct Chat encoder, with requestLane: "direct" in the trace.
  • Declines (named on the log row): combo or policy route, hosted web_search tool (sidecar), image for a text-only model (vision preprocessing), a model the shadow-call intercept could rewrite, text the core rewrites on the bridge body (a <skills_instructions> catalog, a generated-image link), and an observing cache diagnostic recorder. If a route assignment ever leaves Antigravity after the ingress decided, the bridge conversation is restored onto the raw body right there, before sanitization or injected guidance can touch it. Ambiguous-resend replay is judged on the body the bridge would have sent.
  • Vocabulary. path.ts gains a direct lane (only toward other). features.ts gives the direct decode hop the chat>responses dispositions, so unrepresentable: reject refuses the same features on both paths. The planner predicts the lane through the same eligibility rule.

Responses ↔ Antigravity was already direct (parseRequest, bridgeToResponsesSSE). Messages → Antigravity stays on the bridge for now. Its settings depend on the conversation (the prompt-cache key hashes system text and tools), and it carries ocxr1 reasoning envelopes, so it follows as a stacked PR. The design, the route map and the earlier records this mirrors (#6559, #6562, #6790, #5918, PF-09) are in devlog/_plan/261014_antigravity_direct_protocols/000_plan.md.

References studied, not added as dependencies: router-for-me/CLIProxyAPI @ bf934162 (pairwise translators; Chat and Claude direct to Antigravity, Responses via Gemini) and Wei-Shaw/sub2api @ 4d9ac3e4 (Anthropic as pivot; Chat goes Chat → Responses → Anthropic → Gemini).

No files from #7071 (feat/argon-model: model list, CLI headers, google.ts, google-antigravity-wire.ts) are touched.

Verification

This host runs no local tests by policy, so the new suites first run in hosted CI.

  • bun x tsc --noEmit: pass. The new and edited test files also typecheck under a scratch config that includes them. The only error there is pre-existing, in scripts/test-temp-lock.ts.
  • bun run structure:check: pass. bun run privacy:scan: pass.
  • New tests, left to CI:
    • tests/responses/protocol-chat-ir-parity.test.ts compares the lane's full parsed request (minus _rawBody and timestamps) with parseRequest(chatCompletionsToResponsesBody(body)) over a corpus covering every branch of the walk. It also checks that refusals match by message, and that routing evidence and feature effects match the bridge.
    • tests/responses/protocol-antigravity-direct-eligibility.test.ts covers each decline reason and the planner's direct path.
    • tests/responses/protocol-antigravity-direct-chat.test.ts sends the same Chat request, streaming and not, to a fake Cloud Code Assist upstream on both lanes. It requires an identical wire body (minus the random requestId), an identical client answer, and the chat → ir → other trace, and checks a declined request's reason.
    • tests/config/protocol-settings.test.ts gains the new default.
  • The full suite was not run locally (host policy); hosted CI covers it.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

Summary by CodeRabbit

  • New Features

    • Added the default-off antigravityDirect option for eligible Chat requests to a single Google Antigravity route. When enabled, requests and responses can use a direct protocol path without an internal Responses body.
    • Requests that don’t meet eligibility requirements, including Messages requests and combo routes, continue through the existing bridge path.
  • Documentation

    • Updated protocol-path and configuration guides with rollout behavior and eligibility details.
  • Tests

    • Added coverage for direct-path behavior, eligibility, and parity with the existing bridge path.

Behind protocols.rollout.antigravityDirect (default off), a Chat request whose settled route is one concrete Google Antigravity provider no longer goes through the internal Responses body. The ingress validates and decodes the conversation with chatConversationToIr and hands the Responses core only the request settings (chatSettingsToResponsesBody, built by the same applyChatSettings as the bridge body). The decoded conversation replaces the settings-only parse at the parse seam; the answer uses the direct Chat encoder. The trace reads chat -> ir -> other both ways.

The lane is held to the bridge it replaces: the parsed request equals parseRequest(chatCompletionsToResponsesBody(body)) apart from _rawBody and timestamps, refusals match, and the Google wire body is identical. A route that leaves Antigravity after the ingress decided gets the bridge conversation restored before any other reader sees the raw body.

Refs #7079
@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Repository: lidge-jun/opencodex/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 12964307-e09a-47cd-b3d0-1e97236b46b6
📥 Commits

Reviewing files that changed from the base of the PR and between 2acdb92 and 339558d.

📒 Files selected for processing: 31
  • devlog/_plan/260924_protocol_first_class/040_acceptance_and_rollout.md
  • devlog/_plan/261014_antigravity_direct_protocols/000_plan.md
  • docs-site/src/content/docs/guides/protocol-paths.md
  • docs-site/src/content/docs/reference/configuration/server.md
  • scripts/test-layout/layout.json
  • src/chat/inbound.ts
  • src/config/schema/config-schema.ts
  • src/protocols/codecs/chat-ir.ts
  • src/protocols/codecs/chat.ts
  • src/protocols/features.ts
  • src/protocols/path.ts
  • src/protocols/plan-snapshot.ts
  • src/protocols/plan.ts
  • src/protocols/settings.ts
  • src/responses/parser.ts
  • src/server/antigravity-direct-eligibility.ts
  • src/server/chat-completions.ts
  • src/server/inference/client-encoder-delivery.ts
  • src/server/management/protocol-settings-patch.ts
  • src/server/request-log.ts
  • src/server/responses/adapter-dispatch.ts
  • src/server/responses/core-options.ts
  • src/server/responses/request-prepare.ts
  • src/types/config.ts
  • src/usage/cache-diagnostic.ts
  • structure/data-planes/protocol-paths.md
  • tests/config/protocol-settings.test.ts
  • tests/fixtures/test-layout-expected.json
  • tests/responses/protocol-antigravity-direct-chat.test.ts
  • tests/responses/protocol-antigravity-direct-eligibility.test.ts
  • tests/responses/protocol-chat-ir-parity.test.ts
 _______________________________________________
< CodeRabbit: Because Jarvis was already taken. >
 -----------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • 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 enhancement New feature or request label Oct 13, 2026
…under rewrites

Address independent review of the first head:
- decline when the core would rewrite conversation text on the bridge body (a skills catalog, a generated-image link) or the cache diagnostic recorder is observing;
- restore the bridge conversation right after every route assignment, before sanitization, ciphertext stripping and injected guidance can touch the raw body;
- judge ambiguous-resend replay on the body the bridge would have sent;
- predict the lane only for standalone routes, not combo children;
- skip an own __proto__ parameter key as the schema parse does;
- rename the eligibility test so its seed domain matches its registration.

Refs #7079
…record

The cache diagnostic hook is registered whenever its module loads; recording is gated by
OPENCODEX_CACHE_DEBUG. Checking registration alone declined every request and made the lane
unreachable. The hook now reports its enabled state.

Refs #7079
@lidge-jun
lidge-jun marked this pull request as ready for review October 13, 2026 19:34
@lidge-jun
lidge-jun requested a review from Ingwannu as a code owner October 13, 2026 19:34
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T19:41:20.713290Z 339558d Draft marked ready
ℹ️ 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.

@lidge-jun
lidge-jun merged commit 9b31677 into dev Oct 13, 2026
36 of 37 checks passed
@lidge-jun
lidge-jun deleted the feat/antigravity-direct-protocols branch October 13, 2026 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant