Skip to content

fix(llm): restore id field in stateless reasoning replay items - #49618

Open
Synxneuos wants to merge 1 commit into
anomalyco:devfrom
Synxneuos:fix/reasoning-replay-missing-id
Open

Synxneuos wants to merge 1 commit into
anomalyco:devfrom
Synxneuos:fix/reasoning-replay-missing-id

Conversation

@Synxneuos

@Synxneuos Synxneuos commented Sep 17, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #49574

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

PR #34027 introduced OpenAIResponsesReasoningReplay = Omit<OpenAIResponsesReasoningInput, "id"> and built the replay object without id. The Responses API requires that reasoning items with encrypted_content also carry the original id. Omitting it causes HTTP 400 invalid_payload on continuation turns.

Three changes in openai-responses.ts:

  1. Schema: id: Schema.optionalKey(Schema.String) to id: Schema.String
  2. Type alias: removed the Omit so OpenAIResponsesReasoningReplay = OpenAIResponsesReasoningInput
  3. Replay object: added id: reasoning.id to the literal

The fix restores the id that lowerReasoning already correctly extracts from providerMetadata.openai.itemId but the caller was then discarding.

How did you verify your code works?

Traced the full path from lowerReasoning through the replay object construction. Updated the existing join-summary test to assert id is present. Added a regression test that directly verifies the id appears in the lowered input sent to the API.

Screenshots / recordings

No UI changes.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

PR anomalyco#34027 introduced a type alias OpenAIResponsesReasoningReplay = Omit<OpenAIResponsesReasoningInput, 'id'> and built the replay object without the id field. The Azure/OpenAI Responses API requires that reasoning items carrying encrypted_content also carry a matching id, so omitting it causes HTTP 400 invalid_payload on continuation turns.

Fixes:
- Remove the Omit alias so OpenAIResponsesReasoningReplay is OpenAIResponsesReasoningInput
- Add id: reasoning.id to the replay object literal in lowerMessages
- Make id required (Schema.String) in OpenAIResponsesReasoningItem schema
- Update the join-summary test to assert id is present
- Add regression test proving the id is forwarded in the lowered input

Closes anomalyco#49574
@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Sep 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenAIResponses.lowerMessages strips reasoning item id when replaying reasoning, causing HTTP 400 invalid_payload on Azure/OpenAI Responses API

1 participant