[PR #2835] fix(smartypants): sanitize history to avoid provider errors on reasoning and empty content #10455

Closed
opened 2026-02-16 18:15:06 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/2835

State: closed
Merged: No


Summary

  • Drop prior assistant reasoning parts from history passed to providers (display-only), preventing OpenAI Responses API error: item of type 'reasoning' provided without required following item.
  • Filter aborted assistant messages with no contentful parts (text or completed/error tool results) so history never serializes to empty content, avoiding messages.N must have non-empty content.

Rationale

Interruptions (Ctrl-C) could leave an assistant turn with only step markers or partial tool scaffolding; combined with replaying reasoning chunks, subsequent calls errored and wedged the session. This patch makes history safe while preserving visible reasoning and contentful context.

Scope

  • smartypants: provider transform + message-v2 + prompt filter only.

Notes

  • Typecheck OK via turborepo; no API or configuration changes.
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/2835 **State:** closed **Merged:** No --- ## Summary - Drop prior assistant `reasoning` parts from history passed to providers (display-only), preventing OpenAI Responses API error: item of type 'reasoning' provided without required following item. - Filter aborted assistant messages with no contentful parts (text or completed/error tool results) so history never serializes to empty `content`, avoiding `messages.N must have non-empty content`. ## Rationale Interruptions (Ctrl-C) could leave an assistant turn with only step markers or partial tool scaffolding; combined with replaying `reasoning` chunks, subsequent calls errored and wedged the session. This patch makes history safe while preserving visible reasoning and contentful context. ## Scope - smartypants: provider transform + message-v2 + prompt filter only. ## Notes - Typecheck OK via turborepo; no API or configuration changes.
yindo added the pull-request label 2026-02-16 18:15:06 -05:00
yindo closed this issue 2026-02-16 18:15:07 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#10455