Skip to content

fix(google): retain provider-returned response model - #129606

Merged
steipete merged 3 commits into
openclaw:mainfrom
Alix-007:alix/fix-google-response-model
Aug 26, 2026
Merged

steipete merged 3 commits into
openclaw:mainfrom
Alix-007:alix/fix-google-response-model

Conversation

@Alix-007

@Alix-007 Alix-007 commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Google-backed agent turns lost the concrete model version returned by Gemini or Vertex. Requests made against aliases therefore recorded the requested alias in transcripts and terminal receipts instead of the model that actually generated the answer.

OpenClaw has two independently reachable Google streaming owners: the public @openclaw/ai/providers SDK adapters and the Google plugin transport selected by buildGoogleProvider().createStreamFn. The original contributor fix repaired only the SDK adapter; normal plugin-backed agent runs still lost the provider-returned identity.

Why This Change Was Made

Both streaming owners now retain the first non-empty, genuinely different Google modelVersion as the existing optional AssistantMessage.responseModel. Both owners recognize Google's documented bare, google/, models/, partial Google publisher-resource, and full Google publisher-resource spellings. The registered plugin normalizes Google-owned publisher resources only when comparing response identities; its existing outbound request URL construction is unchanged.

This symmetric comparison prevents equivalent model spellings from incorrectly marking terminal receipts as rerouted. Distinct tuned resources and non-Google publishers remain distinct. The requested model, provider routing, authentication, configuration, catalogs, and public API are unchanged.

Original contributor: @Alix-007, preserved as the primary commit author.

User Impact

Gemini and Vertex operators now see the concrete served model in agent metadata, persisted assistant messages, and terminal receipts when Google serves a different revision. Equivalent Google resource spellings no longer produce false reroute signals, and ordinary same-model responses remain unchanged.

Evidence

The pinned @google/genai 2.17.1 types document GenerateContentResponse.modelVersion as optional output-only response metadata and explicitly document the supported Google model-resource spellings.

Before repair, independent focused regressions against frozen main failed on both live streaming owners: direct Gemini, Vertex, and first-different streamed responses each lost their provider-returned model.

After repair and a preserving refresh onto current main, all 288 relevant tests passed:

OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs packages/ai/src/providers/google-shared.test.ts packages/ai/src/providers/google-shared.convert.test.ts extensions/google/transport-stream.test.ts src/agents/embedded-agent-runner/run/terminal-preparation.test.ts

packages/ai/src/providers/google-shared.test.ts + google-shared.convert.test.ts: 104 passed
src/agents/embedded-agent-runner/run/terminal-preparation.test.ts: 18 passed
extensions/google/transport-stream.test.ts: 166 passed

The SDK suite creates a real pinned GoogleGenAI client and observes an actual localhost HTTP POST/SSE response. The plugin suite separately obtains the real stream function through Google provider registration and observes actual localhost HTTP POST/SSE responses for Gemini, Vertex, and equivalent partial/full Google publisher-resource controls. The canonical terminal-receipt suite verifies that genuinely distinct response models are recorded without replacing the requested model.

Regression coverage includes first-different ownership, omitted/empty/blank values, bare and prefixed Google names, full and partial Google publisher resources, tuned models, and non-Google publisher isolation.

The latest ClawSweeper findings were addressed at the registered plugin's actual response-model producer, not in a downstream receipt: equivalent partial/full Google publisher resources no longer produce false responseModel or rerouted values, while non-Google publishers and tuned resources remain distinct. The newly added regression matrix initially failed six cases, including two actual registered Vertex localhost HTTP/SSE requests, and now passes all 22 focused cases. Reverse identity comparisons are covered at the producer; sending full resource names as requested models through the plugin's existing Vertex URL builder would produce an invalid provider URL, so no misleading reverse network fixture was added.

Both exact test-type owners also pass:

pnpm tsgo:extensions:test
pnpm tsgo:test:packages

An earlier candidate exposed an unrelated shared frontend CSS build-budget regression; this branch was refreshed only after the canonical upstream cleanup landed. The refresh also preserves the independently landed Google tool-call identities, unspecified-finish handling, and unframed terminal-error protections, including their real HTTP/SSE and conversion regressions. The exact refreshed head completed its full hosted CI run and required Actions-owned gate successfully.

Authenticated live-provider proof on the exact reviewed head executed the actual registered Google plugin through its unchanged production HTTPS/SSRF transport and the actual terminal-receipt owner. Exactly one official Google request returned HTTP 200 and proved that the served model, assistant response model, and terminal receipt agree:

