Skip to content

armgit / ECC

Public Imported from GitHub
0

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

feat: escalate ecc2 chronic saturation

Affaan Mustafa1bc9b9c58505
diff --git a/ecc2/src/session/store.rs b/ecc2/src/session/store.rs
index 096ca52a7..ecbf5081f 100644
--- a/ecc2/src/session/store.rs
+++ b/ecc2/src/session/store.rs
@@ -80,6 +80,12 @@ impl DaemonActivity {
_ => None,
}
}
+
+ pub fn operator_escalation_required(&self) -> bool {
+ self.dispatch_cooloff_active()
+ && self.chronic_saturation_streak >= 5
+ && self.last_rebalance_rerouted == 0
+ }
}
impl StateStore {
@@ -1162,6 +1168,14 @@ mod tests {
};
assert!(persistent.prefers_rebalance_first());
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 {
last_recovery_dispatch_at: Some(now + chrono::Duration::seconds(1)),
diff --git a/ecc2/src/tui/dashboard.rs b/ecc2/src/tui/dashboard.rs
index 18d28320a..c2a2eaf2b 100644
--- a/ecc2/src/tui/dashboard.rs
+++ b/ecc2/src/tui/dashboard.rs
@@ -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() {
lines.push(format!(
"Chronic saturation cleared @ {}",
@@ -2349,6 +2355,37 @@ mod tests {
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]
fn selected_session_metrics_text_shows_stabilized_dispatch_mode_after_recovery() {
let now = Utc::now();