Skip to content

fix(streaming): propagate stop_details from message_delta into accumulated Message#1469

Open
xodn348 wants to merge 1 commit intoanthropics:mainfrom
xodn348:fix/stop-details-propagation
Open

fix(streaming): propagate stop_details from message_delta into accumulated Message#1469
xodn348 wants to merge 1 commit intoanthropics:mainfrom
xodn348:fix/stop-details-propagation

Conversation

@xodn348
Copy link
Copy Markdown

@xodn348 xodn348 commented Apr 29, 2026

What

The streaming accumulator merges stop_reason and stop_sequence from message_delta events but does not propagate stop_details (RefusalStopDetails), even though both the RawMessageDeltaEvent.Delta and Message types define this field. This causes stream.get_final_message().stop_details to always be None when the API returns structured refusal information via streaming.

Fixed in both _messages.py (non-beta) and _beta_messages.py (beta) paths.

Verification

  • Build: pass
  • Tests: pass (32 passed, including 3 new tests)
  • Lint: pass (ruff)
  • Type check: pass (pyright, 0 errors)

…lated Message

The streaming accumulator in both `_messages.py` and `_beta_messages.py`
merges `stop_reason` and `stop_sequence` from `message_delta` events but
does not propagate `stop_details` (RefusalStopDetails), even though both
the `Delta` and `Message` types define this field.

This causes `stream.get_final_message().stop_details` to always be `None`
when the API returns structured refusal information via streaming.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@xodn348 xodn348 requested a review from a team as a code owner April 29, 2026 05:23
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