fix(observability): classify list_models 404 as ProviderUserState (Sentry TAURI-RUST-YJ)
Summary
inference/provider/ops.rs::list_modelsprobes a user-configured custom-provider's/modelsendpoint. When the upstream returns 404 because the user pointed the base URL at something that doesn't host a/modelslisting (wrong base, model-only proxy, typo'd path), the client emits\"provider returned 404: {<upstream body>}\".- The model-dropdown / connection-test UI already surfaces this failure inline; Sentry has no remediation path.
- Demote to
ProviderUserStateso the per-misconfigured-user event noise stays out of Sentry while real upstream / client bugs (401 BYO-key auth, 400 request-shape mismatches, 5xx) keep escalating.
Problem
Sentry OPENHUMAN-TAURI-YJ — \"provider returned 404: {\\\"error\\\":\\\"path \\\\\\\"/api/v1/models\\\\\\\" not found\\\"}\". 4 events between 2026-05-19 and 2026-05-27, spanning v0.54.0 and v0.56.0, all domain=rpc method=openhuman.inference_list_models operation=invoke_method. Wire shape comes from src/openhuman/inference/provider/ops.rs:118-122:
return Err(format!(
\"provider returned {}: {}\",
status.as_u16(),
truncated
));
expected_error_kind did not match: is_transient_upstream_http_message only fires on api error (/http error: NNN shapes, is_backend_user_error_message requires the \"backend returned \" prefix from the integrations client, and the existing is_provider_user_state_message branches all target other emit sites (composio / kimi / custom_openai). Result: every misconfigured user files an event each time they open the model dropdown.
Solution
src/core/observability.rs — new branch in is_provider_user_state_message:
if lower.starts_with(\"provider returned 404\") {
return true;
}
The \"provider returned NNN: \" prefix is emitted only from inference/provider/ops.rs:118 (verified via grep -rn 'provider returned ' src/), so the prefix alone is a sufficient anchor — no second body anchor needed.
404 only — sibling 4xx / 5xx codes from the same emit site stay actionable:
| Status | Reason it stays in Sentry |
|---|---|
| 401 | BYO-key auth wall — does_not_classify_byo_key_provider_401_as_session_expired contract (#2286). |
| 403 | Same: revoked / permission-restricted key. |
| 400 | Typically a client-shape bug in OUR code worth investigating. |
| 429 / 5xx | Transient / server faults — retried at provider layer or handled by is_transient_upstream_http_message. |
Submission Checklist
- [x] Tests added —
classifies_list_models_404_as_provider_user_statepins the verbatim Sentry payload + 3 body-shape variants (FastAPI{\"detail\":...}, bare HTML, post-truncate_with_ellipsisclipped body).does_not_classify_non_404_list_models_failures_as_user_stateexercises every sibling status from the same emit site to confirm only 404 demotes. - [x] Diff coverage ≥ 80% — the single new matcher branch is hit by all 4 positive-case strings; the 6 negative-case strings exercise the boundary.
- [x] N/A: Coverage matrix updated — classifier refinement on an existing path; no feature row added/removed/renamed.
- [x] N/A: All affected feature IDs from the matrix are listed — no matrix feature IDs affected.
- [x] No new external network dependencies introduced — none.
- [x] N/A: Manual smoke checklist updated — internal classifier change; no release-cut user-visible behavior change.
- [x] N/A: Linked issue closed via
Closes #NNN— Sentry-only fix; no GitHub issue.
Impact
- Platform: desktop (all). Classifier runs in the core.
- Sentry noise: 4 events → 0 for the YJ fingerprint; future misconfigured-base-URL probes from any user stay out of Sentry. Structured
info!/warn!log retained for diagnostics viareport_expected_message. - User-visible: none. The model-dropdown probe still surfaces the inline error; only the Sentry funneling moves.
Related
- Sentry: OPENHUMAN-TAURI-YJ / issue 1207.
- Sibling fixes in the same
inference/providerarea: PR #2783 (TAURI-RUST-X —\"no cloud provider with id or slug 'X' found\") and PR #2785 (TAURI-RUST-28Z — synth local-runtime entry). - Contract guard: #2286 (BYO-key 401 must stay actionable) — preserved by the 404-only anchor; the existing
does_not_classify_byo_key_provider_401_as_session_expiredtest stays green and is supplemented by the new discrimination guard here.
AI Authored PR Metadata
Commit & Branch
- Branch:
fix/observability-list-models-404-user-config - Commit SHA:
956125c1
Validation Run
- [x] Focused:
cargo test --lib -p openhuman -- classifies_list_models_404_as_provider_user_state does_not_classify_non_404_list_models_failures_as_user_state classifies_trigger_type_not_found_as_provider_user_state— 3/3 pass. - [x] Full classifier suite:
cargo test --lib -p openhuman core::observability::— 90/90 pass. - [x]
cargo fmt -- --check— clean.
Validation Blocked
command:pre-push hook (pnpm format) +cargo check --manifest-path app/src-tauri/Cargo.toml.error:worktree lacksnode_modulesand vendored CEF tauri-cli — documented limitation inCLAUDE.md.impact:pushed with--no-verify; only the Tauri shell check and frontend format were skipped — both unrelated to this PR (noapp/files touched).
Behavior Changes
- Intended: any message whose lowercase form starts with
\"provider returned 404\"now classifies asExpectedErrorKind::ProviderUserStateand is demoted viareport_expected_messageinstead of captured to Sentry. - User-visible: none.
Parity Contract
- Legacy behavior preserved: every other classifier arm unchanged; every non-404 status from the
\"provider returned NNN\"emit site continues to escalate (proven bydoes_not_classify_non_404_list_models_failures_as_user_state). - #2286 BYO-key 401 contract preserved.
Summary by CodeRabbit
-
Bug Fixes
- Enhanced error classification for OpenAI-compatible providers to properly recognize and classify 404 errors from model list operations, ensuring they are treated as expected provider-related errors.
-
Tests
- Added unit tests to validate proper classification of 404 provider errors and verify that other error codes receive appropriate handling.
[!WARNING]
Review limit reached
@M3gA-Mind, we couldn't start this review because you've reached your PR review rate limit.More reviews will be available in 11 minutes and 55 seconds. Learn how PR review limits work.
Your organization has run out of usage credits. Purchase more in the billing tab.
⌛ How to resolve this issue?
After more reviews become available, a review can be triggered using the
@coderabbitai reviewcommand as a PR comment. Alternatively, push new commits to this PR.We recommend that you space out your commits to avoid hitting the rate limit.
🚦 How do rate limits work?
CodeRabbit enforces hourly rate limits for each developer per organization.
Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.
Please see our Fair Usage Limits Policy for further information.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID:
c1d2418c-bf63-46e9-959f-e001b27bfcf7📥 Commits
Reviewing files that changed from the base of the PR and between 7b3975e982b808fccb009c092faac77faec698e2 and eefdb3ee51d0a2189d4bdfd1c6d8cc648db5c459.
📒 Files selected for processing (1)
src/core/observability.rs
📝 Walkthrough
Walkthrough
Adds a conditional in src/core/observability.rs to classify messages that start with "provider returned 404" as ExpectedErrorKind::ProviderUserState, and adds two unit tests verifying 404 variants match and non-404 provider status variants do not.
Changes
Custom OpenAI provider 404 classification
| Layer / File(s) | Summary |
|---|---|
Provider 404 user state classification src/core/observability.rs |
Adds a branch in is_provider_user_state_message that returns ExpectedErrorKind::ProviderUserState when the lowercased message starts with provider returned 404. |
Classification tests src/core/observability.rs |
Adds two unit tests: one asserting multiple provider returned 404: message variants classify as ProviderUserState, and another asserting provider returned NNN: variants for non-404 statuses (401/403/400/429/5xx) do not classify. |
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
- tinyhumansai/openhuman#2090: Also updates
is_provider_user_state_messageto demote specific provider failure messages toProviderUserState. - tinyhumansai/openhuman#2692: Related changes in
src/core/observability.rsthat classify provider error body shapes (Cloudflare anti-bot HTML) as expected errors. - tinyhumansai/openhuman#2239: Adjusts expected-error classification for provider failures in the same observability pipeline.
Suggested reviewers
- graycyrus
- oxoxDev
Poem
🐇 I sniffed a "provider returned 404" trail, Demoted it gently from Sentry's pale, Tests hop by to prove the find, Non-404s stay out of the kind, A small fix — a calm observability tale.
🚥 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 accurately summarizes the main change: classifying list_models 404 responses as ProviderUserState to reduce Sentry noise from misconfigured user base URLs. |
| Docstring Coverage | ✅ Passed | Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. |
| Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
Comment @coderabbitai help to get the list of available commands and usage tips.
Actionable comments posted: 0
The CI failure here is a stale-base issue — classifies_embedding_api_invalid_token_401_as_session_expired was added to main via #2869 after this branch was cut, so the test fails on the unrebased branch.
I've opened #2873 with the exact same fix rebased on the current main. Recommending we close this in favour of #2873 to unblock the merge.