Repository navigation
fix(provider): keep Gemini requests from ending with a model turn - #55382
heimoshuiyu wants to merge 1 commit into
Conversation
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 72 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
The following comment was made by an LLM, it may be inaccurate: |
|
Cross-linking: #55514 traces another way v1 ends up with a trailing model turn, with no prefill involved. When the wall clock steps backward inside a step, |
|
This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 72-hour window. Feel free to open a new pull request that follows our guidelines. |
Fixes #47034 (same root cause as #45359) on the V1 line.
Problem
Gemini rejects any request whose
contentsends with amodelturn:V1 produces that shape whenever it continues from a persisted assistant tail:
MAX_STEPS_PROMPTas an assistant messageFix
Append a synthetic
userturn ("Continue.") inProviderTransform.messagewhen the last message is an assistant turn, for the Gemini SDKs only (@ai-sdk/google,@ai-sdk/google-vertex):normalizeMessages, which inserts a synthetic assistant"Done."when a tool turn is followed by a user turnTesting
bun test test/provider/transform.test.ts— 585 pass, 0 failbun typecheck(packages/opencode) — no new errors vs pristine v1 tip (42 pre-existing, verified via stash comparison)