mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-04-10 11:23:32 +08:00
feat: escalate ecc2 chronic saturation
This commit is contained in:
@@ -80,6 +80,12 @@ impl DaemonActivity {
|
|||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn operator_escalation_required(&self) -> bool {
|
||||||
|
self.dispatch_cooloff_active()
|
||||||
|
&& self.chronic_saturation_streak >= 5
|
||||||
|
&& self.last_rebalance_rerouted == 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl StateStore {
|
impl StateStore {
|
||||||
@@ -1162,6 +1168,14 @@ mod tests {
|
|||||||
};
|
};
|
||||||
assert!(persistent.prefers_rebalance_first());
|
assert!(persistent.prefers_rebalance_first());
|
||||||
assert!(persistent.dispatch_cooloff_active());
|
assert!(persistent.dispatch_cooloff_active());
|
||||||
|
assert!(!persistent.operator_escalation_required());
|
||||||
|
|
||||||
|
let escalated = DaemonActivity {
|
||||||
|
chronic_saturation_streak: 5,
|
||||||
|
last_rebalance_rerouted: 0,
|
||||||
|
..persistent.clone()
|
||||||
|
};
|
||||||
|
assert!(escalated.operator_escalation_required());
|
||||||
|
|
||||||
let recovered = DaemonActivity {
|
let recovered = DaemonActivity {
|
||||||
last_recovery_dispatch_at: Some(now + chrono::Duration::seconds(1)),
|
last_recovery_dispatch_at: Some(now + chrono::Duration::seconds(1)),
|
||||||
|
|||||||
@@ -1576,6 +1576,12 @@ impl Dashboard {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if self.daemon_activity.operator_escalation_required() {
|
||||||
|
lines.push(
|
||||||
|
"Operator escalation recommended: chronic saturation is not clearing".into(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(cleared_at) = self.daemon_activity.chronic_saturation_cleared_at() {
|
if let Some(cleared_at) = self.daemon_activity.chronic_saturation_cleared_at() {
|
||||||
lines.push(format!(
|
lines.push(format!(
|
||||||
"Chronic saturation cleared @ {}",
|
"Chronic saturation cleared @ {}",
|
||||||
@@ -2349,6 +2355,37 @@ mod tests {
|
|||||||
assert!(text.contains("Chronic saturation streak 3 cycle(s)"));
|
assert!(text.contains("Chronic saturation streak 3 cycle(s)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn selected_session_metrics_text_recommends_operator_escalation_when_chronic_saturation_is_stuck() {
|
||||||
|
let mut dashboard = test_dashboard(
|
||||||
|
vec![sample_session(
|
||||||
|
"focus-12345678",
|
||||||
|
"planner",
|
||||||
|
SessionState::Running,
|
||||||
|
Some("ecc/focus"),
|
||||||
|
512,
|
||||||
|
42,
|
||||||
|
)],
|
||||||
|
0,
|
||||||
|
);
|
||||||
|
dashboard.daemon_activity = DaemonActivity {
|
||||||
|
last_dispatch_at: Some(Utc::now()),
|
||||||
|
last_dispatch_routed: 0,
|
||||||
|
last_dispatch_deferred: 2,
|
||||||
|
last_dispatch_leads: 1,
|
||||||
|
chronic_saturation_streak: 5,
|
||||||
|
last_recovery_dispatch_at: None,
|
||||||
|
last_recovery_dispatch_routed: 0,
|
||||||
|
last_recovery_dispatch_leads: 0,
|
||||||
|
last_rebalance_at: Some(Utc::now()),
|
||||||
|
last_rebalance_rerouted: 0,
|
||||||
|
last_rebalance_leads: 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
let text = dashboard.selected_session_metrics_text();
|
||||||
|
assert!(text.contains("Operator escalation recommended: chronic saturation is not clearing"));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn selected_session_metrics_text_shows_stabilized_dispatch_mode_after_recovery() {
|
fn selected_session_metrics_text_shows_stabilized_dispatch_mode_after_recovery() {
|
||||||
let now = Utc::now();
|
let now = Utc::now();
|
||||||
|
|||||||
Reference in New Issue
Block a user