Skip to content

fix: replay refusals in conversation history instead of throwing - #42

Merged
TheGreatAxios merged 1 commit into
mainfrom
fix/replay-refusals
Nov 4, 2026
Merged

TheGreatAxios merged 1 commit into
mainfrom
fix/replay-refusals

Conversation

@TheGreatAxios

@TheGreatAxios TheGreatAxios commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Closes CL-12065

A refusal block in history no longer throws in buildRequest.

  • Typed shape, assistant turn: { type: "refusal", refusal: reason }.
  • Flat shape or non-assistant turn: reason as a text part.

Wire shape: openai-node responses.ts (master) lists ResponseOutputMessage in ResponseInputItem, with content: Array<ResponseOutputText | ResponseOutputRefusal> and ResponseOutputRefusal = { type: 'refusal'; refusal: string }. The SDK type also requires id and status; we omit them, as the existing output_text replay already does.

Live API check: pending, not run (no key). If the API rejects the refusal part, the fallback is to replay the reason as { type: "output_text", text: reason } on typed assistant turns, so every shape sends text.

@linear-code

linear-code Bot commented Nov 4, 2026

Copy link
Copy Markdown

CL-12065

@TheGreatAxios

Copy link
Copy Markdown
Contributor Author

Live check, gpt-5-mini on api.openai.com, all open PRs merged locally: a history with an assistant refusal part followed by a new user turn returns 200, and the model replies normally. The fallback isn't needed.

@TheGreatAxios
TheGreatAxios merged commit 97e3a9c into main Nov 4, 2026
2 checks passed
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