Skip to content

fix(drift): accept Gemini's current unauthenticated response in the PR delta gate - #609

Merged
jpr5 merged 1 commit into
mainfrom
fix/drift-gemini-auth-retained-policy
Nov 10, 2026
Merged

jpr5 merged 1 commit into
mainfrom
fix/drift-gemini-auth-retained-policy

Conversation

@jpr5

@jpr5 jpr5 commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Problem

drift-live-pr > "Delta gate" throws Unexpected retained-policy Gemini gateway response on PRs. It failed on #605 and on both attempts of #606 (run 42697621424). The same classifyNative check also runs in the scheduled job.

The gate allowed only one exact real Gemini unauthenticated body. Google's gateway now returns two bodies, and they alternate:

Old (seen Nov 7 10:07 PM PST scheduled, and again Nov 9 10:30 PM PST in run 42768299471):

{"status":403,"body":{"error":{"code":403,"status":"PERMISSION_DENIED","message":"Method doesn't allow unregistered callers (callers without established identity). Please use API Key or other form of API consumer identity to call this API."}}}

New (seen in run 42697621424 attempts 1 and 2 on Nov 9 at 1:01 PM and 1:13 PM PST, and in the scheduled run 42766538763 on Nov 9 at 10:13 PM PST):

{"status":403,"body":{"error":{"code":403,"status":"PERMISSION_DENIED","message":"Permission denied on the service.","details":[{"@type":"type.googleapis.com/google.rpc.ErrorInfo","reason":"ACCESS_DENIED","domain":"googleapis.com","metadata":{"service":"generativelanguage.googleapis.com"}},{"@type":"type.googleapis.com/google.rpc.LocalizedMessage","locale":"en-US","message":"Permission denied on the service."}]}}}

The status, error.code, and error.status did not change. The new body has a different message and adds error.details.

Fix

The gate now accepts exactly these two documented bodies (deep-equal) and nothing else. aimock's local 401 UNAUTHENTICATED contract stays the same, and so does the retained Gemini native authentication / inbound policy divergence entry.

Red/green (real gate script extracted from the workflow, run on the captured run artifacts in delta mode)

Artifacts main this PR
#606 attempt 1 (new body) Error: Unexpected retained-policy Gemini gateway response, exit 1 Drift gate PASSED, exit 0
#606 attempt 2 (new body) same throw, exit 1 Drift gate PASSED, exit 0
run 42768299471 (old body) PASSED, exit 0 PASSED, exit 0
any of the above, mutated to status 500 or given an extra error key — throws, exit 1

src/__tests__/native-cursor-workflow.test.ts gets new cases that run the real workflow gate. The current body is accepted in scheduled and delta modes; this fails on main and passes here. A server error, an extra error key, or a changed message is still rejected.

…R delta gate

Google's gateway now alternates between two exact 403 PERMISSION_DENIED bodies
for unauthenticated Gemini calls: the old 'Method doesn't allow unregistered
callers' message, and 'Permission denied on the service.' with an error.details
array (ErrorInfo ACCESS_DENIED + LocalizedMessage). The retained-policy check
only accepted the first, so drift-live-pr threw on every PR once the second
appeared. Accept exactly those two bodies; aimock's local 401 contract and the
retained divergence are unchanged.
@pkg-pr-new

pkg-pr-new Bot commented Nov 10, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@copilotkit/aimock@609

commit: f47d3d1

@jpr5
jpr5 merged commit 97fee20 into main Nov 10, 2026
37 checks passed
@jpr5
jpr5 deleted the fix/drift-gemini-auth-retained-policy branch November 10, 2026 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant