Skip to content

fix(ai): preserve unencrypted reasoning history - #45032

Merged
rekram1-node merged 1 commit into
v2from
unencrypted-reasoning
Aug 25, 2026
Merged

rekram1-node merged 1 commit into
v2from
unencrypted-reasoning

Conversation

@rekram1-node

Copy link
Copy Markdown
Collaborator

Summary

  • stop dropping valid reasoning items from stateless Responses requests when encrypted_content is absent or null
  • preserve reasoning IDs, visible summaries, and chronological conversation ordering regardless of encryption availability
  • match Codex request construction, which replays reasoning items with encrypted_content: null while using store: false

Before and after

Given prior assistant reasoning without encrypted state:

{ "type": "reasoning", "id": "rs_1", "summary": [{ "type": "summary_text", "text": "Checked the previous diff." }], "encrypted_content": null }

Before: store: false removed the reasoning item entirely from the next request:

{ "store": false, "input": [
  { "role": "user", "content": [{ "type": "input_text", "text": "What changed?" }] },
  { "role": "assistant", "content": [{ "type": "output_text", "text": "The parser changed." }] }
] }

After: The reasoning item remains in its original conversation position:

{ "store": false, "input": [
  { "role": "user", "content": [{ "type": "input_text", "text": "What changed?" }] },
  { "type": "reasoning", "id": "rs_1", "summary": [{ "type": "summary_text", "text": "Checked the previous diff." }], "encrypted_content": null },
  { "role": "assistant", "content": [{ "type": "output_text", "text": "The parser changed." }] }
] }

Verification

  • bun test test/partial-json.test.ts test/tool-stream.test.ts test/provider/openai-responses.test.ts test/provider/openai-compatible-responses.test.ts test/provider/openai-responses-websocket.recorded.test.ts test/provider/openai-chat.test.ts test/provider/anthropic-messages.test.ts test/provider/bedrock-converse.test.ts test/provider/xai-responses.test.ts test/response.test.ts test/tool-runtime.test.ts --timeout 30000 --only-failures (363 passing)
  • RECORDED_PREFIX=openai-responses bun test test/provider/golden.recorded.test.ts --timeout 30000 --only-failures
  • bun typecheck from packages/ai
  • bunx prettier --check packages/ai/src/protocols/open-responses.ts packages/ai/test/provider/openai-responses.test.ts

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.

1 participant