diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-31 03:00:46 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-31 03:04:20 +0300 |
| commit | 3acd499ffb1119e8032bbcba3f1f46d4ff5f3da9 (patch) | |
| tree | 4e30e82ccbc821e8930b03addfd1542d91ee8705 /src/detect/agents | |
| parent | 4e1fbf410b844749dcddae775806e1cce01ef442 (diff) | |
fix: keep codex visible approval review working
Diffstat (limited to 'src/detect/agents')
| -rw-r--r-- | src/detect/agents/codex.rs | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/src/detect/agents/codex.rs b/src/detect/agents/codex.rs index 0d23d4cb..50430aa4 100644 --- a/src/detect/agents/codex.rs +++ b/src/detect/agents/codex.rs @@ -49,11 +49,20 @@ pub(super) fn has_visible_working(content: &str) -> bool { } fn has_codex_visible_working_without_prompt(content: &str) -> bool { - content - .lines() - .rev() - .find(|line| !line.trim().is_empty()) - .is_some_and(codex_live_working_line) + let mut recent_lines = content.lines().rev().filter(|line| !line.trim().is_empty()); + let Some(last_line) = recent_lines.next() else { + return false; + }; + + if codex_live_working_line(last_line) { + return true; + } + + codex_status_detail_line(last_line) + && recent_lines + .take(4) + .find(|line| codex_block_marker_line(line)) + .is_some_and(codex_live_working_line) } fn has_codex_strong_blocked_prompt(lower_content: &str) -> bool { @@ -113,10 +122,12 @@ fn codex_working_status_line(line: &str) -> bool { } let trimmed = line.trim_start(); + let lower = trimmed.to_lowercase(); trimmed.starts_with('•') && (trimmed.contains("Working (") || trimmed.contains("Waiting for background terminal (") - || trimmed.contains("Reviewing approval request (") + || lower.contains("reviewing approval request (") + || (lower.contains("reviewing ") && lower.contains(" approval requests (")) || trimmed.contains("Booting MCP server:")) } @@ -146,6 +157,10 @@ fn codex_block_marker_line(line: &str) -> bool { line.starts_with('•') || line.starts_with('■') || line.starts_with('✗') || line.starts_with('✓') } +fn codex_status_detail_line(line: &str) -> bool { + line.trim_start().starts_with('└') +} + fn codex_queued_input_header_line(line: &str) -> bool { let trimmed = line.trim_start(); if !trimmed.starts_with('•') { |
