Skip to content

fix(openai): avoid orphaned Responses item ids - #13054

Open
d3f4w2 wants to merge 1 commit into
continuedev:mainfrom
d3f4w2:fix/12935-preserve-reasoning-items
Open

fix(openai): avoid orphaned Responses item ids#13054
d3f4w2 wants to merge 1 commit into
continuedev:mainfrom
d3f4w2:fix/12935-preserve-reasoning-items

Conversation

@d3f4w2

@d3f4w2 d3f4w2 commented Jul 29, 2026

Copy link
Copy Markdown

Description

Fixes #12935.

The OpenAI adapter reconstructs Responses API input from Chat Completions history. That history does not contain the separate Responses reasoning item or output-item identity, but the converter was inventing msg_* IDs for assistant messages and treating fc_* tool-call correlation IDs as Responses output-item IDs. On the following tool turn, the Responses API can therefore require a reasoning item that the reconstructed history cannot provide.

This change:

  • replays historical assistant content as an easy input message without a synthetic msg_* output-item ID;
  • keeps Chat Completions tool-call IDs only as call_id, instead of also treating fc_* values as Responses item IDs;
  • adds focused regression coverage for assistant history and a complete assistant tool-call/tool-result turn.

This is separate from the core converter's context-compaction sanitizer: this path is the standalone packages/openai-adapters Chat Completions-to-Responses adapter, where reasoning/output-item metadata is unavailable by construction.

AI assistance disclosure: Codex assisted with investigation, implementation, and tests; I reviewed the resulting diff and validation results.

AI Code Review

  • Team members only: AI review runs automatically when PR is opened or marked ready for review
  • Team members can also trigger a review by commenting @continue-review

Checklist

  • I've read the contributing guide
  • The relevant docs, if any, have been updated or created (not applicable; no user-facing behavior/configuration change)
  • The relevant tests, if any, have been updated or created

Screen recording or screenshot

Not applicable: this fixes request serialization and is covered by adapter regression tests.

Tests

  • cd packages/openai-adapters && npm test -- --run — 145 passed, 5 skipped
  • cd packages/openai-adapters && npm run build
  • npx prettier --check packages/openai-adapters/src/apis/openaiResponses.ts packages/openai-adapters/src/test/openai-responses.vitest.ts
  • git diff --check

@github-actions

github-actions Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@d3f4w2

d3f4w2 commented Jul 29, 2026

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@d3f4w2
d3f4w2 marked this pull request as ready for review July 29, 2026 09:28
@d3f4w2
d3f4w2 requested a review from a team as a code owner July 29, 2026 09:28
@d3f4w2
d3f4w2 requested review from sestinj and removed request for a team July 29, 2026 09:28
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.

GPT-5.5 Agent mode fails after terminal tool execution with “function_call was provided without its required reasoning item”

1 participant