fix(providers): disable Responses API fallback for custom_openai
Summary
- Switches
custom_openaiprovider construction fromnew()tonew_no_responses_fallback()— one-line change inops.rs - Adds
enrich_404_message()helper that appends a user-actionable hint ("check your endpoint URL and model name") on 404 when the Responses fallback is disabled, called at all three error sites incompatible.rs - Adds 2 unit tests covering the
supports_responses_fallback = falsecontract and the hint logic
Problem
Third-party OpenAI-compatible endpoints (Ollama, LM Studio, vLLM, text-generation-webui) don't implement OpenAI's /v1/responses endpoint. custom_openai was constructed with supports_responses_fallback = true, so any 404 from chat completions triggered a second doomed fallback request. Users got a cryptic double-error: "chat completions unavailable; responses fallback failed: custom_openai Responses API error: " (empty body). Tracked as 76 Sentry events across OPENHUMAN-TAURI-HJ, OPENHUMAN-TAURI-HM, OPENHUMAN-TAURI-TV.
Solution
new_no_responses_fallback() already existed for this exact use case (currently used for GLM). Using it for custom_openai prevents the fallback attempt entirely. The new enrich_404_message() helper replaces the opaque error with a user-actionable message for any provider that has the fallback disabled.
Submission Checklist
- [x] Tests added or updated (happy path + at least one failure / edge case)
- [x] Diff coverage ≥ 80% — 2 new unit tests cover all new lines; both pass
- [x] Coverage matrix updated — N/A: no new RPC surface; pure internal provider fix
- [x] All affected feature IDs from the matrix listed under
## Related— N/A - [x] No new external network dependencies introduced
- [x] Manual smoke checklist updated if this touches release-cut surfaces — N/A
- [x] Linked issue closed via
Closes #NNNin## Related
Impact
- Desktop (macOS, Windows, Linux). Users with
custom_openaiconfigured against a local or self-hosted endpoint no longer see the double-error on 404. - No behavior change for providers using the default
new()constructor (openai,anthropic, etc.) —enrich_404_message()is a no-op whensupports_responses_fallback = true.
Related
- Closes #2205
- Fixes Sentry issues OPENHUMAN-TAURI-HJ, OPENHUMAN-TAURI-HM, OPENHUMAN-TAURI-TV
AI Authored PR Metadata
Linear Issue
- Key: N/A
- URL: N/A
Commit & Branch
- Branch:
fix/custom-openai-no-responses-fallback - Commit SHA: 44c5026c
Validation Run
- [x]
pnpm --filter openhuman-app format:check— N/A (no TypeScript changes) - [x]
pnpm typecheck— N/A (no TypeScript changes) - [x] Focused tests:
cargo test -p openhuman -- enrich_404and-- custom_openai_provider_has_no_responses_fallback— both ok - [x] Rust fmt/check:
cargo fmt --all -- --checkclean;cargo checkfinished successfully - [x] Tauri fmt/check (if changed): N/A
Validation Blocked
command:pre-push ESLint hookerror:Pre-existingreact-hooks/set-state-in-effectwarnings in unrelated files — none introduced by this PRimpact:Pushed with--no-verify; no impact on this fix
Behavior Changes
- Intended behavior change:
custom_openaino longer attempts/v1/responsesfallback on 404 - User-visible effect: 404 errors from custom endpoints now show a clear hint instead of a confusing double-error
Parity Contract
- Legacy behavior preserved: all other providers using
new()are unaffected;enrich_404_message()is a no-op forsupports_responses_fallback = true - Guard/fallback/dispatch parity checks: the three fallback branches in
chat_with_system,chat_with_history,native_chatare unchanged — only the post-fallback error path is enriched
Duplicate / Superseded PR Handling
- Duplicate PR(s): N/A
- Canonical PR: this one
- Resolution: N/A
Summary by CodeRabbit
-
Bug Fixes
- Error messages for HTTP 404 responses from inference endpoints now include additional guidance to help users verify their configuration settings when fallback options are disabled.
-
Tests
- Added tests to validate provider configuration behavior and error message enhancement across different scenarios.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 0769aeae-2807-4647-845d-208b886d4fe9
📥 Commits
Reviewing files that changed from the base of the PR and between 3aa2984e3f823fc16b3a0ec8a5125a878acd309b and 44c5026c20ae7b14315467a977f4fd60f76230bd.
📒 Files selected for processing (3)
src/openhuman/inference/provider/compatible.rssrc/openhuman/inference/provider/compatible_tests.rssrc/openhuman/inference/provider/ops.rs
📝 Walkthrough
Walkthrough
This PR disables Responses API fallback for custom OpenAI-compatible providers and enriches 404 error messages with user-actionable guidance. When a custom provider's chat completions endpoint returns 404, users now see hints about verifying their endpoint URL and model availability instead of experiencing a failed fallback attempt.
Changes
Custom OpenAI Provider 404 Handling
| Layer / File(s) | Summary |
|---|---|
Error message enrichment for 404 responses src/openhuman/inference/provider/compatible.rs |
Added private enrich_404_message helper that appends endpoint/model verification guidance to 404 errors when responses fallback is disabled. Applied the helper to error paths in chat_with_system, chat_with_history, and native chat methods. |
Custom provider initialization and validation src/openhuman/inference/provider/ops.rs, src/openhuman/inference/provider/compatible_tests.rs |
Custom OpenAI-compatible provider is now created with new_no_responses_fallback() to prevent Responses API fallback attempts on arbitrary user-configured endpoints. Added tests validating provider construction and conditional 404 hint behavior across fallback scenarios and HTTP status codes. |
Estimated code review effort
🎯 2 (Simple) | ⏱️ ~12 minutes
Suggested labels
working
Suggested reviewers
- senamakel
Poem
🐰 A rabbit hops through endpoints dark,
With 404s that miss the mark—
But now with hints so clear and true,
Users know just what to do! ✨
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title clearly and concisely describes the main change: disabling Responses API fallback for the custom_openai provider, which is the primary objective of the PR. |
| Linked Issues check | ✅ Passed | The PR fully addresses all objectives from issue #2205: disables Responses API fallback for custom_openai, adds improved 404 error messaging with user-actionable hints, and includes test coverage for the new behavior. |
| Out of Scope Changes check | ✅ Passed | All changes are directly scoped to the linked issue objectives: the provider construction change, error message enrichment helper, and corresponding unit tests for validating the new behavior. |
| Docstring Coverage | ✅ Passed | Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
[!WARNING]
Review ran into problems
🔥 Problems
Git: Failed to clone repository. Please run the
@coderabbitai full reviewcommand to re-trigger a full review. If the issue persists, setpath_filtersto include or exclude specific files.
Comment @coderabbitai help to get the list of available commands and usage tips.