Repository navigation
feat(agents): add Auto to the global agent permission switch - #30677
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to
|
77352a0 to
fc03f7f
Compare
…xceptions Replace the Set defaults menu and inline per-row dropdowns with a global Manual | Auto | Yolo switch. Auto reveals an Other agents control beneath it, mixed states badge exceptions, and each row's expanded panel owns its per-agent permission choice.
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
894e5a58-4400-40fc-8bb5-a96074b43d09
📒 Files selected for processing: 28
src/renderer/src/components/settings/AgentCatalogRow.tsxsrc/renderer/src/components/settings/AgentLaunchSettingsCatalog.tsxsrc/renderer/src/components/settings/AgentPermissionsSetting.tsxsrc/renderer/src/components/settings/AgentRowPermissions.tsxsrc/renderer/src/components/settings/AgentsPane.test.tsxsrc/renderer/src/components/settings/AgentsPane.tsxsrc/renderer/src/components/settings/HostAgentLaunchSettings.test.tsxsrc/renderer/src/components/settings/SettingsFormControls.tsxsrc/renderer/src/components/settings/agent-launch-settings-transport.tssrc/renderer/src/components/settings/agent-permission-baseline.tssrc/renderer/src/components/settings/agent-permission-mode-label.tssrc/renderer/src/components/settings/agent-row-permission-model.tssrc/renderer/src/components/settings/agents-search.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/fr.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/shared/agent-launch-runtime-capability.tssrc/shared/agent-launch-settings-auto-projection.test.tssrc/shared/agent-launch-settings-permissions.test.tssrc/shared/agent-launch-settings.tssrc/shared/rpc-contract/agent-launch-settings-params.tssrc/shared/tui-agent-permissions.test.tssrc/shared/tui-agent-permissions.tstests/e2e/agent-auto-permissions.spec.tstests/e2e/host-agent-launch-settings-hook-bookkeeping.unit.test.ts
💤 Files with no reviewable changes: 5
- src/renderer/src/i18n/locales/es.json
- src/renderer/src/i18n/locales/zh.json
- src/renderer/src/i18n/locales/fr.json
- src/renderer/src/i18n/locales/ko.json
- src/renderer/src/i18n/locales/ja.json
🚧 Files skipped from review as they are similar to previous changes: 2
- src/renderer/src/components/settings/agents-search.ts
- src/renderer/src/i18n/locales/en.json
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.
| export function resolveAgentPermissionModeSummary( | ||
| args: AgentPermissionSettings | ||
| ): AgentPermissionMode { | ||
| const presets = presetPermissionModes(args) | ||
| const autoModes = presets.filter(({ agent }) => agent in AUTO_TUI_AGENT_ARGS) | ||
| // Auto changes only supporting agents, so the rest keep their existing permission policy. | ||
| if (autoModes.length > 0 && autoModes.every(({ mode }) => mode === 'auto')) { | ||
| return 'auto' | ||
| } | ||
| return combinePermissionModes(presets.map(({ mode }) => mode)) | ||
| } |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
sed -n '170,205p' src/shared/tui-agent-permissions.ts
rg -n "onboarding(Completed|Complete|Version|Dismissed)|showOnboarding|reopenOnboarding|restartOnboarding|replayOnboarding" src/renderer/src src/shared src/main | head -40
sed -n '1,60p' src/renderer/src/components/onboarding/use-onboarding-yolo-permissions.tsRepository: stablyai/orca
Length of output: 6574
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- onboarding files ---'
rg --files src/renderer/src/components/onboarding src/renderer/src/components/sidebar | sort
printf '%s\n' '--- show action and menu caller ---'
sed -n '1,140p' src/renderer/src/components/onboarding/show-onboarding-event.ts
sed -n '110,165p' src/renderer/src/components/sidebar/SidebarSettingsHelpMenu.tsx
printf '%s\n' '--- onboarding references and mounts ---'
rg -n -F --glob '*.{ts,tsx}' -e 'showOnboardingFromRenderer' -e 'Onboarding' -e 'onboarding' src/renderer/src/components/onboarding src/renderer/src | head -200
printf '%s\n' '--- persistence block ---'
sed -n '1,235p' src/renderer/src/components/onboarding/use-onboarding-flow-persistence.ts
printf '%s\n' '--- onboarding tests around entry and persistence ---'
sed -n '1,230p' src/renderer/src/components/onboarding/use-onboarding-flow-persistence.test.tsRepository: stablyai/orca
Length of output: 42582
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- reopen action ---'
nl -ba src/renderer/src/components/onboarding/show-onboarding-event.ts
printf '%s\n' '--- settings menu caller ---'
nl -ba src/renderer/src/components/sidebar/SidebarSettingsHelpMenu.tsx | sed -n '125,155p'
printf '%s\n' '--- render gate and flow entry ---'
nl -ba src/renderer/src/components/onboarding/should-show-onboarding.ts
rg -n -F --glob '*.{ts,tsx}' -e 'shouldShowOnboarding' -e 'onboarding-reopened' -e 'OnboardingFlow' src/renderer/src/components/onboarding src/renderer/src | head -80
printf '%s\n' '--- agent persistence exact block ---'
nl -ba src/renderer/src/components/onboarding/use-onboarding-flow-persistence.ts | sed -n '170,210p'
printf '%s\n' '--- permission replacement exact block ---'
nl -ba src/shared/tui-agent-permissions.ts | sed -n '175,220p'Repository: stablyai/orca
Length of output: 16207
Preserve Auto permissions when onboarding is reopened.
The Settings help menu can reopen onboarding after Auto is configured. The reopened flow resets to the agent step, where auto is treated as Yolo and replaces Auto arguments with dangerous-skip arguments. Preserve the saved Auto configuration until the user changes the permission toggle.
Suggested fix
-import { applyAgentPermissionMode } from '../../../../shared/tui-agent-permissions'
+import {
+ applyAgentPermissionMode,
+ resolveAgentPermissionModeSummary
+} from '../../../../shared/tui-agent-permissions'
...
if (currentStepId === 'agent') {
const defaultTuiAgent = selectedAgentOrBlank(selectedAgent)
+ const preserveAutoPermissions =
+ !yoloPermissionsChosen.current &&
+ resolveAgentPermissionModeSummary({
+ agentDefaultArgs: settings.agentDefaultArgs,
+ agentDefaultEnv: settings.agentDefaultEnv
+ }) === 'auto'
await updateSettings({
defaultTuiAgent,
- ...applyAgentPermissionMode({
- mode: yoloPermissions ? 'yolo' : 'manual',
- agentDefaultArgs: settings.agentDefaultArgs,
- agentDefaultEnv: settings.agentDefaultEnv
- }),
+ ...(preserveAutoPermissions
+ ? {}
+ : applyAgentPermissionMode({
+ mode: yoloPermissions ? 'yolo' : 'manual',
+ agentDefaultArgs: settings.agentDefaultArgs,
+ agentDefaultEnv: settings.agentDefaultEnv
+ })),
ELI5
Settings → Agents now has one permission switch with three choices: Manual | Auto | Yolo. Auto lets the agent approve routine actions itself; it works for Claude, Claude Agent Teams, and Codex. When you pick Auto, a small Other agents control appears so you choose what every other agent does. This PR changes how new terminal launches start. Native-chat integration is stacked in #30853.
What Changed
Before: the global switch offered only Manual or Yolo. Getting Auto meant hand-editing an agent's command arguments, and one agent with custom arguments left the switch permanently "mixed."
After:
Mechanism: the existing global permissions mutation gains an optional
exceptAutoflag, which the Other agents control uses to update only non-Auto agents. The client sends it only to hosts that advertise the Auto capability (also new in this PR), so no older host ever receives it. The settings projection gains an optionalnonAutoPermissionModefield; older clients ignore it. Each agent's change is still saved as that agent's CLI flags. Native-chat defaults and existing chats are unchanged here.Why
Auto is a per-agent capability, but people think about permissions as one choice. Putting Auto in the global switch keeps that one choice, while the tooltip and the Other agents control make clear that it doesn't apply to every agent.
Alternatives we rejected:
Linked Issue
Refs #13081 — Claude Code Auto and Codex Approve for me. The stacked native-chat PR #30853 also addresses #25559.
Visual Proof
Real Orca Electron renderers, captured with Playwright CDP. The Mixed and tooltip captures were taken before native-chat moved to #30853; this PR's UI is identical, because #30853 only changes what is saved for chats.
More states
Yolo
Supported agents tooltip
Mixed: no segment selected, exception badges on differing rows
Row opened from its badge, with its own Permissions control
Custom-arguments row: "Replace with {mode}"
Older host: Auto disabled with an inline note
Light theme
Narrow window
Testing
On macOS, with background launches:
pnpm tcpassed.exceptAuto, custom-argument preservation, mixed-state summaries, the older-host gate, and the backward-compatible projection.tests/e2e/agent-auto-permissions.spec.tspassed headless.Full repository lint/test/build remain for CI. Platform and host paths have automated coverage; live Linux/Windows/SSH validation was not performed.
Review
Stack: merge this settings PR first, then #30853 for native-chat integration. #19244 overlaps agent rows and permission mappings; reconcile its global presets with this switch. #14745 concerns Claude's live native-chat permission picker and is relevant to the second PR.
Agent skill upstream boundary
Notes
Auto requires CLI support. Mixed versions:
exceptAutois sent only to hosts advertising Auto, and older clients ignorenonAutoPermissionMode. No git-provider behavior or stream opcode changed.Checklist