fix(ai): send store: false on Azure OpenAI Responses requests#5524
Closed
Jaxkr wants to merge 1 commit into
Closed
fix(ai): send store: false on Azure OpenAI Responses requests#5524Jaxkr wants to merge 1 commit into
Jaxkr wants to merge 1 commit into
Conversation
The azure-openai-responses provider sets include: ["reasoning.encrypted_content"] to replay reasoning statelessly, but never set store, so Azure ran in its default stateful mode. Replayed transcripts re-send prior reasoning items with their rs_* ids, which Azure tries to resolve against its server-side store; on a rebuilt transcript those ids are usually absent, producing an intermittent 400 "Item with id 'rs_...' not found" that clears on retry. Set store: false so each request is self-contained via encrypted_content, matching openai-responses and openai-codex-responses.
Contributor
|
This PR was auto-closed. Only contributors approved with Maintainers review auto-closed issues daily. Issues that do not meet the quality bar in CONTRIBUTING.md will not be reopened or receive a reply. If a maintainer replies See CONTRIBUTING.md. |
Jaxkr
commented
Jun 8, 2026
| input: messages, | ||
| stream: true, | ||
| prompt_cache_key: clampOpenAIPromptCacheKey(options?.sessionId), | ||
| // Reasoning is replayed statelessly via reasoning.encrypted_content (set below), |
Author
There was a problem hiding this comment.
I removed these comments on my latest commit in my branch.
Author
|
I also made it unconditionally include The latest commits on my branch have this too (this PR isn't updating due to it being closed) |
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.
To maintainers: This is a THREE LINE change which fixes a nasty bug. Also I opened this before I read CONTRIBUTING.md telling me not to open PRs. Sorry! Please don't ban me!
Summary
packages/ai/src/providers/azure-openai-responses.tsrequestsinclude: ["reasoning.encrypted_content"](the stateless reasoning-replay path) but never setsstore, so Azure runs in its default stateful mode. The siblingopenai-responsesandopenai-codex-responsesproviders both setstore: falsealongside the sameinclude; Azure is the only Responses provider that omits it.Symptom
Intermittent
400 Item with id 'rs_...' not foundon multi-turn conversations, which clears if you retry the same request.Root cause
When a transcript is replayed,
convertResponsesMessagesre-emits each prior assistant reasoning item with its originalrs_*id inlined ininput(the item is round-tripped throughthinkingSignature). In stateful mode Azure tries to resolve thatrs_*id against its server-side store rather than using the inlinedencrypted_content. Azure's Responses endpoint is load-balanced and stored items are tied to a specific response/backend with a retention window, so whether the lookup succeeds is non-deterministic — replays that land on a backend without the item fail, and retrying eventually routes to one that resolves (or regenerates), which is why "try again" clears it.This bites hardest when the transcript is rebuilt from persisted messages each turn (no
previous_response_idthreading), so the replayed reasoning ids reference responses the serving backend no longer has.Fix
Set
store: falseinbuildParams. Withstore: false+include: ["reasoning.encrypted_content"], every request is self-contained: the reasoning travels inline as encrypted content and Azure never does a store lookup, so the call is deterministic. This matches the existing behavior ofopenai-responsesandopenai-codex-responses.const params: ResponseCreateParamsStreaming = { model: deploymentName, input: messages, stream: true, prompt_cache_key: clampOpenAIPromptCacheKey(options?.sessionId), + store: false, };Test
Extended
packages/ai/test/azure-openai-base-url.test.tsto assert the provider sendsstore: false.npm run checkand the fullpackages/aitest suite pass (323 passed, e2e/keyed tests skipped).