Skip to content

Conversation

@steipete
Copy link
Contributor

@steipete steipete commented Jan 19, 2026

I have two reports where we corrupted the session for OpenAI:

I did check and found no docs (ofc) but forum entries and it happening twice seems this is a real issue.
Don't have session logs.

vibed pr. fix is small and for now I ship a local workaround.

@badlogic
Copy link
Owner

Thanks @steipete for the report and investigation. Fixed this differently: we now skip errored/aborted assistant messages entirely in transform-messages.ts rather than filtering at the provider level. This way the fix covers openai-responses, openai-codex-responses, and any future providers.

Also removed the strictResponsesPairing workaround from #768 since it's no longer needed.

@badlogic badlogic closed this Jan 19, 2026
badlogic added a commit that referenced this pull request Jan 19, 2026
Fixes OpenAI Responses 400 error 'reasoning without following item' by
skipping errored/aborted assistant messages entirely rather than filtering
at the provider level. This covers openai-responses, openai-codex-responses,
and future providers.

Removes strictResponsesPairing compat option (no longer needed).

Closes #838
badlogic added a commit that referenced this pull request Jan 19, 2026
barnierg76 added a commit to barnierg76/pi-mono that referenced this pull request Jan 25, 2026
…sistant messages

When an assistant message with tool_use blocks is skipped due to error or aborted
stopReason, the corresponding tool_result messages were not being filtered out,
causing Anthropic API rejections: "unexpected tool_use_id found in tool_result blocks".

This fix:
- Tracks tool IDs from skipped assistant messages in a Set
- Filters out tool results that reference these skipped tool IDs
- Ensures strict Anthropic API requirement: every tool_result must have a
  corresponding tool_use in a preceding assistant message

Fixes issue introduced in v0.49.2 (issue badlogic#838) where errored messages were
skipped to fix OpenAI compatibility, but orphaned tool results remained.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
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.

2 participants