fix(docker): B5 tighten bash-guard denial message to 2 lines

Smoke run 3 showed the bash-guard hook emitting 8+ lines on every
blocked shell-git op — enumerating every alternative MCP verb across
roboco-flow / roboco-do / roboco-git-readonly. That's repeated token
spend on every refused retry; the LLM doesn't need the full alt-list
inline, it has the role prompt + the MCP tool schema for that.

Trimmed to 2 lines: denial reason + a one-line pointer to the role's
State→Verb table. Test asserts <= 3 echo lines in any denial block.

Spec ref: docs/superpowers/specs/2026-05-12-post-smoke-3-fixes-design.md
section B5.
This commit is contained in:
Renn F
2026-05-12 04:37:01 +02:00
parent 6550d69b75
commit 85e20e6a2a
2 changed files with 45 additions and 27 deletions
+2 -27
View File
@@ -38,33 +38,8 @@ low=$(printf '%s' "$cmd" | tr "[:upper:]" "[:lower:]")
# --- git network / auth ops ---------------------------------------------------
if echo "$low" | grep -qE '(^|[[:space:];&|])git[[:space:]]+(fetch|pull|push|clone|remote|ls-remote|checkout|commit|merge|rebase|reset|cherry-pick|revert|tag[[:space:]]+-d|update-ref|reflog[[:space:]]+delete)'; then
cat <<'EOF' >&2
Denied: shell git for network / auth / branch-mutating ops is blocked.
Read-only inspection (any role):
- roboco-git-readonly MCP: roboco_git_status / _log / _diff / _branch_list
Write paths — there is NO direct shell-git or "roboco_git_commit" tool.
Use the verb that matches your role; the choreographer handles git for you:
- developer / documenter: roboco-do `commit(message, files)`
→ auto-prefixes [task-id], pushes to your branch, opens a PR via
the choreographer when the task transitions out of in_progress.
Your branch is auto-created when you call i_will_work_on().
- cell_pm / main_pm: roboco-flow `complete(task_id, notes)`
→ cell_pm merges the leaf PR; main_pm opens the master PR and
escalates to CEO. PMs never run git directly — they delegate
code work to devs and complete to merge.
- any role: branches are NOT something you set up. They are created
on claim/i_will_work_on. If you don't see your branch, check that
you're actually claimed on the task.
Raw `git fetch` etc. don't have auth (the PAT is injected only inside
the MCP layer) and will fail with "could not read Username for
'https://github.com'".
EOF
echo "Denied: shell git for network / auth / branch-mutating ops is blocked." >&2
echo "Use the verb listed in your role's State→Verb table (e.g. commit, complete, i_am_done)." >&2
exit 2
fi