Repository navigation
test: accept Vertex stream interpreter anomaly; keep measuring after rejections - #526
Merged
Merged
Conversation
Live k5 measurement (2026-10-11, exact drift request) showed the interpreter anomaly in stream mode as two chunks: the call, then a MAX_TOKENS terminal with one empty text part (32/60 runs). The first city also varies: 59 Tokyo, 3 London over 120 k5 runs. Accept exactly those shapes on the native leg only. The modeled leg stays strict, and other terminals, names, cities, or extra output are still rejected. Adds the sha256-pinned CI run 38158387279 capture and two London captures.
The recurrence runner stopped at the first failed case, so a rejection in k5-stream left k9-object and k9-stream UNATTEMPTED and hid their live behavior until a later CI run. A complete HTTP 200 that the comparator rejects is now recorded as that case's FAILURE and the run continues. HTTP, transport, and byte-bound failures still stop before another send. Per-case assertions and the 4-send / 160-token budget are unchanged.
commit: |
…maly The stream check counted parts across chunks, so an empty first chunk with the call and text in the terminal, or the call and text in the first chunk with an empty terminal, were wrongly accepted. Require chunk 1 to carry only the call and chunk 2 (MAX_TOKENS) exactly one empty text part, with mutants for each misplacement. Also document that the K5 prompt names no cities, so the accepted first-city codes stay observation-only.
jpr5
added a commit
that referenced
this pull request
Oct 11, 2026
## What The Vertex K5 interpreter-anomaly check in `src/__tests__/drift/vertex-misbehavior.drift.ts` matched only two first cities, Tokyo and London. Those are the cities seen live in #526. The K5 prompt ("Call archive with an array of 200 distinct full city names...") names no cities, so any first city is legitimate. A city not in the list would raise a false drift alert. The check now matches `/^print\(default_api\.archive\(cities=\['[^'\\\n\r]*[^'\\\s][^'\\\n\r]*$/`. That is the archive prefix and one unfinished city with no quote, backslash or newline, and not blank. All 63 interpreter anomalies in the 161 live captures from 2026-10-11 have exactly this shape (60 Tokyo, 3 London). None has more than one city. Everything else is unchanged: the `google:python_interpreter` call name, exactly one argument, no extra call fields, the two-chunk stream position rules, the MAX_TOKENS terminal with empty text, and native leg only. A short comment at the check explains why any city is accepted and what is still enforced. ## Tests - New: Paris variants (stream and object) are accepted on the native leg and rejected on the modeled leg. - Removed: the "unobserved first city is rejected" mutant. That behavior is intentionally gone. - New mutants that must fail: empty city (`cities=['`), empty quoted city (`['']`), whitespace-only city (`[' `), a finished call (`['Tokyo'])`), trailing code (`['Tokyo'] + x`), leading code before the call, a non-archive tool in the code (`default_api.search(...)`), and a different prefix (`archive(names=[...`). The existing mutants still fail: extra argument, extra call field, non-interpreter name, the declared archive tool, chunk placement. - Regex mutation check: using `\S` for the required character (it can match the closing quote), removing either anchor, or making the city optional each fails at least one test. Removing `origin === "native"` fails 7 modeled-leg tests. - Replay of all 161 live captures through the classifier: same verdict for every capture before and after the regex change, 0 rejected, 63 interpreter anomalies. ## Local red/green RED (Tokyo/London list, Paris variants): ``` AssertionError: contradictory-target: K5 tool or thought Tests 2 failed | 2 passed | 108 skipped (112) ``` RED for the tightening (prefix-only check, new negative tests): ``` Tests 4 failed | 108 passed | 4 skipped (116) ``` GREEN (final, full drift file): ``` Tests 113 passed | 4 skipped (117) ``` ## Live (`AIMOCK_VERTEX_LIVE=1`, gemini-2.5-flash, us-central1) Two consecutive runs on the final code, 4/4 cases run and passed each time: - Run 1: k5-object and k5-stream `approved-interpreter-anomaly`; k9-object and k9-stream `visible-answer-completion`. - Run 2: k5-object and k5-stream `approved-interpreter-anomaly`; k9-object `reasoning-only-exhaustion`, k9-stream `visible-answer-completion`. ## Gates `pnpm typecheck`, `pnpm lint`, `pnpm format:check`, `pnpm build` and `pnpm test` (377 files, 14079 passed) all pass.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Drift Tests run 38158387279 (main @ 9420afa) failed
k5-streamwithFAILURE / MAX_TOKENS / WIRE_OR_SDK_REJECTED. Vertex streamed the known interpreter anomaly as two chunks: agoogle:python_interpretercall, then aMAX_TOKENSterminal with one empty text part. The suite only accepted that anomaly in object mode.k9-objectandk9-streamwere thenUNATTEMPTED(earlier-case-failed), so we could not see their live behavior.Live measurement (2026-10-11, llmock-drift-testing / us-central1 / gemini-2.5-flash, exact drift request bytes)
content: {}Before this change, k5-stream was rejected in 32 of 60 runs. After it, all 161 captures are accepted (the 160 local captures plus the CI capture).
Changes (
src/__tests__/drift/vertex-misbehavior.drift.tsonly)MAX_TOKENSterminal with exactly one{text: ""}part. Accepts the first-city codesTokyoandLondon, both observed live. The K5 prompt names no cities (it asks for "200 distinct full city names"), so there is no list to derive from the request. The accepted list comes from observation only, and any other city is still rejected. The modeled leg stays strict. Other terminals, function names, cities, args and call fields, and any thought, non-empty or extra parts, are still rejected.FAILUREand the run continues to the remaining cases. HTTP, transport and byte-bound failures still stop the run. The per-case assertions and the 4-send / 160-token budget are unchanged.Red / green
6c4382…87a5) and the London captures are rejected withcontradictory-target: K5 tool or thought, the same rejection as CI. The recurrence stopped after 2 requests. Result: 4 failed / 93 passed.archivetool; non-empty text; a thought part; an extra part; an unobserved city; an extra arg; an extra call field; a second call; call and text merged into one chunk; an empty first chunk with the call and text in the terminal; the call and text in the first chunk with an empty terminal; the call in the terminal with the text in the first chunk.AIMOCK_VERTEX_LIVE=1, ADC token, same project): the file passed 5 consecutive times, 103/103 each time. All 4 cases ran every time, with none UNATTEMPTED. The stream anomaly was accepted live in runs 3 and 4. After the positional fix, 2 more consecutive live passes ran (106/106 each, all 4 cases run), and the stream anomaly was accepted live in both.Gates
pnpm typecheck,pnpm lint,pnpm format:check,pnpm buildandpnpm testall pass (377 files, 14073 tests).