Skip to content

[Bug]: OpenAI streaming provider fails to map refusal chunks to ModelRefusalError #101059

Description

@aniruddhaadak80

Description

In packages/ai/src/providers/openai-responses.ts, if the model returns a refusal payload during a tool call chunk (common in gpt-4o strict tool usage), the adapter ignores the refusal and attempts to parse the tool call as empty JSON, resulting in a JSON parse error instead of a handled ModelRefusalError.

Impact

Agent halts abruptly with a cryptic JSON parsing stack trace instead of gracefully falling back or informing the user of the refusal.

Location

  • packages/ai/src/providers/openai-responses.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.staleMarked as stale due to inactivity

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions