huskies: merge 1053

This commit is contained in:
dave
2026-05-14 18:32:43 +00:00
parent bb5abcd042
commit 96e227d8d4
7 changed files with 215 additions and 0 deletions
+10
View File
@@ -261,6 +261,10 @@ fn run_agent_pty_blocking(
// earlier-than-expected emit), the extension implicitly drops back to 0
// and the base inactivity timeout resumes (story 916).
let mut block_until: Option<chrono::DateTime<chrono::Utc>> = None;
// Track whether a rate-limit hard block was seen so the completion handler
// can distinguish a rate-limit exit from a genuine no-progress exit (bug 1053).
let mut rate_limit_hard_block_seen = false;
let mut rate_limit_reset_at_captured: Option<chrono::DateTime<chrono::Utc>> = None;
loop {
let effective_timeout = base_timeout.map(|base| {
@@ -388,6 +392,10 @@ fn run_agent_pty_blocking(
default
}
};
// Mark that a hard block was seen so the completion handler
// can distinguish this exit from a genuine no-progress exit.
rate_limit_hard_block_seen = true;
rate_limit_reset_at_captured = Some(reset_at);
// Pause the inactivity clock until the rate limit resets
// (story 916). Without this the watchdog kills the agent
// mid-wait — mergemaster especially, whose 15-minute
@@ -480,5 +488,7 @@ fn run_agent_pty_blocking(
session_id,
token_usage,
exit_ok,
rate_limit_exit: rate_limit_hard_block_seen,
rate_limit_reset_at: rate_limit_reset_at_captured,
})
}
+9
View File
@@ -13,6 +13,15 @@ pub(in crate::agents) struct PtyResult {
/// `true` if the child process exited with a zero exit code (normal completion).
/// `false` if the process was killed by a signal or exited with a non-zero code.
pub exit_ok: bool,
/// `true` when a rate-limit hard block event was received during this session.
///
/// Detected by seeing a `rate_limit_event` with a non-`allowed_warning` status in
/// the PTY output. The completion handler uses this flag to distinguish a
/// rate-limit-forced exit from a genuine no-progress exit (bug 1053).
pub rate_limit_exit: bool,
/// When the API rate limit is scheduled to reset; `None` when no hard-block
/// event was seen or when the `reset_at` field was absent from the event.
pub rate_limit_reset_at: Option<chrono::DateTime<chrono::Utc>>,
}
pub(super) fn composite_key(story_id: &str, agent_name: &str) -> String {