Repository navigation
fix: validate completed OpenAI-compatible model probes - #658
Merged
mateaix merged 2 commits intoOct 9, 2026
Merged
Conversation
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.
An OpenAI-compatible endpoint can return HTTP 200 with malformed JSON, an error envelope, empty text or a reasoning-only response. Model tests currently report success anyway; malformed/missing content even gets a fabricated success message. A ten-token budget also prevents some reasoning-capable models from reaching their final answer.
This change requires a valid completion with nonblank textual
message.contentandfinish_reason: stop. Incomplete, filtered, tool-only and invalid replies fail visibly without copying raw provider payloads into the new validation errors. The same validation covers single-model tests, provider connection fallback and discovery probes. Discovery retains failed entries with an error and excludes them from new-model suggestions.Probe budgets are bounded at 512 tokens for unrecognized/standard families and 4096 for recognized reasoning families. Existing OpenAI
max_completion_tokens, sampling restrictions and provider passthrough behavior remain intact. A token-limit failure explicitly says it does not establish that the model is unavailable; there are no automatic retries.Compatibility and scope
finish_reason: stop; omitted or nonstandard completion markers now fail rather than claiming a completed answer.Validation
Tests use a loopback server and synthetic data. No live model credentials, external model calls or production changes.