fix(observability): demote responses usage-limit caps#4239
Conversation
📝 WalkthroughWalkthroughExtends the existing quota-exhaustion classifier to match OpenAI Responses API ChangesQuota exhaustion: usage_limit_reached coverage
Doc link updates
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/openhuman/inference/provider/compatible_helpers.rs (1)
225-231: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a debug/trace breadcrumb on the new quota-exhausted branch.
This new error branch only emits the
info!demotion insidelog_provider_quota_exhausted, so the branch itself still lacks the debug/trace-level instrumentation required for new Rust control-flow paths here.Suggested change
} else if super::super::is_provider_quota_exhausted(&error) { + tracing::debug!( + operation = "responses_api", + provider = self.name.as_str(), + model, + status = status.as_u16(), + "responses_api matched provider quota exhaustion" + ); super::super::log_provider_quota_exhausted( "responses_api", self.name.as_str(), Some(model), status,As per coding guidelines, "Add debug logging to entry/exit, branches, external calls, retries/timeouts, state transitions, and errors using
log/tracingatdebug/tracelevel in Rust".🤖 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/compatible_helpers.rs` around lines 225 - 231, The new quota-exhausted branch in compatible_helpers::ResponsesApiProvider::... should add a debug/trace breadcrumb before or alongside the call to log_provider_quota_exhausted so the control-flow path is visible at debug/trace level. Update the quota-exhausted branch in this function to emit a trace/debug log with the provider name, model, and status before delegating, while keeping the existing info-level demotion in log_provider_quota_exhausted.Source: Coding guidelines
🤖 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/compatible_helpers.rs`:
- Around line 225-231: The new quota-exhausted branch in
compatible_helpers::ResponsesApiProvider::... should add a debug/trace
breadcrumb before or alongside the call to log_provider_quota_exhausted so the
control-flow path is visible at debug/trace level. Update the quota-exhausted
branch in this function to emit a trace/debug log with the provider name, model,
and status before delegating, while keeping the existing info-level demotion in
log_provider_quota_exhausted.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 325489cd-ab56-4f6d-8f50-737f1ba1b444
📒 Files selected for processing (10)
docs/README.de.mddocs/README.ja-JP.mddocs/README.ko.mddocs/README.ur-pk.mddocs/README.zh-CN.mddocs/agent-workflows/cursor-cloud-agents.mdsrc/core/observability.rssrc/openhuman/inference/provider/compatible_helpers.rssrc/openhuman/inference/provider/compatible_tests.rssrc/openhuman/inference/provider/ops/http_error.rs
Summary
usage_limit_reachedbodies.responses_apiemit-site demotion so 400 usage-cap responses still return errors without reporting to Sentry.Problem
usage_limit_reachedand “The usage limit has been reached”.should_report_provider_http_failure(400)and reports every background retry to Sentry.Solution
usage_limit_reachedandusage limit has been reachedtobody_indicates_quota_exhausted, preserving the existing shared single source of truth.chat_via_responsesquota arm before the report fallthrough, reusinglog_provider_quota_exhaustedwithoperation=responses_api.Submission Checklist
## Related— N/A: no coverage-matrix feature ID applies.docs/RELEASE-MANUAL-SMOKE.md) — N/A: observability filtering only.Closes #NNNin the## RelatedsectionImpact
usage_limit_reachedplan-cap retries are demoted from Sentry errors; generic 400/500/provider failures stay reportable.Related
AI Authored PR Metadata (required for Codex/Linear PRs)
Linear Issue
Commit & Branch
fix/GH-4180-responses-usage-limit9c3d7931840eb9a55e692fd4e527b56b3a221960Validation Run
pnpm --filter openhuman-app format:check— N/A: no app TS/CSS changes.pnpm typecheck— N/A: no frontend TypeScript changes.GGML_NATIVE=OFF cargo test --manifest-path Cargo.toml --lib quota_exhausted_matches_openai_responses_usage_limit_reachedfailed before implementation.GGML_NATIVE=OFF cargo test --manifest-path Cargo.toml --lib responses_api_usage_limit_reached_400_not_reported_to_sentryfailed before implementation.GGML_NATIVE=OFF cargo test --manifest-path Cargo.toml --lib usage_limitGGML_NATIVE=OFF cargo test --manifest-path Cargo.toml --lib quota_exhaustedcargo fmt --manifest-path Cargo.toml --checkgit diff --checkGGML_NATIVE=OFF cargo check --manifest-path Cargo.tomlValidation Blocked
command:N/Aerror:N/Aimpact:N/ABehavior Changes
Parity Contract
Duplicate / Superseded PR Handling
Summary by CodeRabbit
Documentation
Bug Fixes