{
  "candidate": "6199c5313933c2cfe117504ac2141fd3946bb155",
  "owner": "registered-google-plugin",
  "officialGoogleHttpsRequests": 1,
  "httpStatus": 200,
  "requestedModel": "gemini-flash-latest",
  "actualProviderModelVersion": "gemini-3.7-flash",
  "assistantResponseModel": "gemini-3.7-flash",
  "terminalReceipt": {
    "requestedModel": "gemini-flash-latest",
    "responseModel": "gemini-3.7-flash",
    "rerouted": true
  },
  "outputTokens": 13,
  "maximumOutputTokens": 16
}

No credential, request URL, headers, prompt, response text, or private user data is included. Production delta: +24 lines across two independently live owner boundaries. Test delta: +394 lines, including both HTTP/SSE integrations and the provider-resource regressions. Independent source review approved the complete change; fresh whole-branch structured review reported no actionable findings (confidence 0.96).

@clawsweeper

clawsweeper Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 25, 2026
@clawsweeper

clawsweeper Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 26, 2026, 5:58 AM ET / 09:58 UTC.

ClawSweeper review

What this changes

The PR records a genuinely distinct Google or Vertex streamed modelVersion as assistant response metadata in both the shared SDK adapter and the bundled Google provider transport, with resource-spelling regressions.

Regression provenance

Possible regression — probable (reviewed change; failure trace). No predecessor PR is attributed.

Merge readiness

⛔ Blocked until real behavior proof from a real setup is added - 5 items remain

Keep open. The patch correctly covers both current Google streaming owners, but this external PR still needs redacted after-fix evidence from an actual Google or Vertex response and an exact-head refresh/check after its behind-base state.

Priority: P2
Reviewed head: 6199c5313933c2cfe117504ac2141fd3946bb155

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The owner-boundary patch and regression matrix are solid, but external real-provider proof remains a merge gate.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The PR shows real SDK and registered-plugin paths against synthetic localhost SSE, but it lacks redacted after-fix evidence from an actual Google or Vertex response; add terminal output or logs without private data. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR shows real SDK and registered-plugin paths against synthetic localhost SSE, but it lacks redacted after-fix evidence from an actual Google or Vertex response; add terminal output or logs without private data. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 8 items Current-main defect: Current main reads only responseId before usage in the shared SDK stream loop, so a provider modelVersion is not retained.
Current-main plugin defect: Current main’s registered Google transport likewise advances from responseId directly to usage handling without reading the streamed model identity.
Owner-boundary repair: The PR records the first non-empty, non-equivalent response model at both producing stream loops, rather than compensating in the terminal receipt consumer.
Findings None None.
Security None None.

Live Verification

Command: OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs extensions/google/transport-stream.test.ts

Result: PASS (completed)

[test] starting test/vitest/vitest.extension-providers.config.ts

 RUN  v4.1.11 /tmp/clawsweeper-live-proof-129606-mMcj8W/target

 ✓  extension-providers  extensions/google/transport-stream.test.ts (166 tests) 6283ms
     ✓ resolves qualified AI Studio video after payload hooks and preserves part order  330ms

 Test Files  1 passed (1)
      Tests  166 passed (166)
   Start at  09:59:32
   Duration  16.58s (transform 9.19s, setup 1.16s, import 8.99s, tests 6.28s, environment 0ms)

[test] passed 1 Vitest shard in 22.50s
[test] starting test/vitest/vitest.extension-providers.config.ts

 RUN  v4.1.11 /tmp/clawsweeper-live-proof-129606-mMcj8W/target

 ✓  extension-providers  extensions/google/transport-stream.test.ts (166 tests) 5492ms

 Test Files  1 passed (1)
      Tests  166 passed (166)
   Start at  09:59:55
   Duration  10.16s (transform 2.95s, setup 511ms, import 4.00s, tests 5.49s, environment 0ms)

[test] passed 1 Vitest shard in 16.01s

Assertions:

  • NOT OBSERVED expect_output: google transport stream — command exited successfully; expected output was not observed in the captured pane

How this fits together

Google and Vertex streams reach OpenClaw through either the shared AI SDK adapter or the Google plugin transport. Each stream produces assistant metadata that feeds persisted assistant messages and terminal receipts.

