huskies: merge 856

This commit is contained in:
dave
2026-04-29 21:28:41 +00:00
parent db526bbdb2
commit a7b1572693
13 changed files with 319 additions and 36 deletions
@@ -21,6 +21,13 @@ pub enum EventAction {
OAuthAccountSwapped,
/// Post an OAuth accounts-exhausted notification with the earliest reset time.
OAuthAccountsExhausted,
/// Post an agent-started (running) notification.
AgentStarted,
/// Post an agent-completed notification with pass/fail result.
AgentCompleted {
/// `true` if acceptance gates passed.
success: bool,
},
/// Log server-side only; do not post to chat (e.g. hard rate-limit blocks).
LogOnly,
/// Reload the project configuration.
@@ -48,6 +55,10 @@ pub fn classify(event: &WatcherEvent) -> EventAction {
WatcherEvent::ConfigChanged => EventAction::ReloadConfig,
WatcherEvent::OAuthAccountSwapped { .. } => EventAction::OAuthAccountSwapped,
WatcherEvent::OAuthAccountsExhausted { .. } => EventAction::OAuthAccountsExhausted,
WatcherEvent::AgentStarted { .. } => EventAction::AgentStarted,
WatcherEvent::AgentCompleted { success, .. } => {
EventAction::AgentCompleted { success: *success }
}
_ => EventAction::Skip,
}
}
@@ -138,4 +149,39 @@ mod tests {
};
assert_eq!(classify(&event), EventAction::OAuthAccountsExhausted);
}
#[test]
fn agent_started_is_classified_correctly() {
let event = WatcherEvent::AgentStarted {
story_id: "1_story_foo".to_string(),
agent_name: "coder-1".to_string(),
};
assert_eq!(classify(&event), EventAction::AgentStarted);
}
#[test]
fn agent_completed_success_is_classified_correctly() {
let event = WatcherEvent::AgentCompleted {
story_id: "1_story_foo".to_string(),
agent_name: "coder-1".to_string(),
success: true,
};
assert_eq!(
classify(&event),
EventAction::AgentCompleted { success: true }
);
}
#[test]
fn agent_completed_failure_is_classified_correctly() {
let event = WatcherEvent::AgentCompleted {
story_id: "1_story_foo".to_string(),
agent_name: "coder-1".to_string(),
success: false,
};
assert_eq!(
classify(&event),
EventAction::AgentCompleted { success: false }
);
}
}