fix(inference): return empty model list on 404 from /models endpoint#2939
Conversation
Many OpenAI-compatible providers (DeepSeek, Kimi, Moonshot, custom proxies) do not implement the /models discovery endpoint and return 404. The previous code treated this as an error, which propagated up through `inference_list_models` and fired a Sentry event for each call. Fix: when the /models endpoint returns 404, return an empty model list with `unsupported: true` instead of erroring. Providers without model listing are expected — not all providers expose /models. Closes tinyhumansai#2938, resolves Sentry TAURI-RUST-1Z (819 events).
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe change modifies provider model listing to gracefully handle HTTP 404 responses as "unsupported" rather than errors. When a provider's Changes404 Handling and Test
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
…p only the intended tinyhumansai#2939/tinyhumansai#2899 reverts The PR branch predated tinyhumansai#2748 (Codex OAuth provider support), so merging current main auto-resolved provider/ops.rs toward the stale PR side — silently dropping tinyhumansai#2748's OAuth routing, the `data`/`models` envelope fallback, and `model_info_from_catalog_item`. tinyhumansai#2748 is NOT in the revert list, so this was an unintended regression. Restore main's provider/ops.rs (and its extracted ops_tests.rs) and re-apply ONLY the author's two intended Sentry-suppression reverts: - tinyhumansai#2939: list_models 404 no longer returns a synthetic `{unsupported: true}` success — it surfaces as an error so the failure fires to Sentry. - tinyhumansai#2899: api_error no longer suppresses rate-limit-body Sentry reports on non-429 responses. Their two suppression-specific test blocks are removed to match. Co-Authored-By: Claude <noreply@anthropic.com>
…ehavior Main's raw-coverage e2e tests asserted the tinyhumansai#2939 404→`unsupported:true` suppression. With that branch reverted, a 404 from /models now surfaces as an error ("provider returned 404: …"), so update the three affected assertions (direct calls + the inference_list_models RPC path) to expect the error. Co-Authored-By: Claude <noreply@anthropic.com>
Summary
inference_list_modelscalls the provider's/modelsendpoint. Many OpenAI-compatible providers (DeepSeek, Kimi, Moonshot, custom proxies) do not implement this endpoint and return 404. The previous code treated any non-2xx response as an error, causing a Sentry event for each call — 819 events across multiple releases (Sentry issue TAURI-RUST-1Z)./modelsendpoint returns HTTP 404, return a successful RPC outcome with an emptymodelsarray andunsupported: true, instead of propagating an error. All other non-2xx statuses continue to return errors normally.models_404_returns_empty_list_not_errorintegration test that spins up a minimal axum server returning 404 on/models, then asserts the empty-list outcome.Changes
src/openhuman/inference/provider/ops.rs: intercept 404 inlist_configured_models_from_configand return{ models: [], unsupported: true }with adebug!log instead of propagating an error. Added unit test covering this path.Test plan
cargo checkcleancargo test -p openhuman --lib -- "inference::provider::ops"— 25/25 pass including new testCloses #2938
Summary by CodeRabbit
Bug Fixes
Tests