90b31fc84f
When claude-code emits a rate_limit_event with status != allowed_warning, the subprocess waits internally for the limit to clear before retrying. No PTY output flows during that window, so the inactivity timeout in the PTY runner would fire and kill the agent — mergemaster especially, whose 15-minute inactivity window is shorter than typical rate-limit backoffs. Track `block_until = Some(reset_at)` on hard-block events and add the remaining time-until-reset to the per-iteration recv timeout. Once reset_at passes (or an earlier emit arrives), the extension implicitly drops to 0 and the base inactivity timeout resumes. Turn/budget counts aren't affected — they come from the session log and only advance when API calls actually complete, so a stalled retry doesn't burn either. Regression test in agents/pty/mod.rs spawns a script that emits a hard-block with reset_at = now+3s, sleeps 3s, then exits, with inactivity_timeout_secs = 1. Without the fix the runner kills the script at 1s; with the fix the deadline is bumped past the sleep and the run completes cleanly. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>