Skip to content

Store a typed agent permission mode instead of reading it from Arguments - #24508

Closed
brennanb2025 wants to merge 20 commits into
mainfrom
brennanb2025/sta-8902-typed-permission-mode
Closed

brennanb2025 wants to merge 20 commits into
mainfrom
brennanb2025/sta-8902-typed-permission-mode

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 35 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​3074 $\color{#cf222e}{\Huge{\mathbf{−}}}$​288 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2786
Prod 59 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1892 $\color{#cf222e}{\Huge{\mathbf{−}}}$​537 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1355

ELI5

Settings has a switch called Agent Permissions (Yolo or Manual). Until now Orca never remembered which one you picked. It worked it out each time by checking whether each agent's free-text Arguments box contained that agent's "skip permission prompts" flag (for Claude, --dangerously-skip-permissions). If you typed anything else into the box, for example --model opus, the flag was gone, so Claude asked before every action. The switch still said Yolo, and clicking Manual did nothing.

This PR makes Orca remember the choice itself. It stores a real setting, Yolo or Manual, plus an optional choice for each agent. Orca adds the flag when it launches the agent. Your Arguments box now only holds your own extra arguments.

What Changed

What you saw before (GitHub #23853, #23387 / STA-8902, STA-8699)

  • Windows 1.4.215: Settings showed Agent Permissions = Yolo, but a new Claude started from the Chat view ran claude.exe --model opus without --dangerously-skip-permissions, so Claude asked permission before every read.
  • On the same build, clicking Manual left the switch on Yolo.

Why it happened

  • Orca stored no permission setting. The switch guessed one from each agent's Arguments text. Text that was anything other than empty or exactly the flag counted as "mixed", and "mixed" was displayed as Yolo (AgentsPane.tsx).
  • Clicking the switch skipped every agent with custom Arguments, so nothing changed and the switch stayed on Yolo (STA-8699).
  • The launch code was not dropping the flag. Every launch passes the saved Arguments through unchanged. The flag was simply not in Claude's saved Arguments.
  • That Claude's saved Arguments held --model opus is our inference from the command line in the report. We asked the reporter on [Bug]: Terminal-backed Chat UI ignores Claude agentDefaultArgs permission mode #23853 and it is unconfirmed. The rig profile used for the screenshots reproduces the reported command line.

What's different now

  • Settings → Agents → Agent Permissions shows the stored choice and always moves when you click it. Clicking it changes the shared default. An agent you set separately keeps its own choice, and its card's Default option makes it follow the switch again. Clicking the option that's already selected changes nothing. Re-running onboarding and answering Yolo or Manual also sets only the shared default.

  • Under the switch, "Set separately: …" names every agent the switch won't move, with how it launches:

    • each agent with its own choice, even one that matches the current default or isn't installed on this machine (it may run on an SSH host);
    • each installed agent whose Arguments or environment make it launch differently.

    An agent that isn't installed here but has its own choice shows its Permissions control in the "Available to install" list, so the choice can be cleared.

  • Each agent's row (expand it) has its own Permissions control: Default / Yolo / Manual.

  • For the [Bug]: Terminal-backed Chat UI ignores Claude agentDefaultArgs permission mode #23853 setup (Claude's Arguments were --model opus, so Claude really launched prompting), the upgrade keeps that and lists "Set separately: Claude (Manual)". To get Yolo for Claude, set Claude's own card to Yolo or Default. Flipping the shared switch doesn't override a per-agent choice.

  • If an agent's Arguments or environment set permissions themselves, the row says so in a warning that names them: "Arguments or environment set permissions themselves (-a on-request), so Codex uses them instead of this setting." Orca then adds no flag beside them, because some CLIs refuse conflicting flags (Codex rejects its bypass flag combined with -a).

    • Orca reads the words the agent will actually receive (quotes removed), using one list of permission options per agent.
    • Settings shows Yolo when those settings bypass: the bypass flag itself, Claude --permission-mode bypassPermissions, Codex --yolo or -a never -s danger-full-access, Gemini and Qwen Code -y / --yolo / --approval-mode yolo, Devin --permission-mode bypass, or Goose GOOSE_MODE=auto, in --option value or --option=value form.
    • Claude's --allow-dangerously-skip-permissions only permits switching to bypass later, so Yolo still adds the flag beside it.
    • Devin's --respect-workspace-trust only controls its folder-trust prompt. Yolo adds it with the bypass, unless your Arguments already set it.
  • Adding a model or any other text to Arguments no longer turns Yolo off.

  • Source Control AI actions and fix-checks launches that carry their own arguments now follow each agent's effective mode, the one its Settings card shows. Before, their arguments replaced the saved flag, so those launches quietly ran without it.

    • This is a behaviour change for Yolo users: an agent shown as Yolo now bypasses prompts in these launches too, including one that is in Yolo through its own Arguments (for example Gemini -y).
    • An agent whose own Arguments ask (for example Codex -a on-request or Claude --permission-mode acceptEdits) never gets the flag from these launches. Neither does a launch whose own arguments set permissions.
    • The Source Control dialog's command preview uses the same rule, so it shows what will launch.

Upgrade (one-time migration, runs at load)

  • Each agent's saved arguments are read the way they actually launched. The bypass flag is lifted out into the new setting, and the rest stays as your extra arguments.
  • Example: --model opus becomes Manual for Claude with extra arguments --model opus (that is what really launched). --dangerously-skip-permissions --model opus becomes Yolo with extra arguments --model opus.
  • The earlier rules still apply:
    • Agents with a command override, and agents added after an older migration, stay Manual.
    • Text that sets permissions another way keeps the flag inline, so nothing is lost. An agent whose Arguments bypass another way (for example Gemini -y) keeps that text and is recorded as Yolo, which is how it launches.
    • The shared default is whichever mode most agents had (a tie means Manual), and the other agents get their own choice. This vote counts every agent Orca knows, installed or not, because a profile migrated by an older build really did launch the agents added later in Manual. Such a profile can therefore open with the switch on Manual and its Yolo agents listed under it.
  • The full migration runs once. A stored mode marks the profile as migrated, including a mode or a per-agent choice that a newer Orca wrote; this build keeps it and reads it as Manual.
  • On every load Orca still moves a bypass flag (or Goose GOOSE_MODE=auto) found in an agent's saved Arguments into that agent's mode, so text an older build wrote back can't keep bypassing behind the switch. On data this build wrote, that changes nothing.
  • The flag is only cut out where every shell (POSIX, PowerShell and cmd) reads it as a plain word of its own, and only when every shell then reads the rest of the text as exactly the same words as before. Anything else stays in the text exactly as you wrote it, so an unusual spelling can only cause more prompts, never fewer.
  • Composing the result gives back every agent's original options, with the flag moved to the front.
  • Saved settings, on the desktop and in the paired web client, always hold an entry for every agent's extra text, even when it is empty. So an older Orca never reads a missing entry as "use the bypass flag".
  • The web client's saved settings get the same migration.

Mechanism

  • New settings fields: agentPermissionMode ('bypass' | 'ask', the shared default) and agentPermissionModeOverrides (per agent). agentDefaultArgs / agentDefaultEnv now hold only the user's extra text and env.
  • One function, resolveTuiAgentLaunchArgs (with resolveTuiAgentLaunchEnv for Goose's env-based mode), turns the mode into the CLI flag. Every launch path goes through it: new tab, Chat view, quick launch, automations, worker-start, sleeping-session wake, cold restore with no recorded config, and host-side launches. They now pass the settings and the platform and shell the launch uses, instead of the raw text.
  • One table of permission options per agent (AGENT_PERMISSION_ARG_SPECS, next to the bypass flags) and one reader (classifyTypedAgentPermissions: none / bypass / other) decide what typed Arguments and env do. The launch, Settings, structured chat and the migration all use them. Typed text is read with the shell that will launch it.
  • Structured chat (Claude SDK and Codex app-server) reads the same setting through resolveAgentPermissionPosture, which is also what the Settings card shows.
  • Removed the "guess from text" readers (resolveAgentPermissionModeSummary, applyAgentPermissionMode, resolvedTuiAgentArgsBypassPermissions).

Resume

  • A resumed terminal session reuses the arguments recorded when it launched (launchConfig.agentArgs, already stored before this change), so it keeps the mode it started with. Only a session with no recorded config uses the current setting.
  • The reporter saw --permission-mode auto on resume. Orca never writes that string (checked by searching the code). Claude Code 2.1.x rebuilds its own command line with --permission-mode <current mode> when it relaunches itself, which I confirmed in the shipped binary's code. I did not reproduce the relaunch live. Orca does not change anything there.

Paired servers, SSH, mobile (no wire change)

  • settings.get still publishes agentDefaultArgs / agentDefaultEnv in the old ready-to-launch shape (flag included), computed on each read. Older mobile clients resuming AI Vault sessions keep working unchanged.
  • A settings.update that writes those fields (the old shape) is converted into the mode plus extra text at the host boundary.
    • Only the agents the write changes are affected. An entry the client writes back unchanged is left alone, so reading the settings and writing them straight back changes nothing.
    • An older client that doesn't know a newer agent leaves that agent's mode and text alone.
    • No shipped client writes these fields today (desktop, web, mobile and the CLI send other settings only), so this conversion serves third-party settings.update callers. It goes away if the RPC stops accepting the old shape.
  • The paired web client no longer copies the host's agent arguments out of a settings.update reply. Its load path already didn't, so its agent launch settings stay its own and the host's ready-to-launch text never lands in its Arguments box.
  • When a client launches on a paired host with its own arguments, it sends them already combined with its mode. Launches that send no arguments let the host apply its own setting, as before. No new field is added, so old hosts keep today's behaviour.

Windows

  • The flag and the extra text are joined as separate arguments before the shell-specific quoting. Tests cover POSIX, PowerShell and cmd quoting of the combined command.
  • Typed Arguments are read with the shell that launches them, so a Windows path ending in \ before an option (for example --include-directories C:\code\ -y) reads as that option under PowerShell, the way PowerShell passes it.

Why

The bug class is "free text is the setting". A permission choice stored inside a free-text box gets lost whenever the user edits the box, and then it can only be guessed back from the text. Fixing the display alone would still let one edit silently turn Yolo off. Storing a typed mode and turning it into the flag in one place removes that class.

How this compares with the common pattern (a typed mode with a settings default, recorded on the session, with one adapter mapping the mode to the CLI flag or SDK mode):

  • Matches:

    • a typed mode with a default plus per-item choices;
    • one place maps the mode to the flag at launch;
    • resumed terminal sessions keep the mode recorded at launch;
    • changing the default keeps every per-item choice, and each one is undone on its own card.
  • Partly matches: a permission option typed into launch arguments wins over the mode. The common pattern does this by option name for one agent; Orca does it for every agent in its permission table.

  • Intended difference: a single Orca-wide default plus per-agent choices, with no per-project default. Orca has no per-project agent defaults today, and adding them is a different feature.

  • Intended difference: agents added in future releases follow the stored default. The old per-load rule ("new agents stay Manual") only existed because nothing was stored to tell a deliberate Yolo apart from an old default. The migration still applies that rule once, to agents missing from older profiles.

  • Intended difference: Settings reads Arguments with this machine's terminal shell, while a launch reads them with the shell it runs under. So a launch under a different shell can read unusual quoting or escapes differently. That covers:

    • SSH or paired hosts;
    • Windows projects that run in WSL;
    • terminals or restored tabs set to their own shell;
    • work-item and onboarding launches when the terminal shell is cmd or Git Bash.

    Ordinary Arguments read the same everywhere.

  • Temporary difference: structured chat reads the setting each time it starts or resumes, instead of recording it on the session. That was already the case and is unchanged here. The follow-up is a per-session mode the Chat view can change (STA-3427).

  • Temporary difference: a launch on a paired host that carries its own arguments or a prompt uses the client's mode, not the host's; a bare launch with no prompt uses the host's. This keeps today's ownership. Making the host own the mode needs a capability-gated wire field and belongs with STA-4798.

  • Intended difference: downgrading to an older Orca after this change launches agents in Manual, on the desktop and in a paired web client (which gets the older web app from its downgraded host).

    • The older build reads the saved extra arguments, which no longer hold the flag. Every agent has an explicit entry, so none falls back to the old "use the bypass flag" default.
    • The older build's switch still shows Yolo (its old "mixed" reading) while it launches Manual.
    • No later release can change what an older build does with this file, so this is permanent, not temporary. It fails toward more prompts, never fewer, so I did not keep a second launch-ready copy of the old field.
    • Upgrading again re-reads the text: a flag the older build wrote back (for example by clicking its Yolo switch) moves back into the mode.

Linked Issue

Fixes #23853
Fixes #23387
Linear: STA-8902, STA-8699

Visual Proof

Before (main), same saved profile as the report: every agent was Yolo, Claude's Arguments were --model opus (so it really launched prompting), and Codex's were -a on-request. Captured in a hidden, isolated rig over CDP.

  • Agent Permissions shows Yolo, although Claude and Codex launch prompting: before
  • Claude's row gives no sign that Claude launches without the flag: before
  • Clicking Manual leaves the switch on Yolo (STA-8699): before

After (this PR). Captured on a separate Mac in a hidden Orca build with its own home folders and stub agent CLIs that record their arguments, driven over CDP by a non-Claude agent. Same saved profile as the "before" shots (build a279c30):

Screenshot What it shows
switch yolo After the upgrade: the switch is on Yolo, and "Set separately: Claude (Manual), Codex (Manual)." names the two agents that really launch prompting.
claude card upgraded Claude's card: Arguments --model opus, Permissions Manual, which is how it really launched.
switch manual Clicking Manual moves the switch and changes only the default. The agents with their own choice stay listed.
claude card yolo Claude's card set to Yolo. The next Claude launch from the Chat view received --dangerously-skip-permissions --model opus, flag once.
switch after claude yolo The line now reads "Set separately: Claude (Yolo), Codex (Manual)."
codex card Codex's card: its Arguments -a on-request set permissions themselves, so it stays Manual and the warning says why.
aider listed An agent that isn't installed on this machine but has its own choice (Aider) is still listed.
aider row Its row shows the Permissions control, so the choice can be cleared.

Testing

  • I manually tested these changes (on a separate Mac, in a hidden Orca build with its own home folders, profile and stub agent CLIs, driven over CDP; three passes, the last on a279c30. See Visual Proof.)

  • Automated tests added/updated

  • New and updated tests cover:

    • the migration: bypass-only, custom arguments with and without the flag, the flag plus another permission option, bypass spellings kept inline, quoted and escaped flags left in place, command-override users, agents added after an older migration, the Devin default, lossless, idempotent, the per-load lift, unknown modes from newer builds, and explicit empty entries that keep a downgrade in Manual;
    • every launch entry point getting the flag from the mode;
    • Source Control and fix-checks following each agent's effective mode, including the dialog preview;
    • the shared switch changing only the default;
    • the "Set separately" list, including agents that aren't installed;
    • Settings and caller-argument launches agreeing on darwin, Windows PowerShell and Windows cmd (a 1,638-row matrix);
    • ordinary Arguments unchanged;
    • structured Claude and Codex policies;
    • the paired-host publish and legacy write, including a get, unchanged write, get matrix of 288 rows;
    • the web client migration;
    • POSIX / PowerShell / cmd quoting.
  • Fails without the change: every round of fixes was checked by removing the production change and confirming its new tests fail.

  • After merging main, ran 342 related test files: 7,229 tests passed (22 skipped, including a live-shell test file that only runs when enabled). Five tests timed out on a heavily loaded machine and passed when re-run. Also ran the 3 mobile test files that touch agent launch arguments (42 tests).

  • tsc for node, web and cli: clean. oxlint and oxfmt run on the changed files, and the changed-code quality gate passes. Localization catalogs verified, with new strings added to all six locales.

  • Platforms: macOS, by tests and live QA. Windows quoting and the Windows shells are covered by unit tests only. The Source Control agent dialog and its preview were not exercised live (unit tests only).

Known limits (not fixed here)

  • Settings knows each agent's bypass flag and its documented other spellings. A spelling outside that list, such as Codex config overrides -c approval_policy=never -c sandbox_mode=danger-full-access, is passed through as plain text: under Manual, Settings shows Manual while that agent runs without prompts. (Main showed it as Yolo only because it showed all custom text as Yolo.)
  • Arguments are read word by word, without knowing which other options take a value. So the flag given as another option's value, quoted or not (for example --append-system-prompt --dangerously-skip-permissions), reads as the bypass flag. Settings shows Yolo and Orca adds no flag, while the agent takes the word as that option's value. It launches exactly as before this change.
  • When Claude's Arguments hold the bypass flag together with another --permission-mode (for example plan), Settings and structured chat read it as not bypassing. Which of the two Claude itself follows isn't documented, so the terminal launch may still bypass.
  • Unchanged from main: on Windows with cmd as the terminal shell, an option typed after a path that ends in a backslash (--include-directories C:\code\ -y) never reaches the agent. Orca's cmd quoting leaves that backslash escaping the closing quote. A follow-up issue is drafted.

AI Disclosure

Review

Four /code-review (high) loops, then repeated rounds of independent review and fixes covering the migration, every launch path, the paired-host wire, Settings, and Windows shell parsing. Every finding was either fixed or recorded above under the differences and known limits.

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Security: the change adds the bypass flag only where an agent's effective mode, the one its Settings card shows, is Yolo. An agent shown as Manual never gets it, and Arguments that set permissions themselves always win.
  • Cross-platform: covered above.
  • SSH and paired servers: no wire change, and the old shape is kept at the boundary.
  • Mobile: unchanged. It reads the published shape through a renamed helper.
  • Performance: each agent's permission state is computed once per Settings render, and typed Arguments are now read with one shell grammar instead of three.

X: @BrennanKB5

Checklist

  • This PR is small and focused. It touches about 85 files, because every launch site moves to the typed mode. Most of those edits are one or two lines.
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred). Run locally: tsc node/web/cli, oxlint on changed files, related tests. CI covers the rest.

…m free-text arguments

Settings stores a per-agent permission mode (a shared default plus per-agent
overrides). One function turns it into the agent's bypass flag at launch, so a
model or other text in Arguments no longer silently turns Yolo off, and Settings
shows each agent's real posture instead of 'mixed' as Yolo.

Refs STA-8902, STA-8699, #23853, #23387
…liases

- Keep the bypass flag inside text that also sets permissions, since a launch adds no flag beside it
- Read codex --yolo and claude --permission-mode bypassPermissions as bypass
- Detect permission options under every launch grammar
- Paired-client writes replace the whole record, as before, and don't flip the mode of text that decides itself
- Show the env editor for env-mode agents; summarize installed agents only; resolve each posture once
- Paired web client keeps the typed shape when merging the host's settings reply
- Detect Gemini/Qwen approval options and Codex attached short options; read Goose's typed env as its posture
- Source Control preview composes args the same way the launch does
- One normalizer for the permission fields; memoize postures; split argument reading into its own module
- Lift the flag from Windows-quoted legacy text
- Paired writes change only the agents they name
- Devin's second bypass option counts as a permission option
- Web client keeps its own agent launch settings when merging a host reply
- Rows with a per-agent permission choice open expanded; narrower memo deps
- Lift the flag after Windows paths POSIX mis-splits (PowerShell grammar fallback)
- Apply the older Devin bypass rewrite in the shared lift (web and paired paths too)
- Cache published launch records per settings snapshot and option names per agent
- Line-specific SAFETY notes on fixture casts in edited test statements
@brennanb2025
brennanb2025 marked this pull request as ready for review October 2, 2026 04:32
@greptile-apps

greptile-apps Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[High risk] Refactors how agent permission settings are stored and resolved.

The PR appears safe to merge based on the reviewed changes and resolved prior findings.

Summary

The PR stores agent permissions as a typed default with per-agent overrides, migrates saved launch arguments, and composes permission flags at launch. The changes since the previous review add Gemini and Qwen Code bypass aliases and regression tests. No new actionable issue was identified.

Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Stored default and per-agent override] --> B[Resolve agent posture]
  C[User arguments and environment] --> B
  B --> D[Compose terminal launch flags and environment]
  B --> E[Structured Claude or Codex policy]
Loading

Reviews (2) · Last reviewed commit: "fix(agents): read Gemini and Qwen Code -..."

Comment thread src/shared/tui-agent-permission-args.ts Resolved
Comment thread src/shared/tui-agent-permission-args.ts Resolved
@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a8ff02fc-208d-4c3f-8a28-82c4f0971432
📥 Commits

Reviewing files that changed from the base of the PR and between ec202ed and b463a8f.

📒 Files selected for processing (18)
  • src/renderer/src/components/onboarding/use-onboarding-flow-persistence.test.ts
  • src/renderer/src/components/onboarding/use-onboarding-flow-persistence.ts
  • src/renderer/src/components/right-sidebar/buildSourceControlAgentDeliveryPlan.test.ts
  • src/renderer/src/components/settings/AgentPermissionControls.tsx
  • src/renderer/src/components/settings/AgentsPane.permission-switch.test.tsx
  • src/renderer/src/components/settings/AgentsPane.tsx
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/lib/agent-launch-caller-permissions.test.ts
  • src/shared/tui-agent-launch-defaults.test.ts
  • src/shared/tui-agent-launch-defaults.ts
  • src/shared/tui-agent-permission-args.ts
  • src/shared/tui-agent-permissions.test.ts
  • src/shared/tui-agent-permissions.ts
💤 Files with no reviewable changes (2)
  • src/shared/tui-agent-permissions.test.ts
  • src/shared/tui-agent-permissions.ts
🚧 Files skipped from review as they are similar to previous changes (7)
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/components/settings/AgentPermissionControls.tsx
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/es.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

The change introduces shared bypass and ask permission modes with per-agent overrides. Launch resolvers classify permission options in agent arguments and environment, then compose launch-ready values from settings. Persistence paths lift legacy permission flags into typed profiles. Runtime, renderer, and mobile launch paths now use composed settings. The Agents pane adds controls for shared and per-agent modes, and onboarding and translations are updated to use the new settings.

Priority: ➖ Normal

Merge Risk: 🔵 Low · up to b463a

The permission-mode changes look consistent across the reviewed launch, settings and migration paths. One cosmetic point needs a check: the PR screenshots show a "Manual" badge beside an agent's name, but the code deliberately renders none. Confirm which behavior is intended, then update the screenshots or add the badge.

Security Architecture Review

Security architecture risk: 🔵 Low · up to b463a

The change makes permission choices explicit and includes compatibility protections. No newly introduced security weakness was established, but permission behavior across every recovery and persistence-failure path remains incompletely verified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — A shared permission change can affect subsequent launches for every supported agent inheriting that mode, including launches routed to a remote workspace. The inspected runtime binds creation to a workspace identity; that routing control alone does not establish the subprocess's maximum filesystem, credential, or network exposure.

Security Findings and Attack Paths

  • observed — Caller-supplied launch arguments and client updates to launch arguments or environment are authority-bearing inputs, but both capabilities existed in the inspected main revision. No newly introduced unauthorized path was established; complete caller authorization remains a coverage gap.

Trust Boundaries and Controls

  • observed — The settings mutation boundary validates typed permission updates before replacing the settings snapshot. Unknown stored mode strings resolve to ask rather than bypass, preserving a conservative interpretation of values written by newer versions.
  • observed — The inspected encrypted mobile channel validates authentication shape, protocol version, and a resolved device token, rejecting unsuccessful authentication. This is counterevidence to anonymous reachability, not a complete authorization proof for all settings and launch transports.

Resilience and Maintainability Implications

  • observed — Sleeping-session and cold recovery prefer recorded launch arguments and environment when available. Explicit local vault resume instead uses current settings, as it did in the inspected main revision. A later Manual selection therefore does not by itself prove revocation of previously recorded bypass posture; this recovery distinction predates the PR.
  • observed — Settings updates replace the in-memory snapshot before scheduling persistence and notifying listeners. This gives readers a single updated snapshot, but the inspected boundary does not establish durable-save atomicity or restoration of the previous permission posture after a save failure.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.16% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 102 functions across 65 files. (6 skipped… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed [#23853] The launch resolvers now derive terminal-backed Chat launches from the stored permission mode. Resumed terminal sessions retain their recorded launch arguments. The reported incremental chang…
Out of Scope Changes check ✅ Passed The migration, permission controls, launch-path updates, structured-chat policies, paired-server compatibility, mobile resume handling, quoting logic, and tests support the typed permission-mode chang…
Title check ✅ Passed The title clearly summarizes the main change: permission mode is stored as a typed setting instead of inferred from free-text arguments.
Description check ✅ Passed The description covers the required sections, including the change, rationale, linked issues, visual proof, testing, and compatibility notes. The AI Disclosure and Review sections are blank, but the d…
Full details: Docstring Coverage

Explanation

Docstring coverage is 42.16% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 102 functions across 65 files. (6 skipped: 6 unsupported.)

✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
⚔️ Resolve merge conflicts 💡
  • Resolve merge conflict in branch brennanb2025/sta-8902-typed-permission-mode
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • Typed permission mode replaces free-text guessing. agentPermissionMode ('bypass' | 'ask') plus agentPermissionModeOverrides now own the Yolo/Manual choice; agentDefaultArgs/agentDefaultEnv hold only extra text/env. resolveTuiAgentLaunchArgs / resolveTuiAgentLaunchEnv are the single adapters from mode to CLI flag/env at every launch site.
  • One-shot load migration (migrateAgentLaunchProfile): lifts the bypass flag out of legacy args/env into the mode, majority vote becomes the default (tie → ask), the rest become per-agent overrides. Explicitly lossless and idempotent; keeps the flag inline when other permission options are present.
  • Settings UI (AgentsPane, AgentCatalogRow, new AgentPermissionControls): the switch always reflects and writes the stored mode, per-agent rows get a Default/Yolo/Manual control, and agents whose effective launch differs are named as exceptions with a warning when Arguments/env set permissions themselves.
  • Paired-host boundary: settings.get still publishes launch-ready args/env with the flag inline; settings.update from older clients is lifted into mode + extra text via applyComposedAgentLaunchUpdate, touching only named agents. RuntimeClientSettingsUpdate deliberately excludes the new fields, so the host owns the mode. Web client migrates legacy localStorage once and no longer copies host launch-ready args into its own settings.
  • Structured chat (Claude SDK mode, Codex app-server policy) reads the same typed setting through resolveAgentPermissionPosture; removed the three guess-from-text readers.
  • Every launch call site (new tab, composer/quick launch, automations, worker-start, sleeping-session wake, cold restore, AI Vault, host-side) now passes settings instead of raw arg strings, and caller-supplied args are composed with the mode rather than replacing it.

No line-anchored findings after tracing the core resolution, migration round-trip, paired-client write path, web migration, and the updated launch call sites. Test coverage is broad and the several re-pinned expectations match the new semantics.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

…yolo as bypass

Settings and structured sessions now agree with the launch when these are typed into
Arguments under Manual. Also pin that Codex --search keeps Yolo.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

This run re-reviewed the single commit pushed after the prior pullfrog review (3df3cc7).

  • Read Gemini and Qwen Code bypass aliases from Arguments. BYPASS_ARG_ALIASES now lists -y, --approval-mode yolo, and --approval-mode=yolo for gemini, and --yolo, -y, and --approval-mode=yolo for qwen-code, so resolveAgentPermissionPosture reports effectiveBypass for the spellings users actually type, not only the canonical launch flag.
  • Pinned that Codex --search keeps the mode's flag. A test locks in that the long --search option is not misread as the short -s permission option with an attached value.

The added aliases agree with each agent's canonical YOLO_TUI_AGENT_ARGS (gemini → --yolo, qwen-code → --approval-mode yolo) and with the option names already treated as permission-setting. They feed posture detection only — bypassTokenSequences is consumed by resolveAgentPermissionPosture and by liftTuiAgentBypassArgs (which uses only the canonical [0]), so no launch path can gain a duplicate or conflicting flag. The changed tests pass and the delta is lint-clean.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

Launch composition and Settings/structured/migration read an agent's
free-text Arguments with two different rules, so some bypass spellings
(Devin --permission-mode bypass, Grok/Cline --opt=value, Codex
-a never -s danger-full-access) launched without prompts while Settings
showed Manual, and Claude --allow-dangerously-skip-permissions stopped
Yolo from adding the flag.

One per-agent table next to the bypass flags and one classifier
(none / bypass / other) now serve launch, Settings, structured Claude
and Codex, the migration and the settings.update lift. It reads
--opt value and --opt=value under POSIX, PowerShell and cmd grammars and
never treats a quoted word as an option. The migration records an agent
in Yolo through an alias as Yolo and keeps its text.

Every load now moves a bypass flag or env found in a typed profile's
text into that agent's mode, so text an older build writes back cannot
latch. Any stored mode marks the profile migrated; one this build does
not know is kept and read as Manual. The per-agent badge is gone; the
summary line, the selected option and the warning already say it.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 63a224ba-06b3-4540-a05c-98b748f638ff
📥 Commits

Reviewing files that changed from the base of the PR and between 3df3cc7 and 81f12f5.

📒 Files selected for processing (15)
  • src/main/persistence/applying-settings/terminal-settings-migrations.test.ts
  • src/main/persistence/applying-settings/terminal-settings-migrations.ts
  • src/main/runtime/runtime-client-settings-agent-launch-projection.test.ts
  • src/renderer/src/components/onboarding/use-onboarding-flow.ts
  • src/renderer/src/components/settings/AgentCatalogRow.tsx
  • src/renderer/src/components/settings/AgentsPane.test.tsx
  • src/renderer/src/web/preload-api/web-preferences-store-agent-permissions.test.ts
  • src/renderer/src/web/preload-api/web-preferences-store.ts
  • src/shared/agent-launch-profile-lift.ts
  • src/shared/tui-agent-bypass-lift.ts
  • src/shared/tui-agent-launch-defaults.test.ts
  • src/shared/tui-agent-launch-defaults.ts
  • src/shared/tui-agent-permission-args.ts
  • src/shared/tui-agent-permissions.test.ts
  • src/shared/tui-agent-permissions.ts
💤 Files with no reviewable changes (1)
  • src/renderer/src/components/settings/AgentCatalogRow.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

})

expect(markup).toContain('aria-label="Claude permissions"')
expect(markup).not.toMatch(/rounded-full[^>]*>Manual</)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '480,525p' src/renderer/src/components/settings/AgentsPane.test.tsx
sed -n '105,145p' src/renderer/src/components/settings/AgentCatalogRow.tsx
sed -n '190,255p' src/renderer/src/components/settings/AgentCatalogRow.tsx

Repository: stablyai/orca

Length of output: 5796


🏁 Script executed:

rg -n -C 5 "AgentPermissionOverrideControl|function AgentPermissionOverrideControl|Manual" src/renderer/src/components/settings src/renderer/src
sed -n '1,70p' src/renderer/src/components/settings/AgentCatalogRow.tsx
sed -n '470,515p' src/renderer/src/components/settings/AgentsPane.test.tsx

Repository: stablyai/orca

Length of output: 45665


🏁 Script executed:

rg -n -C 4 "AgentPermissionOverrideControl|Manual|SettingsBadge" src/renderer/src/components/settings/AgentPermissionControls.tsx
sed -n '125,155p' src/renderer/src/components/settings/AgentCatalogRow.tsx
sed -n '215,250p' src/renderer/src/components/settings/AgentCatalogRow.tsx

Repository: stablyai/orca

Length of output: 3402


🏁 Script executed:

sed -n '95,190p' src/renderer/src/components/settings/AgentPermissionControls.tsx

Repository: stablyai/orca

Length of output: 2408


🏁 Script executed:

rg -n -C 10 "SettingsSegmentedControl" src/renderer/src/components/settings/SettingsFormControls.tsx

Repository: stablyai/orca

Length of output: 1288


🏁 Script executed:

sed -n '145,185p' src/renderer/src/components/settings/SettingsFormControls.tsx

Repository: stablyai/orca

Length of output: 1687


Assert and render the per-agent “Manual” badge.

AgentCatalogRow renders “Manual” as an option in the expanded Permissions control, not beside the agent name. This assertion rejects the badge required by the stated UI objective. Render the badge beside the name and assert that it appears.

🐛 Suggested test change
-    expect(markup).not.toMatch(/rounded-full[^>]*>Manual</)
+    expect(markup).toMatch(/rounded-full[^>]*>Manual</)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
expect(markup).not.toMatch(/rounded-full[^>]*>Manual</)
expect(markup).toMatch(/rounded-full[^>]*>Manual</)

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

This run re-reviewed the single commit pushed after the prior pullfrog review (8a6c882): the permission classifier refactor.

  • Unified the permission classifier. classifyTypedAgentPermissions now turns Arguments and env into none | bypass | other plus the typed option text Settings names, replacing the separate tuiAgentArgsSetPermissions / agentPermissionOptionNames / bypassTokenSequences readers. Launch, Settings posture, structured sessions and the migration all read the same verdict, so display can no longer disagree with what launches.
  • Declared per-agent permission arg specs. AGENT_PERMISSION_ARG_SPECS lists each agent's option names and the complete settings that bypass (--ask-for-approval never needs --sandbox danger-full-access too), with a specFromBypassFlag fallback for the rest. Claude's --allow-dangerously-skip-permissions is deliberately not a bypass, so Yolo still adds the flag beside it (#23853).
  • Moved the bypass lift into tui-agent-bypass-lift.ts and re-run it on every load through liftAgentBypassFromTypedProfile: a flag an older build wrote back into a typed profile's args/env is lifted into the mode (or the redundant override is cleared when the default already bypasses), and the web client's stored settings do the same. Idempotent.
  • Unknown stored modes are preserved and read as ask (resolveDefaultAgentPermissionMode), and the migration keys on any defined agentPermissionMode rather than a valid one.
  • Removed the redundant per-row permission badge now that the summary line and each agent's own control carry the state.

The delta reads coherently across the launch (shell-agnostic), posture (local shell), migration, web-store and paired-host paths. I ran the focused suites for permission defaults, migrations, permissions, runtime projection, web preferences and AgentsPane (156 tests) — all pass. No line-anchored findings.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

The classifier skipped quoted words, but the launch strips quotes before
the agent sees argv, so Yolo added a bypass flag beside a quoted Codex
`"-a" on-request` and Settings hid a quoted Claude bypass. It now reads
the unquoted words the CLI receives; only the lift refuses to cut a
quoted span, so stored text stays as written.

Devin's --respect-workspace-trust only skips the folder-trust prompt, so
it no longer decides the permission verdict. It still rides along with
Devin's bypass flag, but composition leaves it out when the user's
Arguments already set it, and the lift keeps the user's own value.

The settings.update write lift and the load lift now share one per-agent
lift: Devin's old short default is rewritten only by the legacy pass, as
main did. An entry an older client writes back unchanged is left alone,
and overrides change only for agents the write changed, so get, write,
get is a fixed point.

Per-agent modes a newer build stored are kept on load and read as ask,
like the shared mode.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

This run re-reviewed the single commit pushed after the prior pullfrog review (81f12f5): e8cfcce "read quoted options as the CLI does and keep one lift".

  • Read quoted option names the way the CLI does. readTypedSettings no longer skips quoted tokens, so "-a", "--ask-for-approval=on-request", and "--permission-mode=bypassPermissions" classify as the options the shell hands the CLI. A quoted value that equals the bypass flag now also reads as the flag — the author documents this as a known limit that fails toward more prompts.
  • Split the bypass flag into permission and companion options. New bypassFlagGroups / bypassFlagBeside / argumentsSetOption let the launch drop a companion option the extra arguments already set (Devin's --respect-workspace-trust), and stripBypassFlag now only lifts a flag that launched whole, so the user's own trust value survives.
  • Made the paired-host write a true fixed point. applyComposedAgentLaunchUpdate compares a client's written args/env against what settings.get publishes and ignores unchanged entries (pickChanged), so an older client's whole-record write-back no longer rewrites modes; the override map now starts from the host's stored modes, including ones a newer build wrote.
  • One lift for load and write. The legacy Devin short-flag normalization moved out of liftComposedAgentLaunchProfile into the legacy migrateAgentYoloDefaults pass, so the write path stores exactly what the load path keeps.
  • Preserve unknown stored modes. StoredAgentPermissionMode is now string, normalizeAgentPermissionModeOverrides keeps any string, resolveAgentPermissionMode reads an unknown override as ask, and Settings maps a stored unknown override to its posture mode.

I traced the classifier, flag-group splitting, the migration/write/load round trip, and the paired fixed-point matrix. Ran 454 focused tests across the permission defaults, permissions, migration, runtime fixed-point + projection, web preferences, and AgentsPane suites — all pass. No line-anchored findings.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

New profiles stored agentDefaultArgs as {}, and older builds read a
missing agent entry as "launch with the bypass flag". A paired web
client set to Manual whose host was downgraded got the older web app,
which launched every agent with bypass and Goose with GOOSE_MODE=auto.

Stored profiles, on the host and in the web client, now always hold an
explicit '' for every agent with a bypass flag and {} for env-bypass
agents. One pair of normalizers builds that shape for defaults, the
per-load lift, host and renderer writes and the web merge. A record
missing entries is saved once; clean data still loads unchanged, and
settings.get publishes the same composed values.

Also refreshes two comments left stale by the quoted-option and
unchanged-write changes.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

This run re-reviewed the single commit pushed after the prior pullfrog review (e8cfcce): ec202ed "save explicit empty launch text so a downgrade stays Manual".

  • Spell out empty launch text so a downgrade stays Manual. New normalizeStoredAgentLaunchArgs / normalizeStoredAgentLaunchEnv add an explicit '' (or {}) for every agent with a bypass flag/env, because an older build reads a missing entry as the bypass default. Wired into default settings, the host and renderer write boundary, the web merge, and the per-load lift.
  • Save once when entries are missing. liftAgentBypassFromTypedProfile now marks changed when the spell-out added a key, so a profile saved by an earlier commit of this PR fills in the empty entries on the next load and is idempotent thereafter.
  • Tests updated for the new persisted shape: a host-store downgrade test, a web-client downgrade test, and re-pinned migration / fixed-point expectations; two stale comments refreshed.

Traced the normalizers' idempotency, the paired-host fixed-point path (the real store re-spells after applyComposedAgentLaunchUpdate, then saves once), and the web re-lift path. Ran the five changed test files (378 tests) — all pass.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

… the card

The Agent Permissions switch cleared every per-agent choice, even when
the selected option was clicked again, so a Codex set to Manual quietly
flipped to Yolo. The switch and onboarding's answer now set only the
shared default; an agent keeps its own choice until its card says
Default. Clicking the selected option writes nothing. The tooltip now
says the switch applies to agents without a setting of their own.

Launches that bring their own arguments (Source Control actions,
fix-checks) replaced the configured Arguments and then took the shared
mode, so an agent whose Arguments ask (Codex -a on-request) got the
bypass flag. The composer now follows the agent's effective mode, the
one its card shows: Arguments that ask keep asking, an alias Yolo
(Gemini -y) still gets the flag, and caller args that set permissions
themselves still decide. The Source Control preview uses the same
composer, so it shows what launches.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — the commit is correct and well tested; one documentation mismatch worth fixing.

Reviewed changes

This run re-reviewed the single commit pushed after the prior pullfrog review (ec202ed): b463a8f "keep per-agent choices on the switch; caller args follow the card".

  • The permission switch and onboarding no longer clear per-agent choices. applyAgentPermissionModeToAll is removed; both the Settings switch and onboarding's agent step now write only agentPermissionMode, and the switch no-ops when the clicked option already equals the shown default — so a per-agent Manual survives until its card is explicitly set to Default.
  • Caller-argument launches follow the agent's effective posture. New agentLaunchesInBypass makes resolveTuiAgentLaunchArgs derive the flag from the agent's configured Arguments/env plus the mode rather than the mode alone: Codex -a on-request and Claude --permission-mode acceptEdits no longer get the flag, a Gemini -y alias still does, and caller text that sets permissions still decides alone.
  • Posture classification shares one helper. resolveAgentPermissionPosture now reads through the same classifyConfiguredPermissions / launchesInBypass pair as the new helper (no behavior change).
  • Copy and coverage. The tooltip string was updated in all six locales; new tests cover the switch, onboarding persistence, the Source Control command preview, and caller-argument launches at the source-control and fix-checks entry points.

Verified locally: the six changed test files pass (180 shared/caller tests, 50 renderer tests), and pnpm tc:web / pnpm tc:node are clean.

ℹ️ Nitpicks

  • The PR description is now out of date with this commit: "Clicking it applies to every agent and clears per-agent exceptions" and the known limit "Only a changed answer resets them" describe the old applyAgentPermissionModeToAll behavior — the switch and onboarding now set only the shared default and leave per-agent overrides in place.

Pullfrog  | Fix it ➔ | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

The Settings card read an agent's Arguments with the local shell while
launches that bring their own arguments read them with no shell and
ignored grammars that saw nothing, so on macOS Claude
`--model opus ^--dangerously-skip-permissions` showed Manual while a
Source Control launch added the bypass flag. Both now read one posture:
typed text counts as bypass only when POSIX, PowerShell and cmd parsing
all read it so, since the same text can launch under any of them.

"Set separately" now names every agent the switch won't move: each
agent with its own choice, even one equal to the current default or not
installed here (it may run on an SSH host), plus installed agents whose
Arguments or env launch them differently. An agent that isn't installed
but has its own choice shows its Permissions control so Default can
clear it.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

This run re-reviewed the single commit pushed after the prior pullfrog review (b463a8f): 0760be8 "one effective-mode reading; list and clear every own choice".

  • Unified the permission-posture reading. resolveAgentPermissionPosture and classifyTypedAgentPermissions no longer take a platform/shell argument; Arguments are classified under POSIX, PowerShell and cmd, and count as bypass only when every grammar reads them so. This removes the local-shell reading that let the Settings card and a Source Control launch disagree on ^/backtick-escaped flags.
  • Folded agentLaunchesInBypass into the posture. resolveTuiAgentLaunchArgs and the structured Claude/Codex policy callers now read resolveAgentPermissionPosture(...).effectiveBypass directly, so the card and caller-args launches share one reading.
  • Expanded the Settings "Set separately" list. It now names every agent with an own choice (detected or not — it may run on an SSH host) plus detected agents whose Arguments or env launch them differently.
  • Made an uninstalled agent's own choice clearable. AgentCatalogRow renders the per-agent Permissions control for a non-detected agent that has an override, so Default can remove it.

I traced the all-grammar classifier (including the escape-prefixed and quoted cases), the launch/posture consistency, and the expanded exception list against the row rendering. Ran the four changed test files (tui-agent-launch-defaults, tui-agent-permissions, AgentsPane, AgentsPane.permission-switch) — 1553 tests pass.

Pullfrog  | Fix it ➔ | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

The permission reading of typed Arguments changed rule three times, and
each rule broke a different input: requiring every shell grammar to
agree showed a Windows path ending in a backslash before a bypass option
(Gemini --include-directories C:\code\ -y) as Manual while the Windows
launch bypassed, and the load-time lift still cut escaped flags that
the card read as Manual.

Arguments are now read with the shell that will launch them. Settings
and structured Claude/Codex read them with this machine's local launch
shell, resolved as local launches resolve it, and every composer call
passes its launch's own platform and shell, so a local launch always
agrees with the card. A launch on an SSH or paired host reads them with
that host's shell.

The lift that moves the flag out of stored text on migration and every
load cuts only the flag's exact unquoted, unescaped words, so the cut
means the same under every shell; any other spelling stays in the text
and is read by the launch's shell.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — the delta is correct and the new coverage is solid; a few naming/doc nits below.

Reviewed changes

This run re-reviewed the single commit pushed after the prior pullfrog review (0760be8): a279c30 "read typed Arguments with the shell that launches them".

  • Permission classification now reads with the shell that actually launches. classifyTypedAgentPermissions, resolveAgentPermissionPosture, resolveTuiAgentLaunchArgs, composeTuiAgentLaunchArgsRecord, liftTuiAgentBypassArgs, liftComposedAgentLaunchProfile and applyComposedAgentLaunchUpdate take an AgentLaunchTarget (platform + shell) and classify Arguments under that one grammar; every launch site passes its own target, and the Settings card passes the local one.
  • New shell-target plumbing. AgentLaunchTarget + resolveAgentLaunchGrammar in tui-agent-startup-shell.ts, resolveLocalAgentLaunchTarget in windows-terminal-shell.ts, and resolveFolderWorkspaceAgentLaunchTarget / resolveSourceControlAgentLaunchTarget at the composer entry points; every resolveTuiAgentLaunchArgs / resolveAgentPermissionPosture / composeTuiAgentLaunchArgsRecord / liftTuiAgentBypassArgs / liftComposedAgentLaunchProfile / applyComposedAgentLaunchUpdate call site is updated.
  • The lift stays shell-independent. stripBypassFlag / cutTuiAgentBypassFlag still check every grammar so a cut is safe under any shell, and now match the flag's exact written words (rawTokens) so a quoted or escaped spelling is never cut.
  • New matrix test (tui-agent-permission-launch-shell.test.ts) covers card vs caller-args agreement across posix/PowerShell/cmd, Windows paths ending in a backslash, escaped flags, and an "ordinary Arguments unchanged" table.

ℹ️ Nitpicks

  • BypassFlagGroup.tokens is now dead: stripBypassFlag matches on rawTokens, and nothing else reads tokens. Drop the field and its tokenized.tokens.slice(...).
  • The resolveAgentPermissionPosture doc comment says a local launch and the Settings card "can't disagree". A WSL workspace on a Windows client is a local launch whose grammar is posix, while the card reads the client's Windows shell, so Windows-quirk Arguments can still read differently. The behaviour fails toward more prompts, so only the comment overstates.
  • The PR description's Windows paragraph still says the launch check "considers POSIX, PowerShell and cmd parsing", but this commit reads only the launching shell.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

}

/** Where an agent launch runs: the platform and shell its startup plan gets. */
export type AgentLaunchTarget = { platform: NodeJS.Platform; shell?: AgentStartupShell | null }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AgentLaunchTarget is already exported from src/shared/agent-launch-intent.ts (the launch-request union existing | create-worktree). Reusing the same name for this unrelated { platform, shell } shape in the same shared/ directory means any future file that needs both must alias one arbitrarily. No current file imports both, so this is a naming hazard rather than a build break — a distinct name (e.g. AgentLaunchShellTarget) would keep them apart.

The load-time lift found word boundaries with POSIX, then PowerShell.
On macOS a flag between escaped quotes inside a double-quoted prompt is
part of the prompt, but PowerShell splits it out, so every restart cut
it from the prompt and turned that agent's Manual into Yolo.

The lift now cuts the flag only where POSIX, PowerShell and cmd all read
it as a whole, unquoted, unescaped word. If any grammar can't parse the
text or reads the flag inside another word, the text stays whole and
the launch shell reads it, so a wrong call keeps prompting.

The Windows path tests no longer certify a cmd launch with a path that
ends in a backslash: cmd quoting doesn't double that backslash, so the
agent never gets the option after it. That is a separate fix.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

This run re-reviewed the single commit pushed after the prior pullfrog review (a279c30): c15ebae "cut the stored bypass flag only where every shell agrees".

  • The load-time lift now requires every launch grammar to agree before cutting a bypass flag. findBypassFlag tokenizes Arguments under POSIX, PowerShell and cmd and cuts only a flag whose exact written words stand as whole, unquoted, unescaped tokens under all three; if any grammar can't parse the text or reads the flag inside another word, the text stays whole and the launch shell reads it. Previously POSIX was tried first and PowerShell second, so a flag that POSIX reads inside a double-quoted prompt but PowerShell splits out was cut on every load, silently turning a Manual agent into Yolo.
  • Replaced the token-index match with exact-word occurrences. findTokenSequence gave way to rawOccurrences, which returns each matching run as a { start, end, words } record; stripBypassFlag slices by the returned offsets instead of re-reading a grammar's spans.
  • Tests updated, one regression added. The migration suite gains a test that keeps a flag one shell reads inside a quoted prompt Manual on every load; the Windows trailing-backslash cases are split into PowerShell and cmd expectations (cmd is no longer certified for a path ending in a backslash, noted as a follow-up); and the resolveAgentPermissionPosture doc comment was corrected to say the card and a launch disagree only for text two shells split differently.

I confirmed the new migration regression test fails without the fix — reverting findBypassFlag to first-found-across-grammars cuts the flag out of the prompt — and passes with it. Ran the three changed test files (tui-agent-launch-defaults, terminal-settings-migrations, tui-agent-permission-launch-shell) — 1813 tests pass. The change is strictly more conservative than before: it can only decline to cut, which keeps the flag inline and fails toward more prompts, never toward fewer. No line-anchored findings.

The prior inline thread on the AgentLaunchTarget name collision in tui-agent-startup-shell.ts remains open (this commit did not rename it), so this review is informational rather than an approval.

Pullfrog  | Fix it ➔ | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

Cutting the stored bypass flag trimmed the gap around it, which could
drop a space escaped by a trailing backslash, backtick or caret and glue
two words together: `--add-dir C:\code\  --dangerously-skip-permissions
--model opus` became `--add-dir C:\code\ --model opus`, which POSIX
reads as one word `C:code --model`.

A cut is now kept only if POSIX, PowerShell and cmd each read the cut
text as exactly the original words minus the flag's. Otherwise the text
stays whole and the launch shell reads it, so a wrong call still means
more prompts, never fewer.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

This run re-reviewed the single commit pushed after the prior pullfrog review (c15ebae): 74f48d3 "refuse a lift that would change any other word".

  • The load-time lift now refuses any cut that changes a word other than the flag's. New cutKeepsOtherWords re-tokenizes the original text and the post-cut text under every LAUNCH_GRAMMARS entry, drops the tokens inside the matched flag range, and requires the remainder to equal the cut text's tokens. If trimming the gap between the neighbours would drop a whitespace character escaped by \, a backtick or ^ (gluing two words into one), stripBypassFlag returns the original arguments and lifts nothing.
  • Regression coverage in tui-agent-permission-launch-shell.test.ts. A new the lift keeps every other word suite covers the escaped-gap cases directly, asserts a plain flag still lifts on every local shell and target, upgrades a typical profile with no overrides, and drives a seeded Arguments generator (over 300 real cuts, non-vacuous) that verifies each grammar removes only whole flag-token groups and leaves every other word intact.

The guard only ever declines a cut, so a wrong call keeps the flag inline and fails toward more prompts, never toward fewer. I traced the early-return args path (it abandons any earlier group cuts, which is the conservative direction) and its interaction with findBypassFlag / rawOccurrences.

The prior inline thread on the AgentLaunchTarget name collision in tui-agent-startup-shell.ts remains open (this commit did not rename it), so this review is informational rather than an approval.

Pullfrog  | Fix it ➔ | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

Conflict: src/shared/global-settings-types.ts imports (kept both the
permission-fields type and main's ZcodePlanSite type).

Adapted main's new Antigravity reference startup
(ai-vault-antigravity-reference-startup.ts) to the typed permission
mode: it now composes with the full settings and the launch's own
platform and shell, like every other launch path, instead of passing the
raw agentDefaultArgs record.

Updated two tests main added for the typed mode: main's Cursor AI Vault
resume test relied on Cursor's shipped Yolo default, so its fixture now
states Yolo; and a paired-host declined-chat launch now expects the
caller's arguments combined with the client's permission mode, as every
other paired-host caller-args launch in this PR does.
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review summary

The problem

On Windows 1.4.215, Settings showed Agent Permissions = Yolo, but a new Claude started from the Chat view ran claude.exe --model opus without --dangerously-skip-permissions, so it asked before every read (#23853). Separately, clicking Manual left the switch on Yolo (#23387). Orca never stored the choice. It guessed it from each agent's free-text Arguments, treated anything unusual as "mixed", and showed "mixed" as Yolo. Clicking the switch skipped every agent with custom Arguments.

What changes for users

  • Orca now stores the choice: one shared default (Yolo or Manual) plus an optional choice per agent. Your Arguments box only holds your own extra arguments, so adding --model opus no longer turns Yolo off.
  • The switch shows what is stored and always moves. Per Brennan's ruling, it changes only the shared default. An agent with its own choice keeps it, and that agent's card has a Default option to make it follow the switch again.
  • "Set separately: …" under the switch names every agent the switch won't move, with how it actually launches. That includes agents that aren't installed on this machine, for example ones that run on an SSH host.
  • If an agent's own Arguments set permissions (for example Codex -a on-request), its card says so and Orca adds no flag beside them.
  • Upgrading keeps every agent launching exactly as before. For the [Bug]: Terminal-backed Chat UI ignores Claude agentDefaultArgs permission mode #23853 setup, Claude stays Manual and is listed under the switch; to get Yolo, set Claude's card to Yolo or Default.
  • Per Brennan's ruling, Source Control AI actions and fix-checks launches that bring their own arguments now follow each agent's card. An agent shown as Yolo gets the flag there too; an agent shown as Manual never does. The Source Control preview uses the same rule.

What review fixed (on top of the original PR)

  • Settings and launches read an agent's Arguments through two separate parsers that disagreed. For example, Devin --permission-mode bypass launched without prompts while Settings showed Manual. There is now one per-agent table and one reader, used by the launch, Settings, structured chat and the upgrade.
  • Several aliases were misread. --allow-dangerously-skip-permissions blocked the flag even though it only allows bypass. Devin's folder-trust option was counted as a permission option.
  • A downgraded host could make a paired web client launch every agent without prompts. Saved settings now keep an explicit empty entry for every agent, so older builds read Manual.
  • An older build's Yolo click could keep bypassing behind a Manual switch after re-upgrading. Every load now moves a plainly written flag back into the setting.
  • A setting saved by a newer Orca was overwritten. It is now kept, and this build reads it as Manual.
  • Brennan's two rulings above (the switch changes only the default; caller-argument launches follow each agent's card), plus listing agents that aren't installed so their choice can be cleared.
  • Arguments are now read with the shell that launches them. A flag is moved out of saved text only when every shell reads it as a plain word and the other words are kept exactly; anything else stays as typed, so an unusual spelling can only cause more prompts.

Deferred, or a known limit

  • Settings reads Arguments with this machine's terminal shell. A launch under a different shell can read unusual quoting or escapes differently: SSH or paired hosts, Windows projects that run in WSL, terminals or restored tabs set to their own shell. Ordinary Arguments read the same everywhere. (Intended difference, in the PR body.)
  • Pre-existing on main: on Windows with cmd, an option typed after a path ending in \ never reaches the agent, because Orca's cmd quoting doesn't double that backslash. A follow-up issue is drafted.
  • Bypass spellings outside the per-agent table (for example Codex -c approval_policy=never), the flag given as another option's value, and Claude's flag combined with another --permission-mode are listed under Known limits in the PR body.
  • Structured chat still reads the setting at each start instead of recording it on the session (STA-3427). Paired-host launches with their own arguments use the client's mode (STA-4798).
  • Small cleanups deferred: the host trusts launch arguments a client sends as already combined; the type system doesn't distinguish saved settings from launch-ready settings; a settings write that repeats an option keeps only one.

What was verified

  • Review: an architecture comparison (keep the design, don't split), then eight rounds of independent review and fixes across the upgrade, every launch path, the paired-host settings wire, Settings and Windows shell parsing. The final readiness checklist found no P0 or P1.
  • Tests: every fix was checked by removing it and confirming its new tests fail. After merging current main (one import conflict; main's new AI Vault reference launch now goes through the same launch code), 342 related test files pass (7,229 tests) plus the mobile launch tests. Five tests timed out on a heavily loaded machine and passed when re-run alone. tsc for node, web and cli is clean.
  • Live QA on a separate Mac, in a hidden Orca build with its own home folders and stub agents that record their arguments, driven by a non-Claude agent over three builds:
    • the reporter's upgraded profile, a fresh install, and a profile with bypass aliases all showed the right state;
    • Claude from the Chat view and a terminal tab launched --model opus after the upgrade, and --dangerously-skip-permissions --model opus (flag once) after Claude's card was set to Yolo;
    • the switch kept per-agent choices, the card's Default followed the switch, a restart changed nothing, and an agent that isn't installed was listed and clearable;
      Screenshots are in the PR body.

Not verified

  • The Source Control / fix-checks agent dialog and its command preview were not exercised live (the test repo offered no such action). Unit tests only.
  • Windows (PowerShell and cmd) was covered by unit tests only, not run on Windows. Codex was checked through Settings only, never launched.
  • The downgrade fix was checked against main's code, not by running an older build.
  • Mobile vault resume, SSH, the onboarding answer and the Playwright end-to-end tests were not run live; unit tests only.
  • Live QA ran on a279c30. The later commits only change when a flag is moved out of saved Arguments for unusual quoting, plus the merge of main; they were covered by unit tests and typechecks, not re-run live.
  • The reporter's actual Arguments are still unconfirmed (asked on [Bug]: Terminal-backed Chat UI ignores Claude agentDefaultArgs permission mode #23853).

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

This run re-reviewed the merge of origin/main into the branch pushed after the prior pullfrog review (74f48d3) — commit 9004978.

  • Merged origin/main. The base-branch changes (zcode plan-site settings and others) land without touching the PR's permission modules — the classified core files are byte-identical to the last reviewed version.
  • Adapted the AI Vault launch path to the typed settings API. buildAntigravityReferenceStartup now takes AgentLaunchProfileSettings plus the command-override slice and resolves its Arguments/env through resolveTuiAgentLaunchArgs('antigravity', settings, { platform, shell }) / resolveTuiAgentLaunchEnv('antigravity', settings), and buildAiVaultResumeForWorktree's resumable-agent branch passes args.state.settings instead of the raw agentDefaultArgs/agentDefaultEnv records.
  • Updated the touched test fixtures. LaunchFunnelSettings gains agentPermissionMode/agentPermissionModeOverrides; the AI Vault makeState stores agentPermissionMode: 'ask'; the Cursor resume test opts into 'bypass'; and the caller-routing web-host expectation now includes the mode's bypass flag beside the caller's own arguments (--dangerously-skip-permissions --model sonnet), matching resolveTuiAgentLaunchArgs's caller-args path.

Verified pnpm tc:web clean and the five touched renderer test files (92 tests) pass.

The prior inline thread on the AgentLaunchTarget name collision in tui-agent-startup-shell.ts remains open (this merge did not rename it), so this review is informational rather than an approval.

Pullfrog  | Fix it ➔ | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

"Set separately: Claude (Manual), Codex (Manual)." read like an
instruction to set those agents manually, and said neither why nor
where to change it.

The line under Agent Permissions now reads "These agents don't follow
this switch:" with one entry per agent: "Claude runs Manual: it has its
own setting.", "Codex runs Manual: its Arguments set -a on-request.",
"Goose runs Manual: its environment sets GOOSE_MODE=approve." Each name
is a link button that opens the agent's row and focuses the control to
change: its Permissions choice, or its Arguments or Environment field
when those decide. It works for agents listed under "Available to
install" too.

That line is now the one place stating each exception: the row's
warning box is gone, and the switch's rule moves from a tooltip into
its description. Adds an `inline` Button size for link buttons inside
a sentence.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No new issues — the delta is correct and well tested; one stale PR-description paragraph below.

Reviewed changes

This run re-reviewed the single commit pushed after the prior pullfrog review (9004978): 195e22d "say why each agent doesn't follow the permissions switch".

  • The exception line now names each agent and why it won't follow the switch. New buildAgentPermissionExceptions (in settings/agent-permission-exceptions.ts) returns, per agent, an effectiveBypass and a reason — arguments / environment (with the typed options, arguments first) or own-setting — plus a target control. AgentPermissionsSetting renders each as an inline link button; AgentsPane holds a {agentId, target, nonce} reveal, and AgentCatalogRow opens the row and focuses the matching control (data-agent-reveal + a per-target selector).
  • The per-card warning box is gone and the rule left the tooltip. AgentPermissionOverrideControl no longer takes a posture/notice, and the Info tooltip under Agent Permissions is replaced by a sentence in the section description, so the switch line is the one place stating each exception.
  • Posture splits Arguments from environment. TypedAgentPermissions and AgentPermissionPosture now carry argumentOptions / environmentOptions instead of a combined options, so a reason can say which source decides.
  • New documented inline Button size. button.tsx gains inline: 'h-auto p-0 align-baseline text-[length:inherit]' and docs/STYLEGUIDE.md lists it for link buttons inside a sentence.
  • Strings shipped in all six locales, and the tui-agent-launch-defaults / tui-agent-permission-launch-shell expectations are re-pinned to the split fields.

I ran the five touched test files (1,899 tests) — all pass — plus pnpm tc:web, and the changed-code quality gate reports 0 findings since 9004978. The new AgentsPane.permission-exceptions.test.tsx covers the three reason texts, the reveal focus for Permissions / Arguments / Environment, keyboard activation, and the uninstalled-agent case.

ℹ️ Nitpicks

  • The PR description still says "If an agent's Arguments or environment set permissions themselves, the row says so in a warning that names them" — this commit removed that per-row warning and moved the reason to the line under the switch.

Pullfrog  | Fix it ➔ | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

An agent that isn't installed here but whose Arguments decide its mode
was listed as "its Arguments set ...", yet its link landed on the
Permissions choice because that row had no Arguments field. The row
under "Available to install" now shows the same Arguments or
Environment field the installed row uses when it decides, and the link
focuses it.

While agent detection is pending or has failed no rows render, so the
names in the line were links that did nothing (and a click while
pending was dropped). They now show as plain text until detection
finishes, then become links.
Clicking an agent's name in the Agent Permissions line with the mouse
focused its Permissions radio, but the radio's ring only draws on
:focus-visible, which a focus after a mouse click doesn't trigger, so
the user couldn't see where they landed. The reveal now focuses with
`focusVisible: true` (supported by the Chromium in Electron 43), using
the existing ring. A normal mouse click on the radio looks the same.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

This run re-reviewed the single commit pushed after the prior pullfrog review (195e22d): c05100f "keep permission line links honest for undetected agents".

  • An undetected agent's link now lands on the field that decides. For a not-installed agent whose Arguments or env set its mode, the Available to install row now renders the same Arguments or Environment field it names (new decidedBy on the row's permission prop), so the "runs Manual: its Arguments set …" link focuses that field instead of the Permissions choice.
  • Names are plain text until a row exists to open. buildAgentPermissionExceptions returns target: null while detection is pending or has failed (no rows render then), and AgentPermissionsSetting renders the label as text rather than a dead link; once detection finishes the names become working links.
  • Coverage updated for the undetected-agent Arguments focus, the pending/failed plain-text states, and the pending → finished transition.

I traced the target/decidedBy consistency (both derive from the same posture, and undetected exceptions always carry an override, so the rendered field always exists), the render-time open-then-focus sequence, and the detection-pending path. Ran the three settings suites (AgentsPane.permission-exceptions, AgentsPane.permission-switch, AgentsPane) — 58 tests pass.

The prior inline thread on the AgentLaunchTarget name collision in src/shared/tui-agent-startup-shell.ts remains open (this commit did not rename it), so this review is informational rather than an approval.

Pullfrog  | Fix it ➔ | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

…2025/sta-8902-typed-permission-mode

# Conflicts:
#	src/main/claude/claude-structured-launch-resolution.test.ts
#	src/main/codex/codex-structured-launch-resolution.test.ts
#	src/main/runtime/orca-runtime-get-structured-agent-session-create-support.ts
#	src/main/runtime/orca-runtime-get-worktree-ps.ts
#	src/renderer/src/i18n/locales/es.json
#	src/renderer/src/i18n/locales/zh.json
#	src/renderer/src/lib/ai-vault-resume-command.ts
#	src/shared/global-settings-types.ts
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Closing: #30677 has since redesigned the same Agent Permissions switch (Manual | Auto | Yolo, per-agent badges, "Replace with {mode}" for agents with their own arguments), and this branch now conflicts with that design and only knows Yolo and Manual. Storing the choice as a typed setting instead of reading it from Arguments would need a fresh, smaller plan on top of #30677. The original report (#23853) was closed while awaiting the reporter's details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant