buzz-acp: make session/request_permission auto-response configurable (deny-by-default option)
Context
I'm embedding Buzz as a collaboration/audit layer in a supervised personal-automation setup, where agents connected over ACP must run fail-closed: a permission request that nobody explicitly approves should be rejected, not granted.
Current behavior (v0.5.2)
crates/buzz-acp/src/config.rsdefaultsBUZZ_ACP_PERMISSION_MODEtobypass-permissions.handle_permission_requestincrates/buzz-acp/src/acp.rsauto-approves theallow_onceoption when one exists, and falls back toreject_onceonly when no allow option is present.
So a stock deployment connected to a production environment will silently grant agent permission requests. For my use case that behavior is disqualifying without a patch — and the patch looks small, since the reject path already exists.
Request
A configurable auto-response for session/request_permission — e.g. extend the existing env var surface with something like BUZZ_ACP_PERMISSION_AUTO_RESPONSE=allow-once|reject-once (or an equivalent config key), so operators can choose deny-by-default without maintaining a fork. The default can stay as-is for backward compatibility.
Related: #2884 touches the same surface from the other direction (exposing more of the adapter's native permission modes); this request is about what buzz-acp itself does when asked, independent of adapter mode.
Happy to submit a PR if the direction is acceptable — the change looks contained to which branch of handle_permission_request wins, plus config plumbing and a test asserting allow_once is never auto-selected in deny mode.
Agree this should be operator-configurable, and that the default can stay bypass-permissions for backward compatibility.
A few correctness notes if anyone lands the PR (I am not claiming this issue — just mapping the surface):
-
Fail-closed must be the named mode, not an accident of option order. Today
handle_permission_requestprefersallow_oncewhen present. A deny mode should selectreject_once/canceleven when an allow option is offered by the adapter. Testing only “no allow option present → reject” leaves the common case open. -
Auto-response is not the same as an adapter permission mode. #2884 is about exposing native adapter modes; this knob is about what buzz-acp answers when the session asks. Keep them orthogonal so a harness can be
acceptEditswhile the bridge still denies unattended permission prompts. -
Audit trail. When auto-responding (allow or deny), log the mode + chosen option id on the channel (or at least structured bridge logs). Silent auto-allow is exactly the failure shape that makes multi-agent coordination un-debuggable later — same class as accepted-but-ignored writes (#4580).
-
Env surface. Extending
BUZZ_ACP_PERMISSION_MODE(or a siblingBUZZ_ACP_PERMISSION_AUTO_RESPONSE=allow-once|reject-once) is enough for v1; no need for a full policy engine. Document that unset = current behavior.
Happy to review a patch; the change really does look localized to the branch in handle_permission_request plus config plumbing and a unit test that asserts allow_once is never auto-selected under deny mode.
Confirming this appears resolved on main: as of 6ca9641, BUZZ_ACP_PERMISSION_MODE defaults to dont-ask, and handle_permission_request in crates/buzz-acp/src/acp.rs now selects reject_once (or the cancelled outcome) even when an allow_once option is offered — fail-closed in exactly the way this issue requested, including the correctness point raised in the earlier comment (deny must win despite an allow option being present, not only in its absence).
Verified by reading the source at that ref and running it self-hosted (no agent connected — verification was of the code path, not live ACP traffic). From my side this can be closed; leaving that to maintainers in case the remaining configurability (explicitly choosing an allow-mode) is still wanted as a separate knob.
Hit this today from the other side — a concrete unattended-agent use case that's currently unworkable because there's no configurability, not because fail-closed is wrong.
Setup: managed agent (runtime: codex, acp_command: buzz-acp, agent_command: codex-acp, mcp_command: buzz-dev-mcp) meant to run fully unattended as an adversarial plan reviewer. No human is watching the Activity pane to click Allow.
What I tried: set the agent's CODEX_CONFIG env var to {"approval_policy":"never","sandbox_mode":"workspace-write"}, assuming that would suppress permission prompts for its tool calls. Restarted, sent a real message. The Activity pane still shows Permission requested on a buzz-dev-mcp-routed shell call ("Read channel"), immediately followed by Denied (reject_once) — no human interaction, so this is the automatic path, not a missed click.
Traced why, confirming and extending the point already made above ("auto-response is not the same as an adapter permission mode... keep them orthogonal"):
approval_policyonly governs whethercodex-acpdecides to ask. Oncesession/request_permissionreachesbuzz-acp,handle_permission_requestanswersreject_onceunconditionally (crates/buzz-acp/src/acp.rs:1895,:2017) — current behavior matches the confirmation above.- The one partial adapter mode,
acceptEdits(crates/buzz-acp/src/config.rs:117), only covers file edits — an MCPshell-tool call routed throughbuzz-dev-mcpisn't a file edit, so it's still denied. - There's no per-agent escape hatch on the Desktop side either:
CreateManagedAgentRequest/UpdateManagedAgentRequestexposeenv_vars,parallelism,respond_to, etc., but no permission-mode field (desktop/src-tauri/src/managed_agents/types/requests.rs:130,:200).BUZZ_ACP_PERMISSION_MODEis settable viaenv_vars(not in the reserved list,desktop/src-tauri/src/managed_agents/env_vars.rs:70), but the mode is only honored if the adapter advertises it, and any permission request that still arrives is rejected regardless (crates/buzz-acp/src/pool.rs:1017,:1149).
So right now there's no config-only way to run an MCP-tool-using Codex agent unattended in Buzz — which is the right default, but the deny-by-default request from the original issue (a real per-agent opt-in, not the old unconditional allow) is still the missing piece. Happy to test a patch against this exact repro (real Codex + buzz-dev-mcp session, not just source reading) if one lands.
@jcg-git's repro matches my reading of the current code — and it's a fair refinement of my note above: "resolved" was true for my deployment (I want unconditional deny), but the original request was for a configurable auto-response, and that half is still missing. Upstream shipped the right default; the per-agent opt-in for unattended flows remains open. +1 to keeping this issue open for that knob, with the constraints already mapped in this thread: deny stays the default, explicit opt-in only, audited auto-responses, and the unit test asserting allow-present ⇒ reject under deny mode.
Follow-up with a real answer to the "how does a Codex-runtime agent get unattended operation" question this thread left open (referencing my earlier comment above).
Codex has its own native pre-authorization mechanism, entirely outside buzz-acp. A Codex CLI session can define execution-policy rules in ~/.codex/rules/default.rules that pre-authorize specific command prefixes — when a command matches, Codex never emits a session/request_permission call in the first place, so it never reaches buzz-acp's reject_once handler at all. This is the same shape as Claude Code's own settings.local.json allow-list solving the identical problem for Claude-runtime agents — I'd missed that Codex has an equivalent, just under a different name/format.
Example, narrowly scoped to exactly what's needed:
prefix_rule(
pattern = ["buzz", "messages", "send"],
decision = "allow",
justification = "Allow Buzz-managed agents to send Buzz messages",
match = [
"buzz messages send --channel channel-id --content hello",
],
not_match = [
"buzz messages get --channel channel-id",
"buzz channels create --name example",
],
)
Confirmed working end-to-end: a real Codex-runtime managed agent, with this rule in place, now sends/reads/manages its own memory without any interactive approval, while unrelated write operations (channel creation, message edits/deletes, etc.) remain gated as normal.
One real gotcha worth flagging for anyone using this pattern: prefix_rule matches on the literal start of the executed command, not anywhere inside a pipeline. The common convention for multi-line/markdown content (printf '%s\n' "..." | buzz messages send --content -) does not match a rule scoped to ["buzz", "messages", "send"], since the actual command starts with printf. That's part of what motivated #5246 (--content-file) — a single direct command with no pipeline, so a plain prefix rule covers it cleanly.
Happy to write this up as a short doc/FAQ addition if that'd help others hitting the same wall — let me know if there's a preferred place for it.
This completes the picture nicely — and I think it's a better resolution than the knob this issue originally asked for. Pre-authorization in the runtime's own policy layer (Codex prefix_rules, Claude Code's allowlist equivalent) gives per-command scope with justification strings, while buzz-acp stays unconditionally fail-closed for everything else. Two layers, each doing the job it's best placed to do — versus a bridge-level env var that would flip the whole session's posture at once.
From my side (self-hosted, deny-always by preference) the original request is now fully addressed between the shipped default and this pattern: I no longer see a need for the bridge-level opt-in at all, though I'll defer to others on whether niche cases remain for runtimes without a native policy layer. +1 on the doc/FAQ offer — the printf-pipeline gotcha alone will save people hours, and this thread is currently the only place any of it is written down.
Following up on the doc/FAQ offer — turned out there was a second, deeper layer to this that's worth documenting alongside the printf-pipeline gotcha, since it bit us again even after switching to --content-file.
The full progression
Layer 1 (already covered above): prefix_rule only matches the start of the executed command. printf '%s\n' "..." | buzz messages send --content - starts with printf, so a rule scoped to ["buzz", "messages", "send"] never matches it. --content-file (#5246) fixes this specific gap since it's a single direct command with no pipeline.
Layer 2: --content-file alone doesn't guarantee correct content either — it just moves where the mistake can happen. With a Codex-runtime agent constructing its own buzz invocations turn by turn, we kept seeing replies land with literal \n as two-character text (backslash + n) instead of real line breaks — classic shell-quoting mistake: the agent occasionally built --content "...\n\n## Header\n\n..." as a plain double-quoted inline argument, where \n is never interpreted as a newline by bash/zsh (only $'...' ANSI-C quoting or a real embedded line break does that). Confirmed by diffing raw relay event bytes: \\n (literal) vs \n (real newline) in the JSON.
Layer 3: telling the agent "use --content-file / pipe multi-line content, don't inline it" is not reliably sufficient on its own. We fixed this via a memory/instruction update, watched it work on a couple of tests, declared it fixed — and then it recurred on the agent's own well-worn structured-reply template (a "findings / tradeoffs / verdict" format it reuses constantly) a short time later, on a fresh session, with the instruction still correctly present in memory. Root cause: this is an LLM deciding fresh, every single turn, whether to inline --content or pipe/file it. A memory instruction biases that decision but doesn't force 100% mechanical compliance — especially against a deeply habituated response shape the agent doesn't consciously re-evaluate as "multi-line formatting" each time. Re-wording the instruction to be more specific/emphatic didn't hold either.
What actually fixed it: remove the decision, don't just instruct around it
Wrapped buzz messages send --content-file in a small script and told the agent to use only that, never buzz messages send directly:
#!/bin/bash
# Always publish via --content-file, never inline --content, to eliminate
# the literal-\n double-escaping bug that hits ad-hoc-constructed --content
# strings.
# Usage: cat reply.md | buzz-content-send --channel <uuid> [--reply-to <event-id>]
set -euo pipefail
tmpfile="$(mktemp "${TMPDIR:-/tmp}/buzz-content-send.XXXXXX")"
trap 'rm -f "$tmpfile"' EXIT
cat > "$tmpfile"
exec buzz messages send "$@" --content-file "$tmpfile"
Paired with one more narrow prefix_rule so it runs without an approval prompt:
prefix_rule(
pattern = ["buzz-content-send"],
decision = "allow",
justification = "Allow Buzz-managed agents to publish replies via the safe content-file wrapper",
match = [
"buzz-content-send --channel channel-id",
"buzz-content-send --channel channel-id --reply-to event-id",
],
)
With the wrapper as the only publish path, there's no per-turn inline-vs-file judgment call left to get wrong — the agent just pipes text in. Verified with two independent fresh live tests (not retries of the same one — that's what produced a false "confirmed fixed" the first time around) — both came back with real newlines throughout, confirmed against raw relay bytes.
Takeaway for anyone hitting this
If an agent's buzz invocations are themselves LLM-generated per turn (true for any Codex/Claude/etc.-runtime agent, not just Codex), a policy/instruction fix on content formatting gets you probabilistic compliance at best. If you need it deterministic, wrap the publish path so the model has one dumb, safe thing to pipe into rather than a decision to make correctly every time.
Excellent write-up — Layer 3 is the transferable insight: an instruction biases a per-turn decision, it doesn't remove it, and habituated response shapes defeat even emphatic memory rules. "One dumb, safe thing to pipe into" beats "remember to do it right" for anything that must be deterministic. We've adopted the wrapper pattern verbatim into our own deployment's capability rules. +1 to landing this as the FAQ — this thread has quietly become the best documentation of unattended-agent operation that exists for Buzz.