feat(review): default agent shortcuts to skip-permissions mode (#2847)

Co-authored-by: Cyrus Gray <cyrus@tinyhumans.ai>
This commit is contained in:
sanil-23
2026-05-28 18:47:21 +05:30
committed by GitHub
co-authored by Cyrus Gray
parent 2d68c81f68
commit e6b32070f6
6 changed files with 49 additions and 12 deletions
+4
View File
@@ -37,6 +37,10 @@ Env:
REVIEW_REPO=owner/name Override target repo (default: upstream remote)
REVIEW_BANNED_COAUTHOR_RE=<regex> Substrings filtered from Co-authored-by lines
(default includes copilot/codex/cursor/claude/…)
REVIEW_AGENT_SAFE=1 Run the picked agent CLI bare instead of in
its "yolo" mode. Default 0 — claude / codex /
cursor are launched with their skip-permissions
flag so headless runs don't stall on prompts.
EOF
}
+1 -1
View File
@@ -85,4 +85,4 @@ Additional instructions from the user:
${extra_prompt}"
fi
"$agent" "$prompt"
agent_exec "$agent" "$prompt"
+1 -1
View File
@@ -88,4 +88,4 @@ if [ -n "$extra_prompt" ]; then
${extra_prompt}"
fi
"$agent" "$prompt"
agent_exec "$agent" "$prompt"
+35
View File
@@ -28,6 +28,41 @@ require() {
done
}
# Run the picked agent CLI on a single positional prompt. Each known agent
# is launched in its equivalent "yolo" mode so headless / detached runs
# (CI, background tasks, tmux workers) don't stall on per-tool permission
# prompts that have no responder. Set REVIEW_AGENT_SAFE=1 to keep the
# prompts (e.g. an interactive local run where you want to vet each step).
#
# Mirrors the precedent in bin/spawn-issue, which already passes
# --dangerously-skip-permissions to its detached claude workers, and brings
# the claude path in line with the existing codex / cursor handling.
agent_exec() {
local agent="$1"
local prompt="$2"
if [ "${REVIEW_AGENT_SAFE:-0}" = "1" ]; then
case "$agent" in
codex) codex exec "$prompt" ;;
*) "$agent" "$prompt" ;;
esac
return
fi
case "$agent" in
claude)
claude --dangerously-skip-permissions "$prompt"
;;
codex)
codex exec --dangerously-bypass-approvals-and-sandbox "$prompt"
;;
cursor|cursor-agent)
cursor-agent --yolo "$prompt"
;;
*)
"$agent" "$prompt"
;;
esac
}
gh_assign_self_issue() {
local issue="$1"
local repo="$2"
+1 -1
View File
@@ -69,4 +69,4 @@ if [ -n "$extra_prompt" ]; then
${extra_prompt}"
fi
"$agent" "$prompt"
agent_exec "$agent" "$prompt"
+7 -9
View File
@@ -9,9 +9,13 @@
# repo conventions (CLAUDE.md / AGENTS.md pointers).
#
# --agent picks the CLI that drives the work. Default: claude.
# `--agent codex` uses `codex exec --dangerously-bypass-approvals-and-sandbox`
# `--agent claude` uses `claude --dangerously-skip-permissions`,
# `--agent codex` uses `codex exec --dangerously-bypass-approvals-and-sandbox`,
# and `--agent cursor` / `cursor-agent` use `cursor-agent --yolo`, so those
# sessions start in their equivalent "yolo" mode.
# sessions start in their equivalent "yolo" mode and won't stall on
# permission prompts that have no responder in a headless context.
# Set REVIEW_AGENT_SAFE=1 to bypass the yolo wrappers and run the agent
# CLI bare (useful for interactive local runs where you want the prompts).
# A trailing positional <extra-prompt> is appended to the agent prompt.
# --no-checkout skips git sync/branch creation (use the current branch as-is).
@@ -169,10 +173,4 @@ ${extra_prompt}"
fi
echo "[work] handing off to ${agent} on branch ${current_branch}"
if [ "$agent" = "codex" ]; then
codex exec --dangerously-bypass-approvals-and-sandbox "$prompt"
elif [ "$agent" = "cursor" ] || [ "$agent" = "cursor-agent" ]; then
cursor-agent --yolo "$prompt"
else
"$agent" "$prompt"
fi
agent_exec "$agent" "$prompt"