From fa5885154ba0cfc06ceddf340eb91fd084436abd Mon Sep 17 00:00:00 2001 From: dave Date: Tue, 7 Apr 2026 14:57:20 +0000 Subject: [PATCH] huskies: create 496_bug_hard_rate_limit_without_reset_at_never_auto_schedules_retry --- ...out_reset_at_never_auto_schedules_retry.md | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .huskies/work/1_backlog/496_bug_hard_rate_limit_without_reset_at_never_auto_schedules_retry.md diff --git a/.huskies/work/1_backlog/496_bug_hard_rate_limit_without_reset_at_never_auto_schedules_retry.md b/.huskies/work/1_backlog/496_bug_hard_rate_limit_without_reset_at_never_auto_schedules_retry.md new file mode 100644 index 00000000..553d6309 --- /dev/null +++ b/.huskies/work/1_backlog/496_bug_hard_rate_limit_without_reset_at_never_auto_schedules_retry.md @@ -0,0 +1,34 @@ +--- +name: "Hard rate limit without reset_at never auto-schedules retry" +--- + +# Bug 496: Hard rate limit without reset_at never auto-schedules retry + +## Description + +When the API returns a hard rate limit block (`status=rejected`) without a `reset_at` timestamp, `pty.rs` downgrades it to a `RateLimitWarning` instead of a `RateLimitHardBlock`. The auto-scheduler only listens for `RateLimitHardBlock` events, so no timer is set and the agent is never restarted. The agent sits idle until the 300s inactivity timeout kills it, and the story is stuck. + +In practice, most hard blocks come without `reset_at` (as seen in the logs: "no reset_at in rate_limit_info"). This means the auto-resume feature from story 423 almost never fires. + +Fix: when there's a hard block without `reset_at`, either: +1. Send `RateLimitHardBlock` with a default backoff time (e.g. `Utc::now() + 5 minutes`) +2. Or add a separate retry mechanism that doesn't depend on knowing the exact reset time + +## How to Reproduce + +1. Run an agent that hits the API rate limit +2. Observe logs show "no reset_at in rate_limit_info" +3. Agent gets killed by inactivity timeout +4. Story sits in current with no agent, never restarted + +## Actual Result + +Hard block without reset_at is downgraded to RateLimitWarning. No timer set. Agent dies and story is stuck. + +## Expected Result + +Hard block without reset_at triggers a retry with a default backoff (e.g. 5 minutes). Agent is automatically restarted when the backoff expires. + +## Acceptance Criteria + +- [ ] Bug is fixed and verified