Skip to content

fix(ai): preserve Responses item IDs - #40943

Open
rekram1-node wants to merge 3 commits into
v2from
responses-item-replay
Open

fix(ai): preserve Responses item IDs#40943
rekram1-node wants to merge 3 commits into
v2from
responses-item-replay

Conversation

@rekram1-node

Copy link
Copy Markdown
Collaborator

Summary

  • preserve response item IDs for reasoning, assistant messages, function calls, and function outputs regardless of store
  • replay complete provider-hosted output items instead of synthesizing item_reference inputs
  • make OpenAI, Azure, and Open Responses use the same client-managed history shape for store: true and store: false
  • default generic Open Responses routes to store: false, matching the OpenAI/Azure native routes
  • retain lifecycle metadata through terminal events so IDs, phases, and encrypted reasoning survive durable replay
  • generate stable, prefixed fallback IDs for client-created or invalid items without collisions from sanitization/truncation

This aligns native Responses history with the OpenAI SDK manual-history guidance and Codex commit 4a443994bd, where store controls server persistence rather than outbound item-ID serialization.

Testing

  • bun typecheck in packages/ai
  • OpenAI Responses and Open Responses-compatible protocol tests: 81 passed
  • affected recorded OpenAI Responses, hosted-image, and PDF continuation tests passed
  • bun typecheck in packages/core
  • core session message and tool-event persistence tests: 28 passed
  • full AI suite: all affected tests passed; three unrelated latest-v2 failures remain from stale Azure Chat/OpenRouter fixture expectations

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