huskies: merge 994

This commit is contained in:
dave
2026-05-13 22:38:51 +00:00
parent 1ee23e7bfe
commit a5cd3a2152
8 changed files with 121 additions and 26 deletions
+27 -2
View File
@@ -89,6 +89,30 @@ pub enum AgentStatus {
Failed,
}
/// The execution state of a rate-limited agent session.
///
/// Replaces the legacy `throttled: bool` flag, carrying the expiry time so
/// the scheduler can decide when to allow a retry rather than skipping
/// indefinitely.
#[derive(Debug, Clone, Serialize, PartialEq)]
#[serde(tag = "type", rename_all = "snake_case")]
pub enum AgentExecution {
/// The agent hit a rate-limit and is paused until `until`.
Throttled {
/// UTC instant at which the rate limit expires and the agent may resume.
until: chrono::DateTime<chrono::Utc>,
},
}
impl AgentExecution {
/// Return `true` if the throttle period has not yet elapsed.
pub fn is_active(&self) -> bool {
match self {
Self::Throttled { until } => chrono::Utc::now() < *until,
}
}
}
/// Why an agent was forcibly terminated by the watchdog.
#[derive(Debug, Clone, Serialize, PartialEq)]
#[serde(rename_all = "snake_case")]
@@ -236,8 +260,9 @@ pub struct AgentInfo {
pub completion: Option<CompletionReport>,
/// UUID identifying the persistent log file for this session.
pub log_session_id: Option<String>,
/// True when a rate-limit throttle warning was received for this agent.
pub throttled: bool,
/// Set when the agent is rate-limited; holds the UTC expiry time.
/// `None` when the agent is not throttled.
pub throttled: Option<chrono::DateTime<chrono::Utc>>,
/// Set when the watchdog terminates the agent for exceeding a limit.
pub termination_reason: Option<TerminationReason>,
}