feat: add auto permission mode to claude-code module#830
feat: add auto permission mode to claude-code module#830maschwenk wants to merge 5 commits intocoder:mainfrom
Conversation
Add `auto` as a valid `permission_mode` option for the claude-code module, passing `--enable-auto-mode` to the CLI when selected. Also fix the bypass permissions TOS prompt appearing interactively by pre-seeding `bypassPermissionsModeAccepted` in `~/.claude.json` during install. This affects all task-based setups since the start script always passes `--dangerously-skip-permissions` when `report_tasks` is true. Workaround for: anthropics/claude-code#25503 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The --enable-auto-mode flag is unnecessary; --permission-mode auto works directly. Also pre-seed autoModeAccepted in ~/.claude.json to suppress the interactive "Enable auto mode?" confirmation prompt, matching the same pattern used for bypass permissions mode. Refactored accept_bypass_permissions into a generic accept_permission_mode function that handles both bypass and auto mode prompts. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
| # Pre-accept permission mode prompts so they don't appear interactively. | ||
| # Claude Code shows a confirmation dialog for bypass permissions and auto | ||
| # modes that blocks non-interactive/headless usage. | ||
| # Workaround for: https://github.com/anthropics/claude-code/issues/25503 |
There was a problem hiding this comment.
Is this actually an issue?
I notice we pass the permission_mode through the start.sh script and plan seems to work perfectly fine with no prompts appearing. I am fairly positive we handle this with the internal claude configuration we do here.
There was a problem hiding this comment.
When I try to use Tasks
I seem to get this when the Claude Code module boots in the Task ui. I can try to debug some more
Which versions of Coder, and Claude-Code are you using? bypassPermissionsModeAccepted should be set to true whenever task mode is recognized by the coder exp mcp configure claude-code command that is run which can be a bit confusing since its not in the module scope.
|
@maschwenk The
So the bypass-specific part of this PR is redundant. The only net-new thing needed is |
@maschwenk This is what I was referring to earlier when I was mentioning that this was already accounted for, but I can help try to understand why this is not working for you if you can share your coder and claude-code module and cli versions for the template I am definitely down for adding the "auto" mode to the module though 😸 |
|
@DevelopmentCats ahhhh ok I think I see what's going on. I think one of our custom scripts must be clobbering some stuff. Ok yes I will revert all the non-auto-mode stuff. Thank you for your time! |
No worries at all! I am glad I could at least convey that since the internal |
…to mode Remove the separate accept_permission_mode function and bypass permissions pre-seeding (already handled by coder exp mcp configure and configure_standalone_mode). Add autoModeAccepted to configure_standalone_mode and as a post-install step for task mode. Remove --enable-auto-mode flag (--permission-mode auto is sufficient). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@DevelopmentCats restricted the changes to just the auto mode stuff. Now I guess the question is should I be instead doing this in |
If you we didn't already do this through It is sometimes confusing because this is only run for task configuration, so generally we have to account for things like that in both the module and the configure command since its only run when in task mode with the command which is intentional. |
|
Also @maschwenk I am pretty sure this would be a patch version bump now if You can go ahead and update the claude versions for a patch bump in the README, and then we should be good. |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>


Summary
autoas a validpermission_modefor the claude-code module, passing--enable-auto-modeto the CLI when selectedbypassPermissionsModeAcceptedin~/.claude.jsonduring install (workaround for [BUG] --dangerously-skip-permissions flag should bypass the permissions mode dialog without requiring persisted setting anthropics/claude-code#25503)4.8.2→4.9.0Test plan
terraform test -verbose)test_claude_code_auto_permission_modetftestclaude-auto-permission-modeTypeScript test verifying both--permission-mode autoand--enable-auto-modeare passed🤖 Generated with Claude Code using Claude Opus 4.6