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
@@ -144,7 +144,9 @@ pub async fn run(config: HeadlessConfig) -> i32 {
144
// Fresh permission state for the run, then apply the flag grants.
145
permissions::reset_session(HEADLESS_SESSION);
146
for tool in &config.allow_tools {
147
- permissions::grant_for_session(HEADLESS_SESSION, tool);
147
+ // No call arguments at grant time: the empty string records the bare
148
+ // tool name, granting the whole tool — the --allow-tool contract.
149
+ permissions::grant_for_session(HEADLESS_SESSION, tool, "");
150
}
151
let denied: HashSet<&str> = config.deny_tools.iter().map(String::as_str).collect();
152
@@ -269,7 +271,7 @@ async fn run_prompt(
271
log::info!("headless: {} blocked by --deny-tool", tc.name);
272
deny_flag_denial(&tc.name)
273
} else {
272
- match permissions::decision_for(HEADLESS_SESSION, &tc.name) {
274
+ match permissions::decision_for(HEADLESS_SESSION, &tc.name, &tc.arguments) {
275
permissions::Decision::Allow => {
276
tools::execute_tool(&tc.name, &tc.arguments).await
277
}