@setoelkahfi / sigit / commits / e6d3cc5

Fix headless permissions calls after the rule-pattern API change

PR #27 (headless mode) and PR #28 (permission rule patterns) merged into development independently: #28 added an arguments parameter to decision_for and grant_for_session, and #27's call sites predate it, so development does not compile. Pass the tool call's arguments to decision_for; grants from --allow-tool pass the empty string, which records the bare tool name and keeps the grant-the-whole-tool behavior. Same fix as the one inside the PR #26 merge commit.

paydii committed Jul 6, 2026 at 20:44 UTC e6d3cc5485e8cc83c41ceea8595947b230f10659
1 file changed +4 -2
src/headless.rs
+4 -2
index dcbda75..884c20f 100644 --- a/src/headless.rs +++ b/src/headless.rs @@ -144,7 +144,9 @@ pub async fn run(config: HeadlessConfig) -> i32 { // Fresh permission state for the run, then apply the flag grants. permissions::reset_session(HEADLESS_SESSION); for tool in &config.allow_tools { - permissions::grant_for_session(HEADLESS_SESSION, tool); + // No call arguments at grant time: the empty string records the bare + // tool name, granting the whole tool — the --allow-tool contract. + permissions::grant_for_session(HEADLESS_SESSION, tool, ""); } let denied: HashSet<&str> = config.deny_tools.iter().map(String::as_str).collect(); @@ -269,7 +271,7 @@ async fn run_prompt( log::info!("headless: {} blocked by --deny-tool", tc.name); deny_flag_denial(&tc.name) } else { - match permissions::decision_for(HEADLESS_SESSION, &tc.name) { + match permissions::decision_for(HEADLESS_SESSION, &tc.name, &tc.arguments) { permissions::Decision::Allow => { tools::execute_tool(&tc.name, &tc.arguments).await }