Start sessions with --dangerously-skip-permissions
Unattended sessions otherwise stop at every tool approval until someone answers through Remote Control. The limits that make this acceptable (bot token scoped to allowlisted repos, branch protection, nothing production on the box) are written down in the README's security model, along with the remaining risk of prompt injection. The one-time bypass-mode warning would block an unattended session. It's suppressed by skipDangerousModePermissionPrompt in ~/.claude/settings.json, and if it ever shows anyway, status now reports it as needs_attention, the same way as the folder-trust prompt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CyWXJ3BVzrZ9VWk5c2CoAr
This commit is contained in:
parent
b55ea07c96
commit
ece7458a55
3 changed files with 34 additions and 6 deletions
|
|
@ -59,6 +59,9 @@ NAME_RE = re.compile(r"^[a-z0-9][a-z0-9-]{0,31}$")
|
|||
BRANCH_RE = re.compile(r"^[A-Za-z0-9][A-Za-z0-9._/-]{0,99}$")
|
||||
RC_URL_RE = re.compile(r"https://claude\.ai/code/session_[A-Za-z0-9]+")
|
||||
TRUST_PROMPT = "Yes, I trust this folder"
|
||||
# One-time warning for --dangerously-skip-permissions; skipped when ~/.claude/settings.json
|
||||
# has "skipDangerousModePermissionPrompt": true.
|
||||
BYPASS_PROMPT = "running in Bypass Permissions mode"
|
||||
|
||||
REMOTE_VERBS = {"list", "repos", "status", "create", "start", "stop", "health"}
|
||||
|
||||
|
|
@ -221,9 +224,13 @@ def untrust_workspace(path: Path, claude_json: Path = CLAUDE_JSON) -> None:
|
|||
|
||||
|
||||
def claude_args(state: dict, prefix: str, projects_dir: Path = CLAUDE_PROJECTS) -> list[str]:
|
||||
"""First launch pins the conversation id; every later launch resumes it."""
|
||||
"""First launch pins the conversation id; every later launch resumes it.
|
||||
|
||||
Sessions run with --dangerously-skip-permissions: no tool call waits for
|
||||
approval. See README "Security model" for why that is acceptable here.
|
||||
"""
|
||||
rc_name = f"{prefix}-{state['name']}"
|
||||
args = ["claude", "--remote-control", rc_name, "--name", state["name"]]
|
||||
args = ["claude", "--dangerously-skip-permissions", "--remote-control", rc_name, "--name", state["name"]]
|
||||
if any(projects_dir.glob(f"*/{state['uuid']}.jsonl")):
|
||||
return args + ["--resume", state["uuid"]]
|
||||
return args + ["--session-id", state["uuid"]]
|
||||
|
|
@ -253,6 +260,8 @@ def session_view(state: dict, with_pane: bool = True) -> dict:
|
|||
write_state(state)
|
||||
if TRUST_PROMPT in pane:
|
||||
view["needs_attention"] = "stuck on the folder-trust prompt; attach with tmux to accept"
|
||||
elif BYPASS_PROMPT in pane:
|
||||
view["needs_attention"] = "stuck on the bypass-permissions warning; attach with tmux to accept"
|
||||
return view
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue