Repository navigation
fix(google): retain provider-returned response model - #129606
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs real behavior proof before merge. Reviewed August 26, 2026, 5:58 AM ET / 09:58 UTC. ClawSweeper reviewWhat this changesThe PR records a genuinely distinct Google or Vertex streamed Regression provenancePossible 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 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherGoogle 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]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +24, Tests +394. Total +418 across 4 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest 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 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. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
3adc4c0 to
e5130bb
Compare
Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
7647487 to
6199c53
Compare
|
Merged via squash.
|
* 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]>
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/providersSDK adapters and the Google plugin transport selected bybuildGoogleProvider().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
modelVersionas the existing optionalAssistantMessage.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/genai2.17.1 types documentGenerateContentResponse.modelVersionas 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:The SDK suite creates a real pinned
GoogleGenAIclient 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
responseModelorreroutedvalues, 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:
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).