fix(kiro): count active bonus credits as their own quota window #21811
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.40) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 291 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.340
Real PR Conversation Timeline
1 comments
"Review active on #21811"
general
weight: 0.35
coderabbitai[bot]
Summary
FIRST_UPGRADE_TRIAL500 credits of a first Pro upgrade, valid for a year.GetUsageLimitslists them under the breakdown'sbonuses, and Kiro spends them after the monthly credits run out, so an account whose monthly limit is spent still serves requests.buildKiroUsageResult()ignoredbonuses. Such an account reported only the spentcreditwindow, and quota-aware selection skipped it as exhausted while it still had hundreds of credits. When it was the last Kiro account with balance for a paid model, every request for that model failed.<resource>_bonuswindow (e.g.credit_bonus) that resets at the earliest expiry. Quota-aware selection treats an account as exhausted only when every window is spent, so the account stays routable while its bonus lasts. Accounts without bonuses are unchanged.Related Issues
Target Branch
release/v3.8.55branchValidation
buildKiroUsageResultor the Kiro usage fetcher rerun (48 tests, all pass);npm run typecheck:coreclean; eslint and prettier clean on the changed filesnpm run lint(full run left to CI)credit_bonuswindow showed the remaining balance and a paid-model request was served by it.Tests Added Or Updated
tests/unit/kiro-bonus-credits-usage.test.ts(new)Coverage Notes
bonuseslist), a fully spent bonus, and thatisExhausted(normalizeQuotas(...))is false with bonus balance and true without.Reviewer Notes
expiresAtis epoch seconds inGetUsageLimits; milliseconds are accepted too.credit.