From e6b32070f622d1da0709e32be48d5f71fe77bbd5 Mon Sep 17 00:00:00 2001 From: sanil-23 Date: Thu, 28 May 2026 18:47:21 +0530 Subject: [PATCH] feat(review): default agent shortcuts to skip-permissions mode (#2847) Co-authored-by: Cyrus Gray --- scripts/shortcuts/review/cli.sh | 4 ++++ scripts/shortcuts/review/coverage.sh | 2 +- scripts/shortcuts/review/fix.sh | 2 +- scripts/shortcuts/review/lib.sh | 35 ++++++++++++++++++++++++++++ scripts/shortcuts/review/review.sh | 2 +- scripts/shortcuts/work/start.sh | 16 ++++++------- 6 files changed, 49 insertions(+), 12 deletions(-) diff --git a/scripts/shortcuts/review/cli.sh b/scripts/shortcuts/review/cli.sh index a51829f71..d6ab420f5 100755 --- a/scripts/shortcuts/review/cli.sh +++ b/scripts/shortcuts/review/cli.sh @@ -37,6 +37,10 @@ Env: REVIEW_REPO=owner/name Override target repo (default: upstream remote) REVIEW_BANNED_COAUTHOR_RE= 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 } diff --git a/scripts/shortcuts/review/coverage.sh b/scripts/shortcuts/review/coverage.sh index 912f2ed6b..8755364da 100644 --- a/scripts/shortcuts/review/coverage.sh +++ b/scripts/shortcuts/review/coverage.sh @@ -85,4 +85,4 @@ Additional instructions from the user: ${extra_prompt}" fi -"$agent" "$prompt" +agent_exec "$agent" "$prompt" diff --git a/scripts/shortcuts/review/fix.sh b/scripts/shortcuts/review/fix.sh index 3a445414d..15e313e01 100755 --- a/scripts/shortcuts/review/fix.sh +++ b/scripts/shortcuts/review/fix.sh @@ -88,4 +88,4 @@ if [ -n "$extra_prompt" ]; then ${extra_prompt}" fi -"$agent" "$prompt" +agent_exec "$agent" "$prompt" diff --git a/scripts/shortcuts/review/lib.sh b/scripts/shortcuts/review/lib.sh index 0e431987a..d04d390e6 100755 --- a/scripts/shortcuts/review/lib.sh +++ b/scripts/shortcuts/review/lib.sh @@ -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" diff --git a/scripts/shortcuts/review/review.sh b/scripts/shortcuts/review/review.sh index 2f7b31cf4..37c2e9629 100755 --- a/scripts/shortcuts/review/review.sh +++ b/scripts/shortcuts/review/review.sh @@ -69,4 +69,4 @@ if [ -n "$extra_prompt" ]; then ${extra_prompt}" fi -"$agent" "$prompt" +agent_exec "$agent" "$prompt" diff --git a/scripts/shortcuts/work/start.sh b/scripts/shortcuts/work/start.sh index 64d09d6b8..a12720196 100755 --- a/scripts/shortcuts/work/start.sh +++ b/scripts/shortcuts/work/start.sh @@ -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 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"