Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

Auto-approve uses the engines' auto modes, not their skip-every-check flags

dee00d5714cbb3e
diff --git a/cli/src/lib/engineLaunch.spec.ts b/cli/src/lib/engineLaunch.spec.ts
index d8e10196c..382ccd7ab 100644
--- a/cli/src/lib/engineLaunch.spec.ts
+++ b/cli/src/lib/engineLaunch.spec.ts
@@ -209,9 +209,9 @@ describe('buildEngineLaunchArgv', () => {
it('appends the confirmed flag for engines with a known bypass flag', () => {
expect(buildEngineCommandArgv('claude', { bypassPermission: true }))
- .toEqual([engineBin('claude'), '--dangerously-skip-permissions'])
+ .toEqual([engineBin('claude'), '--permission-mode', 'auto'])
expect(buildEngineCommandArgv('codex', { bypassPermission: true }))
- .toEqual([engineBin('codex'), '--dangerously-bypass-approvals-and-sandbox'])
+ .toEqual([engineBin('codex'), '--approve-for-me'])
expect(buildEngineCommandArgv('cursor', { bypassPermission: true }))
.toEqual([engineBin('cursor'), '--force'])
expect(buildEngineCommandArgv('opencode', { bypassPermission: true }))
@@ -240,14 +240,14 @@ describe('buildEngineLaunchArgv', () => {
expect(buildEngineCommandArgv('codex', { resumeSessionId: 'abc-123' }))
.toEqual([engineBin('codex'), 'resume', 'abc-123'])
expect(buildEngineCommandArgv('codex', { resumeSessionId: 'abc-123', bypassPermission: true }))
- .toEqual([engineBin('codex'), 'resume', 'abc-123', '--dangerously-bypass-approvals-and-sandbox'])
+ .toEqual([engineBin('codex'), 'resume', 'abc-123', '--approve-for-me'])
expect(buildEngineCommandArgv('amp', { resumeSessionId: 'T-1' }))
.toEqual([engineBin('amp'), 'threads', 'continue', 'T-1'])
})
it('still applies bypassPermission with no resume requested (regression)', () => {
expect(buildEngineCommandArgv('claude', { bypassPermission: true }))
- .toEqual([engineBin('claude'), '--dangerously-skip-permissions'])
+ .toEqual([engineBin('claude'), '--permission-mode', 'auto'])
})
it('is a no-op when resumeSessionId is set but the engine has no known launch resume flag', () => {
@@ -278,7 +278,7 @@ describe('a first prompt on launch', () => {
it('puts the text LAST, after every flag, so a positional is never read as an option value', () => {
expect(buildEngineCommandArgv('claude', { firstPrompt: PROMPT, bypassPermission: true, extraArgs: ['--allowedTools=WebSearch'] }))
- .toEqual([engineBin('claude'), '--dangerously-skip-permissions', '--allowedTools=WebSearch', PROMPT])
+ .toEqual([engineBin('claude'), '--permission-mode', 'auto', '--allowedTools=WebSearch', PROMPT])
expect(buildEngineCommandArgv('opencode', { firstPrompt: PROMPT, bypassPermission: true, extraArgs: ['-m', 'local/qwen'] }))
.toEqual([engineBin('opencode'), '--auto', '-m', 'local/qwen', '--prompt', PROMPT])
})
diff --git a/cli/src/lib/engineLaunch.ts b/cli/src/lib/engineLaunch.ts
index c845e19fe..20c341245 100644
--- a/cli/src/lib/engineLaunch.ts
+++ b/cli/src/lib/engineLaunch.ts
@@ -14,8 +14,11 @@ import { RAISE_OPEN_FILES_SH } from './openFiles.js'
* `null` = no known/safe flag — callers must hide the option rather than guess one.
*/
export const BYPASS_PERMISSION_FLAGS: Readonly<Record<AgentEngine, string[] | null>> = {
- claude: ['--dangerously-skip-permissions'],
- codex: ['--dangerously-bypass-approvals-and-sandbox'],
+ // The engines' own auto modes, not their "skip every check" switches: Claude Code's auto mode
+ // approves routine actions and still runs its safety checks on risky ones, and Codex routes each
+ // approval to its automatic review and keeps commands in the workspace sandbox.
+ claude: ['--permission-mode', 'auto'],
+ codex: ['--approve-for-me'],
cursor: ['--force'],
opencode: ['--auto'],
// No permission-prompt system to bypass (pi), or config-file based rather than a flag (hermes).
diff --git a/cli/src/lib/tmux.spec.ts b/cli/src/lib/tmux.spec.ts
index d3b556927..cb1072663 100644
--- a/cli/src/lib/tmux.spec.ts
+++ b/cli/src/lib/tmux.spec.ts
@@ -269,6 +269,10 @@ describe('tmux process primitives', () => {
})
it('reads bypass-permission mode from a live process argv via exact token match', () => {
+ expect(bypassPermissionActive('claude', '/usr/local/bin/claude --permission-mode auto')).toBe(true)
+ expect(bypassPermissionActive('claude', 'claude --permission-mode=auto --resume abc')).toBe(true)
+ expect(bypassPermissionActive('codex', 'codex resume abc --approve-for-me')).toBe(true)
+ // Launched before the auto modes: the old flags still count, and a relaunch uses the auto mode.
expect(bypassPermissionActive('claude', '/usr/local/bin/claude --dangerously-skip-permissions'))
.toBe(true)
expect(bypassPermissionActive('codex', 'codex --dangerously-bypass-approvals-and-sandbox'))
@@ -286,6 +290,10 @@ describe('tmux process primitives', () => {
it('reads false when the confirmed flag is absent', () => {
expect(bypassPermissionActive('claude', 'claude --resume abc')).toBe(false)
+ // Another mode, or "auto" that is not the mode's value.
+ expect(bypassPermissionActive('claude', 'claude --permission-mode plan')).toBe(false)
+ expect(bypassPermissionActive('claude', 'claude --permission-mode manual auto')).toBe(false)
+ expect(bypassPermissionActive('claude', 'claude auto --permission-mode')).toBe(false)
})
it('always reads false for engines with no confirmed bypass flag — never guesses', () => {
diff --git a/cli/src/lib/tmux.ts b/cli/src/lib/tmux.ts
index ac44e0e2e..e8ed7709e 100644
--- a/cli/src/lib/tmux.ts
+++ b/cli/src/lib/tmux.ts
@@ -584,7 +584,18 @@ export function bypassPermissionActive(engine: RegisteredSession['engine'], args
const flags = BYPASS_PERMISSION_FLAGS[engine]
if (!flags) return false
const tokens = argvTokens(args)
- return flags.every((flag) => tokens.includes(flag))
+ // The flags in order, as launch writes them (`--permission-mode auto` is two tokens, and "auto"
+ // alone elsewhere in argv is not the mode) — or `--flag=value` as one.
+ const inOrder = (want: readonly string[]): boolean => tokens.some((_, i) => want.every((flag, j) => tokens[i + j] === flag))
+ || (want.length === 2 && tokens.includes(`${want[0]}=${want[1]}`))
+ // An agent launched before the auto modes carried the old skip-everything flag; it still counts as
+ // approving on its own, and a relaunch brings it back in the auto mode.
+ return inOrder(flags) || (LEGACY_BYPASS_FLAGS[engine] ?? []).some((legacy) => inOrder(legacy))
+}
+
+const LEGACY_BYPASS_FLAGS: Partial<Record<RegisteredSession['engine'], string[][]>> = {
+ claude: [['--dangerously-skip-permissions']],
+ codex: [['--dangerously-bypass-approvals-and-sandbox']],
}
/** The session id an engine was told to resume, or null when argv does not name one. */
diff --git a/desktop/lib/widgets/new_agent_dialog.dart b/desktop/lib/widgets/new_agent_dialog.dart
index 6eaca67bf..025cd358a 100644
--- a/desktop/lib/widgets/new_agent_dialog.dart
+++ b/desktop/lib/widgets/new_agent_dialog.dart
@@ -32,8 +32,8 @@ import 'dsh_install_panel.dart';
/// is the actual enforcement point. An engine absent here shows no checkbox at all rather than
/// guessing a flag for a CLI we haven't verified. Keep both maps in sync.
const Map<String, String> kEngineBypassPermissionFlag = {
- 'claude': '--dangerously-skip-permissions',
- 'codex': '--dangerously-bypass-approvals-and-sandbox',
+ 'claude': '--permission-mode auto',
+ 'codex': '--approve-for-me',
'cursor': '--force',
'opencode': '--auto',
};
@@ -1218,7 +1218,7 @@ class _BypassCheck extends StatelessWidget {
AppCheckbox(value: value, hovered: hovered, onChanged: onChanged),
const SizedBox(width: 10),
Text(
- 'Bypass approvals',
+ 'Auto-approve',
style: TextStyle(
fontSize: 13,
color: onChanged == null
diff --git a/desktop/test/new_agent_choices_layout_test.dart b/desktop/test/new_agent_choices_layout_test.dart
index 818850ee3..f49f57122 100644
--- a/desktop/test/new_agent_choices_layout_test.dart
+++ b/desktop/test/new_agent_choices_layout_test.dart
@@ -256,13 +256,13 @@ void main() {
await tester.ensureVisible(advanced);
await tester.tap(advanced);
await tester.pumpAndSettle();
- await tester.ensureVisible(find.text('Bypass approvals'));
+ await tester.ensureVisible(find.text('Auto-approve'));
expect(find.text('Permissions'), findsNothing);
expect(find.text('Add'), findsOneWidget);
if (size.width >= 900 && scale == 1) {
final settingsCenter = tester.getCenter(advanced).dy;
for (final control in [
- find.text('Bypass approvals'),
+ find.text('Auto-approve'),
find.byKey(const Key('new-agent-codex-profile-field')),
find.text('Add'),
]) {
@@ -273,7 +273,7 @@ void main() {
await tester.ensureVisible(advanced);
await tester.tap(advanced);
await tester.pumpAndSettle();
- expect(find.text('Bypass approvals'), findsNothing);
+ expect(find.text('Auto-approve'), findsNothing);
expect(find.text('Add'), findsNothing);
final recent = find.byKey(const Key('new-agent-project-recent'));
await tester.ensureVisible(recent);
diff --git a/desktop/test/new_agent_dsh_test.dart b/desktop/test/new_agent_dsh_test.dart
index 2845dd00f..4e3e08be8 100644
--- a/desktop/test/new_agent_dsh_test.dart
+++ b/desktop/test/new_agent_dsh_test.dart
@@ -241,8 +241,8 @@ void main() {
await tester.pumpAndSettle();
// Its base engine's bypass flag is the one offered: a harness has no
// flag of its own, and without the base's it would say "Managed by".
- await tester.ensureVisible(find.text('Bypass approvals'));
- expect(find.text('Bypass approvals'), findsOneWidget);
+ await tester.ensureVisible(find.text('Auto-approve'));
+ expect(find.text('Auto-approve'), findsOneWidget);
expect(find.textContaining('Managed by'), findsNothing);
await create(tester);
diff --git a/desktop/test/new_agent_engine_check_test.dart b/desktop/test/new_agent_engine_check_test.dart
index 99fdc3046..a2667057b 100644
--- a/desktop/test/new_agent_engine_check_test.dart
+++ b/desktop/test/new_agent_engine_check_test.dart
@@ -144,8 +144,8 @@ void main() {
await tester.ensureVisible(find.byKey(const Key('new-agent-advanced')));
await tester.tap(find.byKey(const Key('new-agent-advanced')));
await tester.pumpAndSettle();
- await tester.ensureVisible(find.text('Bypass approvals'));
- await tester.tap(find.text('Bypass approvals'));
+ await tester.ensureVisible(find.text('Auto-approve'));
+ await tester.tap(find.text('Auto-approve'));
await tester.pump();
final retry = find.byKey(const Key('new-agent-retry-check'));
await tester.ensureVisible(retry);