fix(observability): demote unknown-provider list_models error (Sentry TAURI-RUST-X)
Summary
- Demote the user-config "no cloud provider with id or slug '
' found" error in inference_list_modelsfromerror!towarn!, so it stops escalating to Sentry as a code bug. - Embed
{err}in the survivingerror!format string so future genuinelist_modelsfailures land in Sentry with actionable titles instead of the opaque"[inference::ops] list_models:error"shape.
Why
Sentry TAURI-RUST-X has accumulated ~5740 events. Every event has the same opaque title because the emit site at src/openhuman/inference/ops.rs:248 was:
Err(err) => error!(error = %err, "{LOG_PREFIX} list_models:error"),
sentry-tracing ships this as a Sentry message of "[inference::ops] list_models:error"; the actual error sits in the Rust Tracing Fields.error context, which no body-level classifier in core::observability can reach (this is why none of the sibling "demote provider-config" classifiers caught it).
The latest event's underlying error: "no cloud provider with id or slug 'ollama' found" — emitted at src/openhuman/inference/provider/ops.rs:54 when the user picks a provider id (e.g. ollama, which is actually a local runtime) that isn't a registered cloud provider. User-config state, not a code bug. Actionable for the user (pick a registered provider, or configure Ollama via the local runtime path), not actionable for any developer reading Sentry.
What changed
- New helper
is_unknown_provider_user_config(err: &str) -> boolininference/ops.rs, anchored on the literal phrase fromprovider/ops.rs:54. Narrow on purpose so sibling failures stay observable. - Emit-site match arm in
inference_list_modelsnow:warn!on the user-config case → not picked up by sentry-tracing's error-level filtererror!on everything else, with{err}interpolated into the format string so the Sentry title carries the underlying cause and future events are triageable
- Tests added: positive (canonical emit-site phrase across well-formed slugs) + negative (sibling Sentry shapes TAURI-RUST-12 JSON parse, TAURI-RUST-2W reqwest builder, TAURI-RUST-JP local ollama_admin transport, plus generic timeout/permission/empty cases must still escalate).
Out of scope (noted for follow-up)
- The same
error!(..., "{LOG_PREFIX} <op>:error")template anti-pattern exists in ~6 otherinference::opsfunctions (status,summarize,update_local_settings, …). If those spike as their own Sentry issues, the same pattern (or an extractedlog_inference_result(op, result)helper) can address them. Not bundling here to keep the PR scoped to TAURI-RUST-X. - Complementary work in flight (
fix/sentry-28z-local-runtime-list-models, separate Sentry ID TAURI-RUST-28Z) makes Ollama/LMStudio lookups succeed by synthesizing transientcloud_providersentries. Different layer (provider/ops.rs, the source) vs. this PR (inference/ops.rs, the emit site). The two are complementary defense-in-depth: that PR removes most of the cases; this PR demotes any residual unknown-provider misconfigurations so they don't reappear as a new Sentry issue.
Test plan
- [x]
cargo test is_unknown_provider_user_config— 2 new tests pass (positive + negative) - [x]
cargo test openhuman::inference— 687 tests pass, 0 regressions - [x]
cargo check --manifest-path Cargo.toml --bin openhuman-core— passes - [x]
cargo fmt --checkon touched files — clean
Post-merge monitoring
Watch TAURI-RUST-X event rate drop to ~0 on the next release; any residual events should now carry the actual error string in their title (kept out of the Test-plan checklist because it's a follow-up observation, not a pre-merge gate — the PR Submission Checklist workflow only counts [x] items).
Summary by CodeRabbit
Release Notes
- Bug Fixes
- Enhanced error handling for cloud provider configuration issues with improved diagnostic logging
- Better distinction between user-configuration problems and system-level errors in application logs
- More detailed error messages to support troubleshooting and accelerate issue resolution
- Improved operational visibility through refined error categorization and more granular logging information
The PR refines error handling in the inference service by distinguishing user-configuration issues (missing cloud provider) from operational failures. A new helper function detects the specific error pattern and triggers log-level demotion from error to warn, improving visibility into root causes. Unit tests validate the detection logic across both matching and non-matching error variants. Provider Error Handling and Log Demotion 🎯 3 (Moderate) | ⏱️ ~20 minutes 🐰 A helper hops to catch the lost provider,
Warns when clouds drift away from user's desire,
Tests ensure false alarms ne'er collide,
Error logs cleaner, with nowhere to hide! 🌩️ ✏️ Tip: You can configure your own custom pre-merge checks in the settings.📝 Walkthrough
Walkthrough
Changes
Layer / File(s)
Summary
Unknown provider detection helper
src/openhuman/inference/ops.rsA private
is_unknown_provider_user_config helper using substring matching detects "no cloud provider with id or slug … found" errors; warn import is added to the tracing module imports.
Error handling log-level demotion
src/openhuman/inference/ops.rsinference_list_models error handling branches on the helper: unknown provider errors log at warn! with provider_id, other errors log at error! with the underlying error text included.
Detection helper validation tests
src/openhuman/inference/ops_tests.rsTwo unit test suites: positive validation that the helper matches the canonical provider-not-found message with various provider_id values, and negative validation that representative error messages (parse, HTTP, transport, timeout, permission issues) correctly return false.
Estimated code review effort
Suggested labels
working, bugSuggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name
Status
Explanation
Title check
✅ Passed
The title directly describes the primary change: demoting a specific unknown-provider error in list_models from error to warn level for better observability.
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.
Description Check
✅ Passed
Check skipped - CodeRabbit’s high-level summary is enabled.
Comment @coderabbitai help to get the list of available commands and usage tips.