From e8acc76ef6d6c587a2b0c500ce02699344b9fe20 Mon Sep 17 00:00:00 2001 From: Ogulcan Celik Date: Mon, 8 Jun 2026 04:40:56 +0300 Subject: fix: detect truncated codex status rows --- src/detect/mod.rs | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src/detect/mod.rs') diff --git a/src/detect/mod.rs b/src/detect/mod.rs index 1e3a2288..529574f9 100644 --- a/src/detect/mod.rs +++ b/src/detect/mod.rs @@ -1578,6 +1578,38 @@ mod tests { assert!(!detection.visible_idle); } + #[test] + fn codex_truncated_status_with_arbitrary_label_is_visible_working() { + let detection = detect_agent( + Some(Agent::Codex), + "• Ran git diff -- src/detect/mod.rs\n └ diff output...\n\n• Considering patch updates (2m 26s • esc …\n\n\n› Fix Codex detection\n\n ~/Projects/herdr · master", + ); + + assert_eq!(detection.state, AgentState::Working); + assert!(detection.visible_working); + assert!(!detection.visible_idle); + } + + #[test] + fn codex_truncated_status_without_prompt_is_working() { + assert_eq!( + detect_codex("• Considering patch updates (2m 26s • esc …"), + AgentState::Working + ); + } + + #[test] + fn codex_bullet_with_esc_text_without_timer_is_not_visible_working() { + let detection = detect_agent( + Some(Agent::Codex), + "• Notes mention esc to interrupt as a phrase\n\n› Fix Codex detection\n\n ~/Projects/herdr · master", + ); + + assert_eq!(detection.state, AgentState::Idle); + assert!(detection.visible_idle); + assert!(!detection.visible_working); + } + #[test] fn codex_background_terminal_status_above_current_prompt_stays_working() { let detection = detect_agent( -- cgit v1.2.3