feat(llm proxy helpers) expose a readable provider availability error#4080
Merged
Conversation
…-availability-error
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Safely detects OpenRouter 404 provider availability errors (both flat and Files Reviewed (7 files)
Reviewed by deepseek-v4-pro · 522,381 tokens Review guidance: REVIEW.md from base branch |
chrarnoldus
approved these changes
Jun 17, 2026
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.
Summary
When an OpenRouter request resolves to a model whose only providers are excluded by the org's provider routing settings, OpenRouter returns a raw 404 ("No allowed providers are available for the selected model") that surfaced to users as an opaque "Not Found". This adds a step in the LLM proxy error path that detects that specific response and rewrites it into a structured, actionable error, and teaches the code-review failure classifier to treat it as a known model-availability problem.
Changes
providerNotAllowedResponseinllm-proxy-helpers.ts. It only acts on OpenRouter 404 responses, validates the upstream body with zod (handling both the bare error shape and the{ error: ... }wrapped shape), and returns aprovider_not_allowederror with the message "No eligible provider can serve the selected model. Select another model or update the provider routing settings." Other providers and unrelated or malformed 404s pass through unchanged.makeErrorReadable, ahead of the context-overflow check.code-reviews/action-required.tsand in thecode-review-orchestrator.tsorchestrator: both now mapprovider_not_allowed/ "no eligible provider can serve the selected model" toselected_model_unavailableso code reviews fail with an action-required terminal reason instead of a generic error.makeErrorReadable(bare and wrapped shapes, wrong provider, malformed bodies), thecode-review-statusroute classifier, theaction-requiredclassifier, and an orchestrator integration test covering aprepareSessionprovider-routing failure.Verification
pnpm --filter web test llm-proxy-helpers action-requiredand thecode-review-infraorchestrator suite.Visual Changes
N/A
Reviewer Notes
The matched upstream message string ("No allowed providers are available for the selected model.") is duplicated as a literal in the zod schema and in the two classifier lists. If OpenRouter changes that wording, all three sites need updating.