fix(observability): classify Kimi access_terminated 403 as expected provider user-state#2090
Conversation
- Added a new function to check for provider access policy denials based on HTTP 403 responses, specifically for cases where requests are rejected for not being from approved coding agents. - Introduced logging for these denials to avoid reporting them to Sentry. - Updated tests to verify the correct classification of access-terminated errors as provider user state messages.
|
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)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughDetects 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. ChangesProvider Access Policy Denial Handling
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/openhuman/inference/provider/ops.rs (1)
317-326: ⚡ Quick winUse debug/trace level for this diagnostic suppression log.
This branch is diagnostic observability flow; align it with repo logging-level policy.
Suggested change
- tracing::info!( + tracing::debug!( domain = "llm_provider", operation = operation, provider = provider, model = model.unwrap_or(""), status = status.as_u16(), failure = "non_2xx", kind = "provider_access_policy", "[llm_provider] {operation} provider access-policy 403 — not reporting to Sentry" );As per coding guidelines:
src/**/*.rs: Uselogortracingcrate atdebugortracelevel for Rust diagnostic logs.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/openhuman/inference/provider/ops.rs` around lines 317 - 326, The observability log in ops.rs currently uses tracing::info! for the provider access-policy 403 diagnostic; change it to a lower level (tracing::debug! or tracing::trace!) per repo policy so this diagnostic suppression log is not at info level—locate the tracing::info! call (the invocation that includes fields domain="llm_provider", operation, provider, model.unwrap_or(""), status.as_u16(), failure="non_2xx", kind="provider_access_policy") and replace the macro with tracing::debug! (or tracing::trace!) while keeping the same structured fields and message text.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/openhuman/inference/provider/ops.rs`:
- Around line 317-326: The observability log in ops.rs currently uses
tracing::info! for the provider access-policy 403 diagnostic; change it to a
lower level (tracing::debug! or tracing::trace!) per repo policy so this
diagnostic suppression log is not at info level—locate the tracing::info! call
(the invocation that includes fields domain="llm_provider", operation, provider,
model.unwrap_or(""), status.as_u16(), failure="non_2xx",
kind="provider_access_policy") and replace the macro with tracing::debug! (or
tracing::trace!) while keeping the same structured fields and message text.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 1532b9dd-10de-4204-8f09-26ff4d3e2ef8
📒 Files selected for processing (3)
src/core/observability.rssrc/openhuman/inference/provider/compatible.rssrc/openhuman/inference/provider/ops.rs
# Conflicts: # src/openhuman/inference/provider/ops.rs
| model: Option<&str>, | ||
| status: reqwest::StatusCode, | ||
| ) { | ||
| tracing::info!( |
There was a problem hiding this comment.
Deferring this nitpick. The two sibling demotion-log helpers in this same file — log_budget_exhausted_http_400 and log_provider_config_rejection (added on main) — both use tracing::info!. Switching just this one to debug! would break the established pattern for "non-2xx user-state suppressed from Sentry" diagnostic logs. Happy to revisit in a follow-up that demotes all three together if repo policy prefers debug!.
Summary
access_terminated_error) in the inference provider ops layer.responses_api,streaming_chat,chat_completions,native_chat,stream_chat) to avoid noisy per-attempt Sentry error reports.ProviderUserState.Problem
OPENHUMAN-TAURI-S7(7486075476) was repeatedly triggered bycustom_openairequests routed tokimi-for-coding.access_terminated_error(“currently only available for Coding Agents”), which is a provider policy/user-access condition, not an OpenHuman runtime defect.Solution
is_provider_access_policy_denied_http_403(status, body)in provider ops to detect the exact 403 access-policy pattern.log_provider_access_policy_denied_http_403(...)and used it as a suppression branch beforereport_error(...)in all compatible provider HTTP failure handlers.is_provider_user_state_message) to detectaccess_terminated_error/ “currently only available for coding agents”, ensuring upstream re-wrapped errors are also demoted consistently.Related
OPENHUMAN-TAURI-S7(7486075476)N/A— observability/error-classification hardening change (no feature-matrix row updated)N/A— no linked upstream issue number provided (Closes #NNNnot included)Submission Checklist
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.docs/TEST-COVERAGE-MATRIX.mdreflect this change (orN/A: behaviour-only change) —N/A: behaviour-only observability classification## Related—N/A: no matrix feature IDs applydocs/RELEASE-MANUAL-SMOKE.md) —N/A: does not touch release UI/runtime flowsCloses #NNNin the## Relatedsection —N/A: no GitHub issue number providedImpact
Related
Summary by CodeRabbit