Skip to content

fix: handle unknown finish reasons gracefully#996

Open
cainydev wants to merge 1 commit intoprism-php:mainfrom
cainydev:fix/handle-unknown-finish-reasons
Open

fix: handle unknown finish reasons gracefully#996
cainydev wants to merge 1 commit intoprism-php:mainfrom
cainydev:fix/handle-unknown-finish-reasons

Conversation

@cainydev
Copy link
Copy Markdown

Summary

  • All provider handlers crashed with PrismException on unrecognized finish reasons (mapped to FinishReason::Unknown/Other by FinishReasonMap)
  • Routes unknown finish reasons to handleStop() across all 14 affected handlers in 10 providers, returning content instead of crashing
  • Preserves the FinishReason enum value in the response for caller inspection

Test plan

  • All 1463 tests pass
  • Updated OpenAI Text/Structured tests to verify graceful handling instead of expecting exceptions

@cainydev cainydev force-pushed the fix/handle-unknown-finish-reasons branch from 090d873 to 24c4faf Compare March 30, 2026 09:15
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