Skip to content

Commit 9dbc5fc

Browse files
authored
Merge pull request #1921 from lidge-jun/codex/wave5-wp0-wp1
fix(google): allow AI Studio bare Gemini Flash IDs (#1894) + Wave 5 roadmap
2 parents f64c063 + 75b4c29 commit 9dbc5fc

18 files changed

Lines changed: 907 additions & 12 deletions
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# 260817 Wave 5 execution — research and Gate 0 baseline
2+
3+
Campaign: execute the Wave 5A/5B/5C/5D + Wave 6 roadmap produced by the
4+
2026-08-17 external audit, landing each item on `dev`, then promoting to
5+
`preview` and `main`.
6+
7+
## Gate 0 baseline (verified 2026-08-17)
8+
9+
| Fact | Value | Evidence |
10+
|------|-------|----------|
11+
| local `dev` head | `1208bd25c` | `git rev-parse HEAD` after `--ff-only origin/dev` (44 commits fast-forwarded) |
12+
| #1881 merge ancestry | present | `git merge-base --is-ancestor bb984ad47 HEAD` → exit 0 |
13+
| #1909 ancestry | present | `b1708acc4 Merge pull request #1909` reachable |
14+
| stable release | v2.24.2 | `origin/main` = `474584bcd Merge pull request #1914 from lidge-jun/release-2.24.2` |
15+
| working tree | clean | `git status --porcelain` empty |
16+
17+
## Roadmap PR inventory at exact head
18+
19+
| PR | head | draft | review | checks | Wave |
20+
|----|------|-------|--------|--------|------|
21+
| #1899 | `8ab0aa8d0` | no | REVIEW_REQUIRED | 15 success | 5A |
22+
| #1876 | `d5acd7414` | no | CHANGES_REQUESTED | 22 success, 1 skipped | 5A |
23+
| #1888 | `cd3367193` | no | CHANGES_REQUESTED | 10 success | 5B |
24+
| #1902 | `b8983c912` | no | REVIEW_REQUIRED | 10 success | 5B |
25+
| #1884 | `99b0bbc38` | no | REVIEW_REQUIRED | 25 success | 5B |
26+
| #1892 | `6b17d6233` | no | REVIEW_REQUIRED | 9 success | 5B |
27+
| #1904 | `c603dcd83` | yes | REVIEW_REQUIRED | 6 success, 1 cancelled | 5B |
28+
| #1898 | `7279aca7c` | yes | REVIEW_REQUIRED | 21 success, 1 cancelled | 5B |
29+
| #1900 | `1824a0148` | no | REVIEW_REQUIRED | 10 success | 5C |
30+
| #1895 | `8a4040384` | yes | CHANGES_REQUESTED | 12 success | 5C |
31+
| #1887 | `ed4e87753` | yes | REVIEW_REQUIRED | 4 success | 5C |
32+
| #1896 | `5d2aec482` | yes | REVIEW_REQUIRED | 7 success | 5C |
33+
| #1903 | `54893ca6e` | no | REVIEW_REQUIRED | 10 success | 5C |
34+
| #1889 | `ea64418a3` | yes | REVIEW_REQUIRED | **5 failure**, 6 success | 5D |
35+
| #1891 | `10b88e155` | no | REVIEW_REQUIRED | 14 success | 5D |
36+
| #1897 | `38c25aed8` | no | REVIEW_REQUIRED | 24 success, 1 cancelled | 5D |
37+
38+
## Correction to the external audit (P-phase finding)
39+
40+
The audit's #1894 remedy — "split direct Google mapping from Antigravity CCA
41+
mapping" — describes a separation the tree **already has**:
42+
43+
- `src/adapters/google.ts` owns `GEMINI_DIRECT_WIRE_RENAMES` /
44+
`resolveDirectGeminiWireModelId()` for the direct AI Studio path.
45+
- `src/providers/antigravity-models.ts` owns `GEMINI_FLASH_WIRE_ID` /
46+
`ANTIGRAVITY_MODEL_ALIASES` for the CCA path.
47+
- `src/adapters/google.ts:395-399` already branches on provider family before
48+
choosing a resolver.
49+
50+
So the real defect is not a shared alias table. It is that
51+
`GEMINI_DIRECT_WIRE_RENAMES` is an **unconditional** rename applied to every
52+
direct Google deployment, while the rename is only true for some of them.
53+
Commit `a70bb78d4` added it from a live capture where bare ids 404'd and
54+
`-tiered` returned 200; #1894 reports the exact opposite from another account
55+
on the same day. Both reporters are credible and neither is universal.
56+
57+
PR #1739 already implements the correct shape: a provider-level
58+
`directGeminiWireRenames` boolean, defaulting to today's behavior. That makes
59+
the deployment difference configurable but still ships a default that 404s for
60+
the #1894 reporter.
61+
62+
Wave-5 decision: the default must stop guessing. See `010`.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# A-phase synthesis — round 1 (VERDICT: FAIL, 9 blockers)
2+
3+
An independent reviewer audited `000`-`090` against the tree at `1208bd25c`
4+
and live GitHub state. Verdict FAIL. Every blocker was re-verified by the main
5+
agent before disposition; all nine are accepted.
6+
7+
## Accepted blockers and their amendments
8+
9+
| # | Blocker | Disposition |
10+
|---|---------|-------------|
11+
| 1 | WP1's 404 retry has no host: AI Studio installs no `fetchResponse` (`google.ts:384`), so the adapter never sees a `Response`; the fetch is core-owned (`core.ts:3586`) | **Folded** — retry dropped entirely |
12+
| 2 | The retry is only safe in the pre-stream `recovery:` loop (`core.ts:3696`); the terminal-guard continuation (`core.ts:3960`) refetches mid-stream and would splice two upstream turns into one client stream | **Folded** — dropped; discovery replaces it |
13+
| 3 | Memo key `(provider, model)` is too coarse and could silently override an explicit operator `false` | **Folded** — identity-keyed, and config always wins |
14+
| 4 | #1739 is mis-scoped: real head `e1c7ec85e`, state CHANGES_REQUESTED/BLOCKED, and its diff also changes `messagesToGeminiFormat`'s identity argument — the subject of the open review finding | **Folded** — `010` rewritten with the real head and the identity change in the file map |
15+
| 5 | WP2 is not implementable for 2 of 3 files: no effects recorder in `dsh-writer-lock.test.ts` or `native-main-claim.test.ts`, both already carry #1881's guards, and #1899 is CONFLICTING/DIRTY | **Folded** — WP2 narrowed to one file; #1899 reclassified |
16+
| 6 | WP3's sentinel already exists (`app-server-processes.ts:372/377/392`) and `unknown` already exists (line 574); the plan described shipped work | **Folded** — WP3 narrowed to the one real gap |
17+
| 7 | WP4's durability fix targets `google-antigravity-replay.ts`, which never calls the remember API; the seam is `thought-signature-replay.ts:190` and already returns `durable` | **Folded** — retargeted, with a caller-discovery step |
18+
| 8 | WP4's key change silently invalidates the persisted store (`version: 2` at line 143 is keyed by `keyFor` output) | **Folded** — explicit version bump + migration decision |
19+
| 9 | Wave 5C has no rebase plan for `src/adapters/cursor/live-transport.ts`, which four PRs modify | **Folded** — rebase-and-recheck step added |
20+
21+
## Accepted medium findings
22+
23+
- 5B's ordering rationale was false: #1904 already bundles #1892's characterization
24+
tests verbatim (identical blob). Order kept, rationale corrected, rebase noted.
25+
- 5D should run `#1891 -> #1897 -> #1889`; the original order put the only
26+
red-CI PR first and held the train hostage to it.
27+
- `080` had two state facts inverted: **#1836 is already CLOSED** and
28+
**#1906 is OPEN (reopened)** — both verified via `gh`.
29+
- `git merge-base --is-ancestor` cannot verify merge *order*; once both are on
30+
`dev` each is an ancestor of the tip. Use `git rev-list --topo-order --first-parent`.
31+
- `bun run test` already runs `bun test --isolate` (`scripts/test.ts:144`), so
32+
`090` presented one command as two.
33+
34+
## The finding that changes the campaign shape
35+
36+
Blocker 2 is the important one. The proposed 404-triggered retry was the only
37+
*new* production mechanism in Wave 5A, and it cannot be built where the plan put
38+
it without either (a) touching the shared core recovery loop — which `AGENTS.md`
39+
gates behind the full suite — or (b) risking a mid-stream splice.
40+
41+
The alternative is strictly better: the repo **already** lists models per
42+
account (`src/oauth/index.ts:811`, `/v1beta/models?pageSize=1000`). Reading what
43+
the account actually advertises beats inferring from a 404, needs no request
44+
replay, and cannot distort the attempt log. The retry is dropped.
45+
46+
## Verified-correct plan claims (kept unchanged)
47+
48+
- The #1894 separation finding in `000` is confirmed real; the external audit's
49+
"split the tables" remedy is confirmed a no-op.
50+
- WP4's key-completeness finding is confirmed exactly right: `keyFor` uses 5
51+
fields where the sibling `reasoning-replay-cache.ts:65` uses 7.
52+
- WP3's two review blockers are confirmed live on #1876's head.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Merge-order corrections (folds blocker 9 + medium findings)
2+
3+
Amends `060`, `070`, `080`, `090` after the round-1 audit. Read alongside them.
4+
5+
## Verifying merge ORDER (correction to 060 and 090)
6+
7+
`git merge-base --is-ancestor` cannot verify order: once both PRs are on `dev`,
8+
each is an ancestor of the tip regardless of which merged first. Use
9+
`git rev-list --topo-order --first-parent dev` and compare merge-commit positions.
10+
11+
## Wave 5B (060)
12+
13+
Order `#1888 -> #1902 -> #1884 -> #1892 -> #1904 -> #1898` is kept, but the stated
14+
rationale was wrong. #1892 and #1904 both add the same two
15+
`fastwire-characterization-*.test.ts` files as **byte-identical blobs** — #1904
16+
already bundles the characterization suite. So "#1904 without #1892 has no
17+
baseline" is false.
18+
19+
The real consequence: after whichever lands first, the other is an add/add conflict
20+
or a no-op. Add an explicit rebase step between them and verify the surviving test
21+
file once, rather than assuming both apply cleanly.
22+
23+
## Wave 5C (070) — the conflict surface
24+
25+
`src/adapters/cursor/live-transport.ts` is modified by **four** PRs in one train:
26+
#1900, #1887, #1896, #1903. Further overlaps:
27+
28+
| Pair | Shared files |
29+
|------|--------------|
30+
| #1900 ∩ #1895 | `tool-definitions.ts` + its test |
31+
| #1900 ∩ #1896 | `src/responses/parser.ts` |
32+
| #1900 ∩ #1903 | `live-models.ts`, `cursor-hardening.test.ts` |
33+
| #1887 ∩ #1896 | five `native-exec*.ts` files |
34+
| #1887 ∩ #1903 | two docs files |
35+
36+
Every merge after the first will conflict textually. Mandatory per merge:
37+
rebase onto the new `dev`, re-run the focused Cursor suite, and only then merge the
38+
next. The #1887/#1896 consolidation removes one of the four, which is an additional
39+
reason to do it before #1903.
40+
41+
## Wave 5D (080) — reorder, and two inverted facts
42+
43+
Corrected order: **`#1891 -> #1897 -> #1889`**.
44+
45+
#1889 and #1891 both rewrite `src/adapters/client-fingerprint.ts` and its test, so
46+
they conflict either way — and #1889 is the only PR in the campaign with red CI
47+
(5 failing checks). Putting it first holds the whole train hostage to it.
48+
49+
State corrections, both verified with `gh`:
50+
51+
- **#1836 is already CLOSED.** `080`'s "close as superseded" is a no-op; the only
52+
remaining question is whether its unique tests were migrated.
53+
- **#1906 is OPEN (reopened).** `080` said it stays closed. Whether it should be
54+
closed depends on the undocumented-`v1internal` policy decision, which belongs
55+
to the user (see `090`).
56+
57+
## Wave 6 (090)
58+
59+
`bun run test` already runs `bun test --isolate` (`scripts/test.ts:144`), so the
60+
two commands `090` distinguished are one command. The remote-execution preference
61+
for the full suite stands on its own.
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# WP1 — #1894 direct Gemini wire id (Wave 5A-1) — rev 2 after audit
2+
3+
> Rev 2 folds audit blockers 1-4. The 404-triggered retry proposed in rev 1 is
4+
> **dropped**: AI Studio installs no `fetchResponse` (`src/adapters/google.ts:384`),
5+
> so the adapter can never observe the 404; the only hosts are the core pre-stream
6+
> recovery loop or the mid-stream terminal guard, and the latter would splice two
7+
> upstream turns into one client stream.
8+
9+
## Defect
10+
11+
`GEMINI_DIRECT_WIRE_RENAMES` (src/adapters/google.ts:58-61) unconditionally
12+
rewrites `gemini-3.7-flash` -> `gemini-3.7-flash-tiered` for every direct Google
13+
deployment. Two live captures disagree:
14+
15+
- `a70bb78d4` (2026-08-14): bare 404s, `-tiered` 200s.
16+
- #1894 (2026-08-16): bare 200s, `-tiered` 404s, `models.list` has no `-tiered` row.
17+
18+
Neither reporter is wrong; the spelling differs per account/rollout. A static
19+
default therefore breaks one population whichever value it takes.
20+
21+
## Decision (rev 2)
22+
23+
**Land #1739 only.** It is the whole of WP1's production change. No new
24+
mechanism ships in this work-phase.
25+
26+
#1739 real state: head `e1c7ec85e`, OPEN, `MERGEABLE/BLOCKED`,
27+
`reviewDecision=CHANGES_REQUESTED`. Its diff is larger than rev 1 recorded:
28+
29+
| #1739 change | Note |
30+
|---|---|
31+
| `resolveDirectGeminiWireModelId(modelId, applyRenames)` | the config gate |
32+
| new `googleMode === "vertex" ? parsed.modelId` branch | Vertex keeps requested identity |
33+
| `messagesToGeminiFormat(parsed, identityModelId)` signature change | **the open review finding** |
34+
| `identityModelId` split for CCA vs direct | stops the `-tiered` wire spelling leaking into the model identity line |
35+
36+
The identity split is a real second bug fix — without it the system prompt tells
37+
the model it is `gemini-3.7-flash-tiered`. The open reviewer finding is that the
38+
fix is applied too broadly across Google modes; that must be resolved before
39+
landing, not merged as-is.
40+
41+
## Deferred to its own work-phase: discovery-resolved spelling
42+
43+
The durable fix is to stop guessing and read what the account advertises.
44+
`src/oauth/index.ts:811` already issues `/v1beta/models?pageSize=1000` per
45+
provider. A later work-phase can resolve the wire spelling from that listing,
46+
keyed on destination + credential identity exactly as
47+
`src/responses/reasoning-replay-cache.ts:65` does, with an explicit
48+
`directGeminiWireRenames` value always winning over any inferred spelling.
49+
That is a separate PABCD cycle, not a rider on #1739.
50+
51+
## File change map (WP1 as executed)
52+
53+
| File | Change |
54+
|------|--------|
55+
| `src/types.ts` | `directGeminiWireRenames?: boolean` (from #1739) |
56+
| `src/config.ts` | zod boolean + round-trip incl. explicit `false` (from #1739) |
57+
| `src/adapters/google.ts` | config gate, Vertex identity branch, `identityModelId` split (from #1739, review finding resolved) |
58+
| `tests/config.test.ts` | persisted `false` round-trip; non-boolean rejected (from #1739) |
59+
| `tests/google-adapter.test.ts` | default/true/false wire ids; CCA unaffected; identity line uses the base id (from #1739) |
60+
| `docs-site/.../providers.md` | document the setting (from #1739) |
61+
62+
## Scope boundary
63+
64+
IN: direct AI Studio wire id resolution and the identity string derived from it.
65+
OUT: any new retry/recovery mechanism; `src/server/responses/core.ts`;
66+
Antigravity/CCA resolution; picker/catalog/usage/price keys (all stay on the base id).
67+
68+
## Accept criteria (with activation)
69+
70+
1. Default (setting absent) sends the `-tiered` id.
71+
*Activation:* `buildRequest` on a default provider; assert the URL path.
72+
2. `directGeminiWireRenames: false` sends the bare id.
73+
*Activation:* adapter built with the flag false; assert the URL path.
74+
3. The system-instruction identity names the base id, never the `-tiered` spelling.
75+
*Activation:* parse the built body `systemInstruction.parts[0].text` and assert
76+
it contains `powered by the gemini-3.7-flash` and NOT `-tiered`.
77+
4. Cloud Code Assist request paths are unchanged by the flag.
78+
*Activation:* build with `googleMode: cloud-code-assist` and both flag values.
79+
5. Config round-trips an explicit `false`; a non-boolean is rejected to fallback.
80+
81+
Verifier: `bun test tests/google-adapter.test.ts tests/config.test.ts tests/gemini-37-flash-migration.test.ts`
82+
— all three exist and read the change target.
83+
84+
## Closure
85+
86+
#1894 gets the `bug` label (it is a real regression, currently labeled
87+
`provider-compatibility,provider` only). It closes only once #1739 is on
88+
`origin/dev` with 1-5 green. Because the default still favors the `-tiered`
89+
population, the closing comment must tell the #1894 reporter to set
90+
`directGeminiWireRenames: false` — closing silently would leave them broken.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# WP2 — #1899 / harden-before-publish ordering (Wave 5A-2) — rev 2 after audit
2+
3+
> Rev 2 folds blocker 5. Rev 1 named three test files; two of them have no
4+
> effects recorder to order, and both already carry #1881's guards on `dev`.
5+
6+
## Real state of #1899
7+
8+
`mergeable=CONFLICTING`, `mergeStateStatus=DIRTY`, head `8ab0aa8d0`. It conflicts
9+
precisely because #1881 already landed two of its three files:
10+
`tests/dsh-writer-lock.test.ts:173` already has the `existsSync` + win32 guard and
11+
`tests/native-main-claim.test.ts:174` already carries the POSIX-only guard.
12+
13+
Its remaining unique value is one file: `tests/codex-catalog-writer.test.ts`,
14+
where `dev` still uses unbound `effects.some(...)` checks (lines 242-246) that
15+
would pass even if the harden and the publish touched different files. #1899
16+
binds all three effects to one temp path.
17+
18+
## Correction to rev 1
19+
20+
Rev 1 claimed the ordering assertion was #1899 residue. It is not: #1899 asserts
21+
set membership (`expect(effects).toContain(...)`), not index order. A writer that
22+
published first and hardened after still passes #1899's diff. Index ordering is
23+
therefore **new work**, and it is only implementable in the one file that has an
24+
ordered `effects` array (recorder at `tests/codex-catalog-writer.test.ts:60-95`).
25+
26+
## File change map
27+
28+
| File | Change |
29+
|------|--------|
30+
| `tests/codex-catalog-writer.test.ts` | adopt #1899's temp-path binding, then add `indexOf(harden) < indexOf(publish)` for that same temp path |
31+
32+
Building effects recorders for the other two files is out of scope for Wave 5A;
33+
their Windows/POSIX split is already correct on `dev`.
34+
35+
## Accept criteria
36+
37+
1. The ordering assertion fails when harden and publish are swapped.
38+
*Activation:* invert the order in a scratch edit, capture the red run, revert.
39+
2. `bun test tests/codex-catalog-writer.test.ts` green afterwards.
40+
3. No assertion duplicated from #1881.
41+
42+
## Closure
43+
44+
#1899 cannot merge as-is (DIRTY). Land the one-file residue as a direct commit on
45+
`dev`, then close #1899 with a comment naming the commit, what was taken, and
46+
what #1881 already covered.

0 commit comments

Comments
 (0)