Repository navigation
fix(ai-sdk): omit UUID ids from Responses continuation input - #20414
Merged
kangfenmao merged 2 commits intoSep 22, 2026
Merged
Conversation
DeJeune
approved these changes
Sep 11, 2026
Contributor
There was a problem hiding this comment.
Cherry Review · Passed
no findings
Local validation (advisory)
These results do not determine the code-review verdict. Repository CI checks retain their own merge requirements.
targeted-code-check: passed. Vitest preflight succeeded; all 1 frozen changed-test targets were supplied, with 1 test files collected and all 2 tests passing.
cursor
Bot
force-pushed
the
cursor/fix-responses-uuid-input-id-d814
branch
from
September 15, 2026 15:19
b7617f2 to
c4bc238
Compare
Contributor
There was a problem hiding this comment.
Cherry Review · Passed
no findings
Local validation (advisory)
These results do not determine the code-review verdict. Repository CI checks retain their own merge requirements.
targeted-code-check: passed. Vitest preflight succeeded; all 1 frozen changed-test targets were supplied, with 1 test files collected and all 2 tests passing.
store:false continuations copied local/relay UUIDs onto input[n].id. The API requires a msg_ or rs_ prefix and 400s otherwise. Co-authored-by: GokayAI <[email protected]> Signed-off-by: GokayAI <[email protected]>
cursor
Bot
force-pushed
the
cursor/fix-responses-uuid-input-id-d814
branch
from
September 18, 2026 15:05
c4bc238 to
e3025b2
Compare
Contributor
There was a problem hiding this comment.
Cherry Review · Passed
no findings
Local validation (advisory)
These results do not determine the code-review verdict. Repository CI checks retain their own merge requirements.
targeted-code-check: passed. Vitest preflight succeeded; all 1 frozen changed-test targets were supplied, with 1 test files collected and all 2 tests passing.
ShuaiHui
added a commit
to xigaomeicun/cherry-lite
that referenced
this pull request
Oct 9, 2026
…Q#20414) The continuation input replayed each message's `itemId` verbatim. An item id the endpoint did not issue — a UUID carried over from another provider or from a rewritten history — is rejected there, so a continued Responses conversation 400'd as soon as such an item was replayed. Gate every replayed id on its Responses prefix: `toResponsesItemId(id, 'msg')` for text items and `toResponsesItemId(id, 'rs')` for reasoning items now drop anything that is not a real `msg_`/`rs_` id, letting the server mint a fresh item instead of failing the request. Local zod validation is untouched. Repository adaptation: the fork's patch file had drifted from upstream (an older snapshot plus a hand-merged hunk for CherryHQ#21339). This commit replaces it with upstream's exact file at the same point, so the file is now byte-identical to upstream and later commits in this family cherry-pick without conflicts. The `pnpm-lock.yaml` patch hash was recomputed (patch file sha256, all six occurrences) and verified by `pnpm install --frozen-lockfile`. (cherry picked from commit 6337297) Signed-off-by: shuaihui <[email protected]>
ShuaiHui
added a commit
to xigaomeicun/cherry-lite
that referenced
this pull request
Oct 9, 2026
CherryHQ#20762) CherryHQ#20414 stopped replaying ids that lack a Responses prefix, but the text path still forwarded whatever id the item carried. On a `store: false` request the endpoint retained nothing, so an id it never issued — a UUID from another provider, or one rewritten by a client — was rejected and the whole continued conversation 400'd even though the request was locally well-formed. Replay a text item's id only when the request is stored, or when the id itself starts with `msg_`; otherwise omit it and let the server mint a fresh item. Reasoning items keep their prefix guard through `toResponsesItemId(id, 'rs')`. Repository adaptation: taken as upstream's exact patch file at this commit (the file became byte-identical to upstream in the previous commit), with the `pnpm-lock.yaml` hash recomputed for the new file and verified by `pnpm install --frozen-lockfile`. (cherry picked from commit 88f8d0b) Signed-off-by: shuaihui <[email protected]>
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.
What this PR does
Before this PR: a Responses continuation with
store: falsecopiedproviderOptions.openai.itemIdontoinput[n].id. Relays and local history can store a UUID there. Upstream then rejected the request because response item IDs must begin withrs(reasoning) ormsg(assistant message). Diagnostic ID8bfdc98d-13ea-41b8-8825-8a339167ffe8.After this PR:
convertToOpenAIResponsesInputonly serializes an itemidwhen it already has the matching provider prefix (msgfor messages,rsfor reasoning). Valid provider-issued ids still round-trip. Function-call ids were already dropped in #20130; this is the same hygiene for message and reasoning items.Fixes #20406
Why we need it and why it was done in this way
The following tradeoffs were made:
startsWith('msg')/startsWith('rs')) rather than dropping every id. Reasoning round-trip withstore: falsestill needs a realrs_…id plus encrypted content.@ai-sdk/openaipatch, next to the Ark assistanttype/statushunk, so every Responses client path is covered. GatewayAiSdkToOpenAiResponsesSsesynthesizes outboundrs_ids on a different path and is unchanged.The following alternatives were considered:
itemIdbefore the converter. That would miss any call that uses@ai-sdk/openaiwithout the plugin.rs_encrypted-reasoning replay.Links to places where the discussion took place: #20406
Breaking changes
None.
Special notes for your reviewer
Signed-off-by: GokayAI <[email protected]>) and SSH-signed.src/main/ai/provider/__tests__/openaiResponsesItemId.test.ts. Related Responses patch tests still pass.pnpm exec vitest run --project main src/main/ai/provider/__tests__/openaiResponsesItemId.test.ts src/main/ai/provider/__tests__/openaiResponsesFunctionCallId.test.ts src/main/ai/provider/__tests__/openaiResponsesAssistantStatusPatch.test.ts src/main/ai/provider/__tests__/openaiResponsesReasoningPatch.test.ts src/main/ai/provider/__tests__/openaiResponsesSamplingParamsPatch.test.ts src/main/ai/provider/__tests__/openaiResponsesAnnotationsPatch.test.tsChecklist
This checklist is not enforcing, but it's a reminder of items that could be relevant to every PR.
Approvers are expected to review this list.
main/gh-pr-review,gh pr diff, or GitHub UI) before requesting review from othersRelease note