the runtime your coding agents live on
Rust agentagent-orchestrationaiai-agentsclaude-codeclicodexcoding-agentsdeveloper-toolsdevtoolsmultiplexerrustterminalterminal-multiplexerterminal-uitmuxtuiworkspace-manager
fix: match claude bash permission prompts at every cursor position (#3615)
caner-akca4b5e9bda239a
diff --git a/distribution/agent-detection/claude.toml b/distribution/agent-detection/claude.tomlindex 2a26a3342..164827646 100644--- a/distribution/agent-detection/claude.toml+++ b/distribution/agent-detection/claude.toml@@ -1,7 +1,7 @@id = "claude"-version = "2026.08.31.1"+version = "2026.09.04.1"min_engine_version = 2-updated_at = "2026-08-31T00:00:00Z"+updated_at = "2026-09-04T00:00:00Z"aliases = ["claude-code"][[rules]]@@ -162,8 +162,20 @@ any = [{ contains = ["tab to amend"] },{ contains = ["ctrl+e to explain"] },]+# Claude marks the selected option with "❯", so every option branch has to allow+# that prefix. Numbered branches that omit it only match options the cursor has+# moved away from, which left the resting layout below unmatched here (#2650):+# ❯ 1. Yes / 2. Yes, and don't ask again for: <cmd> / 3. No+# Cover both the two-option and "don't ask again" three-option shapes so this+# rule, not the narrower generic_permission_prompt, claims Bash approvals.all = [- { any = [{ line_regex = ['(?i)^\s*❯?\s*yes\b'] }, { line_regex = ['(?i)^\s*1\.\s*yes\b'] }, { line_regex = ['(?i)^\s*2\.\s*no\b'] }] },+ { any = [+ { line_regex = ['(?i)^\s*❯?\s*yes\b'] },+ { line_regex = ['(?i)^\s*❯?\s*1\.\s*yes\b'] },+ { line_regex = ['(?i)^\s*❯?\s*2\.\s*yes\b'] },+ { line_regex = ['(?i)^\s*❯?\s*2\.\s*no\b'] },+ { line_regex = ['(?i)^\s*❯?\s*3\.\s*no\b'] },+ ] },][[rules]]diff --git a/src/detect/manifest/tests.rs b/src/detect/manifest/tests.rsindex 00730a449..e1073f3c6 100644--- a/src/detect/manifest/tests.rs+++ b/src/detect/manifest/tests.rs@@ -738,6 +738,108 @@ fn claude_blocker_with_background_shell_remains_blocked() {assert!(!result.visible_working);}+#[test]+fn claude_bash_prompt_with_dont_ask_again_option_matches_bash_rule() {+ // Captured from a Bash approval prompt at its resting cursor position. The+ // "don't ask again" choice pushes No to option 3, so the only cursor-free+ // option line is one bash_permission_prompt used not to cover, which let+ // the narrower generic_permission_prompt claim the prompt instead (#2650).+ let screen = concat!(+ "────────────────────────────────────────────────────────────────+",+ " Bash command++",+ " curl -sS -o /tmp/probe.html https://example.com+",+ " Download example.com to /tmp/probe.html++",+ " This command requires approval++",+ " Do you want to proceed?+",+ " ❯ 1. Yes+",+ " 2. Yes, and don't ask again for: curl *+",+ " 3. No++",+ " Esc to cancel · Tab to amend · ctrl+e to explain+",+ );+ let result = osc_explain(Agent::Claude, screen, "", "");++ assert_eq!(result.state, AgentState::Blocked);+ assert_eq!(+ result.matched_rule.as_ref().map(|rule| rule.id.as_str()),+ Some("bash_permission_prompt")+ );+ assert!(result.visible_blocker);+}++#[test]+fn claude_permission_prompt_matches_at_every_cursor_position() {+ // The selected option carries "❯", so no option branch may assume its line+ // is cursor-free. Walk the cursor across both option layouts.+ let layouts: [&[&str]; 2] = [+ &[" ❯ 1. Yes", " 2. No"],+ &[+ " ❯ 1. Yes",+ " 2. Yes, and don't ask again for: curl *",+ " 3. No",+ ],+ ];++ for layout in layouts {+ for selected in 0..layout.len() {+ let options: Vec<String> = layout+ .iter()+ .enumerate()+ .map(|(index, line)| {+ let bare = line.trim_start().trim_start_matches('❯').trim_start();+ if index == selected {+ format!(" ❯ {bare}")+ } else {+ format!(" {bare}")+ }+ })+ .collect();+ let screen = format!(+ concat!(+ "────────────────────────────────────────────────────────────────+",+ " Bash command++",+ " curl -sS https://example.com++",+ " Do you want to proceed?+",+ "{}++",+ " Esc to cancel · Tab to amend · ctrl+e to explain+",+ ),+ options.join("\n"),+ );+ let result = osc_explain(Agent::Claude, &screen, "", "");++ assert_eq!(+ result.matched_rule.as_ref().map(|rule| rule.id.as_str()),+ Some("bash_permission_prompt"),+ "{options:?} selected={selected}"+ );+ assert_eq!(result.state, AgentState::Blocked, "selected={selected}");+ assert!(result.visible_blocker, "selected={selected}");+ }+ }+}+#[test]fn claude_osc_title_braille_prefix_is_working() {// "⠂" is U+2802, in the braille block U+2800-U+28FFdiff --git a/src/detect/manifests/claude.toml b/src/detect/manifests/claude.tomlindex 2a26a3342..164827646 100644--- a/src/detect/manifests/claude.toml+++ b/src/detect/manifests/claude.toml@@ -1,7 +1,7 @@id = "claude"-version = "2026.08.31.1"+version = "2026.09.04.1"min_engine_version = 2-updated_at = "2026-08-31T00:00:00Z"+updated_at = "2026-09-04T00:00:00Z"aliases = ["claude-code"][[rules]]@@ -162,8 +162,20 @@ any = [{ contains = ["tab to amend"] },{ contains = ["ctrl+e to explain"] },]+# Claude marks the selected option with "❯", so every option branch has to allow+# that prefix. Numbered branches that omit it only match options the cursor has+# moved away from, which left the resting layout below unmatched here (#2650):+# ❯ 1. Yes / 2. Yes, and don't ask again for: <cmd> / 3. No+# Cover both the two-option and "don't ask again" three-option shapes so this+# rule, not the narrower generic_permission_prompt, claims Bash approvals.all = [- { any = [{ line_regex = ['(?i)^\s*❯?\s*yes\b'] }, { line_regex = ['(?i)^\s*1\.\s*yes\b'] }, { line_regex = ['(?i)^\s*2\.\s*no\b'] }] },+ { any = [+ { line_regex = ['(?i)^\s*❯?\s*yes\b'] },+ { line_regex = ['(?i)^\s*❯?\s*1\.\s*yes\b'] },+ { line_regex = ['(?i)^\s*❯?\s*2\.\s*yes\b'] },+ { line_regex = ['(?i)^\s*❯?\s*2\.\s*no\b'] },+ { line_regex = ['(?i)^\s*❯?\s*3\.\s*no\b'] },+ ] },][[rules]]