fix: allow permissionMode to override yolo in claude_code provider#322
Open
zz327455573 wants to merge 2 commits into
Open
fix: allow permissionMode to override yolo in claude_code provider#322zz327455573 wants to merge 2 commits into
zz327455573 wants to merge 2 commits into
Conversation
When running as root/sudo, Claude Code refuses --dangerously-skip-permissions. The yolo mode was unconditionally passing that flag, causing initialization to fail. This change lets profile.permissionMode take precedence over yolo, so users can configure 'auto' or 'bypassPermissions' to avoid the blocked flag.
Contributor
There was a problem hiding this comment.
Pull request overview
Adjusts how the Claude Code provider selects its base permission flags so agent profile permissionMode can override “yolo” behavior, avoiding Claude Code startup failures when run under root/sudo.
Changes:
- Updates
_build_claude_command()to prioritizeprofile.permissionModeeven whenallowedTools: ["*"](yolo) is active. - Changes the yolo path to omit
--dangerously-skip-permissions(intended to avoid root/sudo rejection).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+169
to
+172
| elif yolo: | ||
| # yolo mode: no --dangerously-skip-permissions flag because | ||
| # Claude Code refuses it under root/sudo. Let CAO handle permissions. | ||
| command_parts = ["claude"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When running CAO as root/sudo with a third-party model (e.g. LongCat via custom ANTHROPIC_BASE_URL), the yolo mode unconditionally passes
--dangerously-skip-permissionsto Claude Code. Claude Code refuses this flag under root privileges with:This causes Claude Code initialization to hang and eventually time out (30s).
Root Cause
In
claude_code.pyline 167, the condition was:When
yolo=True(allowedTools: ["*"]in profile), the code always fell through to the else branch which passed--dangerously-skip-permissions— a flag that Claude Code rejects under root.Fix
Changed the condition so
profile.permissionModealways takes precedence regardless of yolo mode:Users running as root can now set
permissionMode: autoorpermissionMode: bypassPermissionsin their agent profile to avoid the blocked flag.Test Plan
--dangerously-skip-token-permissionsstill works (unchanged path)