fix(observability): classify list_models 404 as ProviderUserState (Sentry TAURI-RUST-YJ)#2873
Conversation
`inference/provider/ops.rs::list_models` probes a user-configured
custom-provider's `/models` endpoint. When the upstream returns 404
because the user pointed the base URL at something that doesn't host
a `/models` listing (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 `ProviderUserState`
so 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.
Anchor: `lower.starts_with("provider returned 404")` — the
`"provider returned NNN: "` prefix is emitted ONLY from this one
site (verified via grep across `src/`), so the prefix alone is a
sufficient anchor. **404 only**:
- 401 / 403 → BYO-key auth wall, must stay actionable (tinyhumansai#2286
contract preserved).
- 400 → typically a client-shape bug worth investigating.
- 429 / 5xx → transient / server faults, retried at provider layer.
Targets Sentry OPENHUMAN-TAURI-YJ (issue 1207): 4 events between
2026-05-19 and 2026-05-27 across v0.54.0 and v0.56.0, all
`domain=rpc method=openhuman.inference_list_models`.
Tests pin the verbatim Sentry payload, three additional body-shape
variants (FastAPI `{"detail":...}`, bare HTML, post-`truncate_with_ellipsis`
clipped body), and a discrimination guard exercising every sibling
4xx / 5xx code from the same emit site to confirm only 404 demotes.
|
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)
📝 WalkthroughWalkthroughThis PR adds a single classification rule to demote ChangesProvider 404 observability classification
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
|
Actionable comments posted: 0 |
Summary
Rebased version of #2793 by @CodeGhost21 on the latest
upstream/main. The original PR's CI failed because a new test (classifies_embedding_api_invalid_token_401_as_session_expired) was added to main via #2869 after the branch was cut, and the stale base couldn't pass it.This branch is identical in intent to #2793 — only rebased to include the session-expired ordering fix from main (PR #2786/#2869).
No functional changes from #2793: the single new branch in
is_provider_user_state_messageand its two tests are preserved exactly.inference/provider/ops.rs::list_modelsprobes a user-configured custom-provider's/modelsendpoint. When the upstream returns 404 (wrong base URL, model-only proxy, typo'd path), the wire shape"provider returned 404: {<body>}"was unclassified and filed a Sentry event.lower.starts_with("provider returned 404")→ProviderUserState.Closes #2793.
Test plan
classifies_list_models_404_as_provider_user_state— pins verbatim Sentry payload + 3 body-shape variantsdoes_not_classify_non_404_list_models_failures_as_user_state— exercises every sibling status codeclassifies_embedding_api_invalid_token_401_as_session_expiredfrom main)Summary by CodeRabbit
Bug Fixes