Repository navigation
feat(protocols): Antigravity direct lane for Messages, on by default - #7081
Conversation
…routes The Messages ingress plans the Antigravity direct lane before translating: the settings-only body carries the resolved model, prompt-cache key and reasoning settings, the route is previewed on that model, and the conversation is decoded into the IR (messages-ir.ts) only for an eligible route. Routing then settles on the same body; if it moves, the full bridge translation replaces it. Refs #7079.
protocols.rollout.antigravityDirect now defaults on for the Chat and Messages ingresses. An explicit false turns it off; a non-boolean value or a malformed protocols block fails closed. Requests the eligibility rule declines keep the bridge as before.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
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. Comment |
|
✅ Deterministic PR hygiene checks passed. |
A plan the ingress abandons (an undecodable envelope the bridge retries, or a settled route that moved) released none of the reasoning copies its decode retained, so the bridge translation that followed could answer 413 where the bridge alone fits. The decode now records its retained charges and the plan releases them when it is left.
…the plan leaveDirectPlan charged the full translation without handing back the retained charge for the settings-only body it replaced, so a route that settled off the plan (a per-model wire override, say) could answer 413 where the bridge alone fits. It also dropped the stale replay map.
|
Maintainer integration into |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 65b535f172
ℹ️ 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".
| bridgeConversation: () => { | ||
| bridge ??= messagesToResponsesTranslation(body, cc, budget).body; |
There was a problem hiding this comment.
Transfer decode charges when materializing the bridge
For a reasoning-heavy Messages request, planMessagesAntigravityDirect has already charged every encoded reasoning envelope through the recording budget, but this lazy fallback translates the same envelopes again and charges them a second time without calling plan.releaseDecodeCharges(). If the core invokes bridgeConversation() after a reroute or while judging an ambiguous pre-header reset, a request that fit through the old bridge can therefore exceed the 32 MiB translator budget and fail instead of rerouting/retrying. Transfer or release the direct decode's retained charges when the bridge representation becomes the retained owner, and cover the lazy fallback path with a near-limit regression test.
AGENTS.md reference: src/AGENTS.md:L17-L17
Useful? React with 👍 / 👎.
Summary
Refs #7079. Follows #7080 (the Chat half, now on
dev).Messages to Antigravity skips the internal Responses body. Before this PR, a
/v1/messagesrequest to a single Google Antigravity route was translated to a Responses body and parsed again:messages -> responses-internal -> ir -> other. Now it goesmessages -> ir -> other, and the answer goesother -> ir -> messagesthrough the existing PF-09 Messages encoder.The Messages ingress picks its route from the translated body's resolved model, so the lane has to be planned before translation:
anthropicSettingsTranslationbuilds the bridge body's settings withinput: []. One sharedapplyAnthropicSettingsbuilds both bodies, so the resolved model, the prompt-cache key (still hashed from system text plus translated tools in wire order), sampling, tool choice, format,includeand reasoning match.antigravityMessagesDeclineReason. Only then doesmessagesConversationToIr(src/protocols/codecs/messages-ir.ts) decode the conversation into the IR.leaveDirectPlanswaps in the full translation before any route-specific shaping. The core seam from feat(protocols): Antigravity direct lane for Chat (no internal Responses hop) #7080 (directRequest,leaveDirectLaneIfRerouted, restore and the ambiguous-reset judgment) covers later reroutes.nativeAnthropicProjection), yields no plan. Those requests translate and refuse exactly as before. Any other decode error carries the translator walk's own message.Reproduced, not declined: blocked-skill elision, the
stabilizePromptCacherelocation and its trailing notice, tool_result errors, images, documents andtool_referencemarkers, thinking and redacted thinking (envelopes encoded and charged against the translator budget as the translator does, then decoded as the parser does), and the native reasoning replay map.Declined, keeping the bridge with a named reason:
hosted-tool(aweb_search_*tool or a forced WebSearch choice),vision-preprocessing,bridge-only-policy(the shadow intercept on the resolved model, a skills catalog in system text, a generated-image link in assistant history, an observing cache recorder) andcombo-or-policy-route.Default flipped (owner request):
protocols.rollout.antigravityDirectnow defaults on for both the Chat and Messages lanes. An explicitfalseturns it off, and a non-boolean value or a malformedprotocolsblock fails closed. Every declined request still falls back to the bridge per request. The docs, the CLI help text and the generatedskills/ocxmap say so.Route map for Messages, eligible concrete Antigravity route:
messages -> responses-internal -> ir -> othermessages -> ir -> otherother -> ir -> responses-internal -> messages(other -> ir -> messagesonly withdirectEncoders)other -> ir -> messagesResidual gaps:
thoughtSignatures. Changing that is an adapter change and out of scope._rawBodyreaders that matter only to other wires see an empty conversation, which is why the lane is limited to this route.Verification
This host does not run tests locally (owner rule for this machine), so hosted CI is the test evidence. Commands run locally:
bun x tsc --noEmit: passbun run structure:check: pass (protocol-paths.mdsits exactly at its 600-line budget)bun run privacy:scan: passbun run skill:surface:check: passNew or changed tests, left to CI:
tests/responses/protocol-messages-ir-parity.test.ts: the direct parse equalsparseRequest(anthropicToResponsesTranslation(body).body)over a corpus covering media, tool results, every envelope kind (sig,txt,red,natfor own and other model,krc), skill elision, cache stabilization, the tool catalog and settings. Refusals match message for message. It also checks that the settings body equals the bridge body without its conversation, that routing evidence matches, and that feature effects are unchanged.tests/responses/protocol-antigravity-direct-messages.test.ts: end to end against a fake Cloud Code Assist upstream. Requires the same wire body and the same answer, stream and non-stream, and themessages -> ir -> othertrace. Also covers a declined case and an identical refusal.protocol-antigravity-direct-eligibility.test.ts: Messages rules plus the new default.protocol-settings.test.ts: the default and fail-closed cases. Both e2e tests now turn the switch off explicitly for their bridge side.Checklist
Review rounds
protocol-messages-ir-parity.test.ts.leaveDirectPlannever released the settings-only body'srequest_copiescharge. Fixed in the next commit, which also drops the stale replay map. That ingress path (a preview that is Antigravity but settles on another wire) has no dedicated test; the fix is a two-line release beside the existing charge.