feat(ai-monitoring): Fetch model context size and rename task to fetch_ai_model_info #112656
@sentry/warden / warden
completed
Apr 15, 2026 in 2m 30s
1 issue
Medium
Missing JSONDecodeError handling when parsing OpenRouter API response - `src/sentry/tasks/ai_agent_monitoring.py:423`
The _fetch_openrouter_models_metadata function calls response.json() without catching JSONDecodeError. External APIs can return HTML error pages (e.g., CDN errors, rate limit pages) that return HTTP 200 but contain non-JSON content. This matches the production bug pattern SENTRY-5CKF (30,593 events) where webhook bodies were truncated. If OpenRouter returns malformed JSON, the task fails with an unclear JSONDecodeError instead of a graceful warning.
Also found at:
src/sentry/tasks/ai_agent_monitoring.py:499
2 skills analyzed
| Skill | Findings | Duration | Cost |
|---|---|---|---|
| sentry-security | 0 | 1m 36s | $0.53 |
| sentry-backend-bugs | 1 | 2m 13s | $0.86 |
Duration: 3m 48s · Tokens: 1.0M in / 16.3k out · Cost: $1.41 (+extraction: $0.01, +merge: $0.00, +dedup: $0.01)
Loading