feat(423): auto-schedule timer on rate limit to resume after reset
- pty.rs: detect rate_limit_event hard blocks, parse reset_at, emit WatcherEvent::RateLimitHardBlock with story_id, agent_name, reset_at - watcher.rs: add RateLimitHardBlock variant to WatcherEvent enum - timer.rs: add TimerStore::upsert (add-or-update-to-later) and spawn_rate_limit_auto_scheduler (listens for RateLimitHardBlock, upserts timer for the blocked story) - notifications.rs: handle RateLimitHardBlock events with a debounced chat notification including the scheduled resume time; add format_rate_limit_hard_block_notification helper - matrix/mod.rs: subscribe second watcher_rx for auto-scheduler, pass it to run_bot - matrix/bot/run.rs: wire spawn_rate_limit_auto_scheduler into bot startup Tests cover: AC1 (hard block detection in pty), AC2 (auto-scheduler adds timer), AC3 (upsert deduplication), AC5 (chat notification sent), AC6 (worktree preserved — timer fires start_agent on existing worktree)
This commit is contained in:
@@ -75,6 +75,16 @@ pub enum WatcherEvent {
|
||||
/// Human-readable reason the story was blocked.
|
||||
reason: String,
|
||||
},
|
||||
/// An agent hit a hard API rate limit and will be blocked until `reset_at`.
|
||||
/// Triggers auto-scheduling of a timer and a notification with the resume time.
|
||||
RateLimitHardBlock {
|
||||
/// Work item ID the agent is working on.
|
||||
story_id: String,
|
||||
/// Name of the agent that hit the hard rate limit.
|
||||
agent_name: String,
|
||||
/// UTC instant at which the rate limit resets.
|
||||
reset_at: chrono::DateTime<chrono::Utc>,
|
||||
},
|
||||
}
|
||||
|
||||
/// Return `true` if `path` is the root-level `.storkit/project.toml`, i.e.
|
||||
|
||||
Reference in New Issue
Block a user