Repository navigation
fix(customchat): send cause-less finish reasons again as model faults - #158
Merged
Merged
Conversation
A chat upstream that ends a turn with finish_reason "other", "unknown", "unspecified" or "finish_reason_unspecified" failed it as not representable. Treat these as model faults: prism sends the request again once before any output, and the failure reads "provider returned error" so clients retry it as a transient upstream error.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Some chat upstreams end a turn with
finish_reason: "other"and no output. prism failed the turn withupstream finish reason "other" is not representable. The client showed it as a final error and did not retry, though the same request usually succeeds when sent again.Scope
internal/providers/customchat:other,unknown,unspecifiedandfinish_reason_unspecifiedcount as model faults. prism sends the request again once while the client has received nothing, as it already does for malformed responses.upstream provider returned error finish reason "X". Clients classify that wording as a transient upstream error and retry it.Verification
go test ./internal/providers/customchat/ ./internal/routing/ ./internal/server/: ok.TestModelFaultFinishIsSentAgainOnce:otherthen success makes 2 requests and finishes;othertwice fails with the new message.Model: claude-opus-5-5