flowchart LR
  A[Google or Vertex stream] --> B[Shared SDK adapter]
  A --> C[Google plugin transport]
  B --> D[Compare requested and returned model]
  C --> D
  D --> E[Assistant response metadata]
  E --> F[Terminal receipt and transcript]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR shows real SDK and registered-plugin paths against synthetic localhost SSE, but it lacks redacted after-fix evidence from an actual Google or Vertex response; add terminal output or logs without private data. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P1) - The additive response identity is persisted into assistant metadata and can change terminal receipt rerouted output for existing Google and Vertex runs; validate that behavior against an actual provider response before merge.
  • Resolve merge risk (P1) - GitHub reports this PR behind main, so it needs a refresh and exact-head CI before landing.
  • Resolve merge risk (P1) - The direct @google/genai type contract could not be independently inspected in this node_modules-less checkout with unavailable DNS; this is a reviewer infrastructure gap, not contributor proof failure.
  • Complete next step (P2) - No mechanical repair is indicated; the remaining blockers are contributor-supplied real-provider evidence and exact-head validation.
Agent review details

Security

None.

PR surface

Source +24, Tests +394. Total +418 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 24 0 +24
Tests 2 394 0 +394
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 418 0 +418

Review metrics

Metric Value Why it matters
Production versus test delta production +24, tests +394 The production additions are split across two independently selected stream owners; the larger test delta exercises both boundary paths and model-resource equivalence.

Merge-risk options

Maintainer options:

  1. Prove the changed receipt on a real provider (recommended)
    Rebase onto current main and add redacted Gemini or Vertex after-fix terminal output or logs that show the requested alias and recorded provider-returned model.

Technical review

Best possible solution:

Refresh onto current main, provide redacted real Google or Vertex terminal/log evidence showing an alias and the returned served model, then require exact-head green checks.

Do we have a high-confidence way to reproduce the issue?

Yes, source-reproducible: current main’s two producer loops do not read streamed modelVersion, while the terminal consumer already accepts responseModel; no live provider run was performed in this read-only review.

Is this the best way to solve the issue?

Yes for the code boundary: recording the fact at both stream producers is preferable to reconstructing it in terminal preparation. Final merge confidence remains limited by missing real-provider proof and unavailable direct dependency-type inspection.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 2d6e0a23af19.

Labels

Label justifications:

  • P2: This fixes bounded accuracy of Google model metadata and terminal receipts.
  • merge-risk: 🚨 compatibility: Equivalent model identifiers and receipt output can change for existing Google and Vertex configurations.
  • merge-risk: 🚨 session-state: The patch adds provider-returned identity to persisted assistant-message metadata consumed by terminal receipts.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR shows real SDK and registered-plugin paths against synthetic localhost SSE, but it lacks redacted after-fix evidence from an actual Google or Vertex response; add terminal output or logs without private data. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

Likely related people:

  • steipete: History shows repeated Google transport and shared-provider work, and the current head was committed and co-authored by Peter Steinberger. (role: recent Google and AI transport contributor; confidence: high; commits: 3cadc085932a, d2047364a8fb, 6199c5313933; files: extensions/google/transport-stream.ts, packages/ai/src/providers/google-shared.ts)
  • Onur Solmaz: Recent shared-provider history includes provider-stream lifecycle work in the affected SDK area. (role: recent shared-provider contributor; confidence: medium; commits: 1319e1e60652; files: packages/ai/src/providers/google-shared.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add redacted after-fix Gemini or Vertex terminal output/logs showing the selected alias and provider-returned response model.
  • Refresh the branch onto current main and let exact-head CI complete.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (5 earlier review cycles)
  • reviewed 2026-08-25T22:32:09.428Z sha 3adc4c0 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-25T23:15:51.580Z sha 3adc4c0 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-26T05:25:41.897Z sha e5130bb34eb2faf648ecb3fc3fbcb5f75ec4213a :: needs maintainer review before merge. :: none
  • reviewed 2026-08-26T06:42:58.677Z sha 5b5be107d918861424e91e274203e67d9e343c44 :: needs changes before merge. :: [P2] Normalize Google publisher-resource model names in the plugin
  • reviewed 2026-08-26T08:47:24.178Z sha 7647487e7e8189227a7a5780382179e0572ab13e :: needs real behavior proof before merge. :: none

@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Aug 25, 2026
@steipete
steipete force-pushed the alix/fix-google-response-model branch from 3adc4c0 to e5130bb Compare August 26, 2026 05:17
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 26, 2026
@steipete
steipete force-pushed the alix/fix-google-response-model branch from 7647487 to 6199c53 Compare August 26, 2026 09:52
@steipete
steipete merged commit e2e5d1b into openclaw:main Aug 26, 2026
196 of 198 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 27, 2026
* fix(google): preserve provider-returned response models

Co-authored-by: Peter Steinberger <[email protected]>

* test(google): use typed Vertex stream options

Co-authored-by: Peter Steinberger <[email protected]>

* fix(google): normalize Vertex response model resources

Co-authored-by: Peter Steinberger <[email protected]>

---------

Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: google merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: M status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants