Skip to content

fix(core): fail closed on RPD counter errors#79

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-inspection-a3b4
Draft

fix(core): fail closed on RPD counter errors#79
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-inspection-a3b4

Conversation

@cursor
Copy link
Copy Markdown

@cursor cursor Bot commented May 7, 2026

πŸ“ Description

What: fail closed when the bot or quiz Gemini RPD counter cannot be atomically updated in DynamoDB, and map that condition to existing provider-unavailable handling before any Gemini request is made.

Why: the previous ClientError path returned (0, True), which let production traffic bypass the daily RPD quota if DynamoDB throttled, IAM/table configuration broke, or the counter table was temporarily unavailable.

Verification:

  • python3 -m compileall -q src tests/test_rate_limit_fail_closed.py
  • python3 -m pytest tests/test_rate_limit_fail_closed.py (4 passed)

πŸš€ Type of Change

  • πŸ› Bug Fix (Fix an issue)
  • ✨ New Feature (Add a feature)
  • πŸ—οΈ Infrastructure (CDK/AWS resource changes)
  • ♻️ Refactoring (Code refactoring, no logic changes)
  • πŸ“š Documentation (Documentation update)

πŸ—οΈ Infrastructure Changes (Crucial)

  • Resources Created: None
  • Resources Modified: None
  • Resources Deleted: None
  • Cost Impact: Prevents quota/cost guard bypass during RPD counter failures.

βœ… Checklist

  • I have performed a self-review of my code.
  • I have run pre-commit run --all-files locally and fixed all issues.
  • I have added/updated Unit Tests (pytest).
  • My changes do not generate new warnings.
  • (If Infra change) I have run cdk diff locally to verify changes.

πŸ”— Related Issues

Open in WebΒ View AutomationΒ 

Co-authored-by: Bayashat <baiashat2002@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant