Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

refactor(triage): fix indentation and expand chain evaluator tests

Steven Enamakel2da26dc9fd17
diff --git a/crates/openhuman-core/src/triage/evaluator/chain.rs b/crates/openhuman-core/src/triage/evaluator/chain.rs
index 7c74c647f1..c82486f037 100644
--- a/crates/openhuman-core/src/triage/evaluator/chain.rs
+++ b/crates/openhuman-core/src/triage/evaluator/chain.rs
@@ -231,11 +231,11 @@ where
match try_arm(&cloud, envelope, TriageResolutionPath::CloudAfterRetry).await {
Ok(run) => {
- clear_outage(retry_state, &retry_key, outage_attempt.as_mut());
+ clear_outage(retry_state, &retry_key, outage_attempt.as_mut());
return Ok(TriageOutcome::Decision(run));
}
Err(ArmError::Fatal(err)) => {
- clear_outage(retry_state, &retry_key, outage_attempt.as_mut());
+ clear_outage(retry_state, &retry_key, outage_attempt.as_mut());
return Err(err);
}
Err(ArmError::BudgetExhausted(err)) => {
diff --git a/crates/openhuman-core/src/triage/evaluator/chain_tests.rs b/crates/openhuman-core/src/triage/evaluator/chain_tests.rs
index d273981f44..79569ae7ee 100644
--- a/crates/openhuman-core/src/triage/evaluator/chain_tests.rs
+++ b/crates/openhuman-core/src/triage/evaluator/chain_tests.rs
@@ -18,14 +18,30 @@ fn only_one_initial_outage_attempt_can_be_in_flight() {
}
#[test]
-fn failed_attempt_after_concurrent_recovery_does_not_become_terminal() {
+fn unguarded_success_does_not_clear_another_in_flight_attempt() {
let state = new_retry_state();
let mut attempt = begin_outage_attempt(Some(&state), "stub-cloud").expect("attempt");
- clear_outage(Some(&mut attempt));
+ clear_outage(Some(&state), "stub-cloud", None);
+
+ assert!(begin_outage_attempt(Some(&state), "stub-cloud").is_none());
+ attempt.record_success();
+}
+
+#[test]
+fn stale_failure_after_concurrent_recovery_remains_deferred() {
+ let state = new_retry_state();
+ let mut attempt = begin_outage_attempt(Some(&state), "stub-cloud").expect("attempt");
+
+ clear_outage(Some(&state), "stub-cloud", Some(&mut attempt));
assert!(matches!(
record_outage(Some(&mut attempt)),
Some(TriageOutcome::Deferred { .. })
));
}
+
+#[test]
+fn in_flight_rejection_preserves_one_second_requeue_delay() {
+ assert_eq!(rejection_delay_ms(BreakerRejection::InFlight, 123), 1_000);
+}