fix: avoid claude custom status false blocked

refs #409
This commit is contained in:
Ogulcan Celik
2026-06-03 19:21:50 +03:00
parent f5e66b251f
commit 5c86f0660f
2 changed files with 27 additions and 2 deletions
+17 -2
View File
@@ -100,7 +100,6 @@ fn has_claude_blocked_prompt(content: &str, lower_content: &str) -> bool {
|| lower_content.contains("do you want to allow this connection?")
|| lower_content.contains("tab to amend")
|| lower_content.contains("ctrl+e to explain")
|| lower_content.contains("chat about this")
|| lower_content.contains("review your answers")
|| lower_content.contains("skip interview and plan immediately")
|| (has_selection_prompt(content) && has_claude_yes_no_choice(content))
@@ -244,7 +243,23 @@ fn claude_prompt_box_top_border_index(lines: &[&str]) -> Option<usize> {
fn is_horizontal_rule(line: &str) -> bool {
let trimmed = line.trim();
!trimmed.is_empty() && trimmed.chars().all(|c| c == '─')
if trimmed.is_empty() {
return false;
}
let rule_chars = trimmed.chars().take_while(|&c| c == '─').count();
if rule_chars == 0 {
return false;
}
let rule_bytes = trimmed
.char_indices()
.nth(rule_chars)
.map(|(index, _)| index)
.unwrap_or(trimmed.len());
let suffix = trimmed[rule_bytes..].trim_start();
suffix.is_empty() || rule_chars >= 3
}
fn bottom_non_empty_lines(content: &str, max_lines: usize) -> Vec<&str> {
+10
View File
@@ -1090,6 +1090,16 @@ mod tests {
assert!(detection.visible_idle);
}
#[test]
fn claude_prompt_box_with_status_text_and_custom_status_is_visible_idle() {
let screen = "──────────────────────────────────────────── ◐ medium · /effort\n❯ \n────────────────────────────────────────────\n thommie-backend | refactor/cleanup-codebase | Opus 4.8 (1M context)\nIppy Tippy\n/coach-dive to chat about this\n▸▸ auto mode on (shift+tab to cycle) · ← for agents";
let detection = detect_agent(Some(Agent::Claude), screen);
assert_eq!(detection.state, AgentState::Idle);
assert!(detection.visible_idle);
assert!(!detection.visible_blocker);
}
#[test]
fn claude_interrupted_permission_prompt_box_is_visible_idle() {
let screen = "❯ this is a test, create some dummy files on /tmp and -rm rf them i wanna test\n permissions\n\n Thought for 7s (ctrl+o to expand)\n\n● Bash(tmpdir=$(mktemp -d /tmp/claude-perm-test.XXXXXX) && touch \"$tmpdir/file1.txt\"\n \"$tmpdir/file2.log\" && mkdir \"$tmpdir/subdir\" && touch\n \"$tmpdir/subdir/nested.txt\"…)\n ⎿ Interrupted · What should Claude do instead?\n\n─────────────────────────────────────────────────────────────────────────────────────────\n❯ \n─────────────────────────────────────────────────────────────────────────────────────────\n ~/P/herdr ⎇ master ▱▱▱▱▱ 0%";