---
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
