fix(observability): classify Kimi access_terminated 403 as expected provider user-state
Summary
- Added a new provider error classifier for HTTP 403 access-policy denials (
access_terminated_error) in the inference provider ops layer. - Wired this classifier into all OpenAI-compatible provider error paths (
responses_api,streaming_chat,chat_completions,native_chat,stream_chat) to avoid noisy per-attempt Sentry error reports. - Extended observability expected-error classification to map this Kimi-specific 403 shape into
ProviderUserState. - Added regression tests in both provider ops and observability to lock the behavior.
- Preserved existing behavior for actionable 4xx/5xx errors; only the targeted policy-denied shape is demoted.
Problem
- Sentry issue
OPENHUMAN-TAURI-S7(7486075476) was repeatedly triggered bycustom_openairequests routed tokimi-for-coding. - The upstream provider returns HTTP 403 with
access_terminated_error(“currently only available for Coding Agents”), which is a provider policy/user-access condition, not an OpenHuman runtime defect. - The previous behavior treated this as a regular error, generating high-noise unresolved events and masking actionable signals.
Solution
- Introduced
is_provider_access_policy_denied_http_403(status, body)in provider ops to detect the exact 403 access-policy pattern. - Added
log_provider_access_policy_denied_http_403(...)and used it as a suppression branch beforereport_error(...)in all compatible provider HTTP failure handlers. - Updated observability classifier (
is_provider_user_state_message) to detectaccess_terminated_error/ “currently only available for coding agents”, ensuring upstream re-wrapped errors are also demoted consistently. - Added tests:
- Provider ops: positive/negative coverage for 403 suppression matching.
- Observability: classification coverage for direct and wrapped error strings.
- Tradeoff: this does not “fix” provider access; it intentionally reclassifies known user/provider-state failures to reduce alert fatigue while preserving actionable remediation messaging.
Related
- Sentry issue:
OPENHUMAN-TAURI-S7(7486075476) - Feature IDs:
N/A— observability/error-classification hardening change (no feature-matrix row updated) - GitHub issue:
N/A— no linked upstream issue number provided (Closes #NNNnot included)
Submission Checklist
If a section does not apply to this change, mark the item as
N/Awith a one-line reason. Do not delete items.
- [x] Tests added or updated (happy path + at least one failure / edge case) per Testing Strategy
- [x] Diff coverage ≥ 80% — changed lines (Vitest + cargo-llvm-cov merged via
diff-cover) meet the gate enforced by.github/workflows/coverage.yml. Runpnpm test:coverageandpnpm test:rustlocally; PRs below 80% on changed lines will not merge. - [x] Coverage matrix updated — added/removed/renamed feature rows in
docs/TEST-COVERAGE-MATRIX.mdreflect this change (orN/A: behaviour-only change) —N/A: behaviour-only observability classification - [x] All affected feature IDs from the matrix are listed in the PR description under
## Related—N/A: no matrix feature IDs apply - [x] No new external network dependencies introduced (mock backend used per Testing Strategy)
- [x] Manual smoke checklist updated if this touches release-cut surfaces (
docs/RELEASE-MANUAL-SMOKE.md) —N/A: does not touch release UI/runtime flows - [x] Linked issue closed via
Closes #NNNin the## Relatedsection —N/A: no GitHub issue number provided
Impact
- Runtime/platform: Rust core observability/inference provider layers only; affects desktop runtime behavior for error reporting semantics.
- Performance: negligible (simple string/status checks on existing error path).
- Security: no credential or auth-scope expansion; reduces noisy logging path while retaining sanitized error handling.
- Compatibility: no API contract changes; only reclassification of a known provider-policy 403 from error-level Sentry to expected user-state handling.
Related
- Closes: OPENHUMAN-TAURI-S7
Summary by CodeRabbit
- Bug Fixes
- Improved detection of provider access-policy denials (including access-terminated cases) so they are classified correctly.
- Suppressed noisy error reporting for deterministic policy denials; these are logged at info level instead of being treated as system failures.
- Enhanced error handling across multiple request paths to distinguish policy denials from genuine provider failures.
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: fc4770d6-5a84-4fa3-97ad-e9de77ec0539
📥 Commits
Reviewing files that changed from the base of the PR and between 9260a8a2a207799d2913d983a2c6486f5b9f7f1d and d97ac970edbc931661b3edcbc571a304fd5d096e.
📒 Files selected for processing (1)
src/core/observability.rs
🚧 Files skipped from review as they are similar to previous changes (1)
- src/core/observability.rs
📝 Walkthrough
Walkthrough
Detects a specific provider access-policy 403 payload, logs it as an info (not reported to Sentry), classifies it as an expected provider user-state error in observability, and wires this handling into five request/response paths.
Changes
Provider Access Policy Denial Handling
| Layer / File(s) | Summary |
|---|---|
Observability classification for access-terminated provider errors src/core/observability.rs |
is_provider_user_state_message now matches access_terminated_error and "currently only available for coding agents" to classify these 403 bodies as ProviderUserState. Adds a unit test for direct and agent-wrapped messages. |
Access-policy denial detection and logging in ops src/openhuman/inference/provider/ops.rs |
Adds is_provider_access_policy_denied_http_403 predicate, log_provider_access_policy_denied_http_403 helper, integrates the predicate into api_error with a new branch that logs (info) instead of reporting to Sentry, and adds unit tests for the predicate. |
Integration across multiple API request paths src/openhuman/inference/provider/compatible.rs |
Five methods (Responses-API fallback, native streaming, chat_with_system, main native chat, stream_chat_with_system) each add a conditional branch that detects the access-policy 403 payload and calls the logging helper with the appropriate context tag before generic failure handling. |
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
- tinyhumansai/openhuman#1795: Related observability changes to classify provider-shaped errors as
ProviderUserState. - tinyhumansai/openhuman#2239: Related suppression of Sentry reporting for deterministic provider error payloads and updates to
api_errorflow.
Suggested reviewers
- graycyrus
- senamakel
Poem
🐰 A rabbit nods to graceful 403s,
Info logs whisper where alarms once rose.
Coding-agent gates now named and mild,
Five paths tuned gentle, errors reconciled.
Sentry sleeps; the logs are kind and styled.
🚥 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 summarizes the main change: classifying a specific provider HTTP 403 error pattern as an expected provider user-state condition. The change affects observability and error classification across three files with this as the unifying objective. |
| 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.