You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(agent-launch): keep Full-access permissions across session restore and paired-client launches - #37144
You tell Orca "agents get Full access". Orca should then start every agent with its skip-permissions flag. In two cases it forgot: when it brought a session back after a restart or sleep, and when you opened an agent from a paired desktop client connected to a remote host. The agent started in its strictest mode and stopped to ask for approval. Now Orca remembers the Full-access launch and the host applies its own setting.
What Changed
Before: a restored or woken agent could start as the bare command with no permission flag. A fresh agent started from a paired client could do the same, because the client sent an empty argument list that the host treated as "don't add any flags".
After: both paths keep the Full-access flag.
Mechanism:
Session restore (8a25ea097f3 rebased as 3b4d9fbec61).
Main now stores the admitted renderer launch recipe on its PTY record, so sleep, hook and quit captures see it.
Renderer captures read the token-keyed registry once a hook proved the launch token.
A restore with no recorded recipe stays unrecorded instead of recording a flagless one.
The recipe is recorded for a typed agent command that already sets a permission mode.
Paired client fresh launch (2a01d4c628d rebased as 24be7817383). The web runtime create path no longer sends the client-resolved launchConfig.agentArgs as an override on fresh launches. The host re-resolves from its own stored permission default and per-agent overrides. Only resume replays the recorded recipe (web-runtime-agent-args-override.ts).
Why
Reported in #33379 (regression since 1.4.239): every agent started with no permission flag despite Full access, which blocks unattended and orchestrated sessions on prompts.
The client stops sending an explicit empty override on fresh launches rather than teaching the host to ignore empty agentArgs, because an explicit list is still meaningful when resuming.
Related, not claimed as fixed: #34690 (account-switch restart loses --dangerously-skip-permissions), #31172 (chat view shows Full access but session still prompts), #34270 (first Claude chat in a new worktree ignores the permission default). Historical context: #29672, #10886, #32245 (closed).
Visual Proof
N/A. This changes launch arguments and persisted launch recipes only, with no UI change. Coverage is in the unit tests listed below.
Testing
Ran on the rebased branch (latest stablyai/orca main at 5ea047e34e3), on macOS:
Not run locally: the full suite, pnpm build, and the two Playwright specs touched (pty-connection-remote-runtime-attach.spec.ts, pty-connection-sleeping-resume-banner.spec.ts). CI covers them.
Vitest was run directly because pnpm test stops on the pinned Bun check.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Authored with Claude (Sonnet 5.5) via Claude Code, reviewed against issue #33379.
Review
Self-reviewed against every concern in #33379. The first commit covers session restore, the second the paired-client host gap.
Agent skill upstream boundary
Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.
Notes
Security: no new trust surface. The host still resolves permission flags from its own settings.
Cross-platform: no platform-specific code touched.
Remote SSH / paired host: the second commit fixes the paired-client case. A newer client sending no override works against an older host, which already re-resolves when the override is absent.
Mobile: no change. Mobile already goes through the host launch path.
Folder workspaces: no git assumptions added.
Backwards compatibility: persisted launch recipes are unchanged in shape.
Performance: none.
Checklist
This PR is small and focused
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)
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.
The changes update agent launch-recipe creation, persistence, and lookup, including handling for resumes without a recorded recipe. They add shared overlay-focus ownership and composer-focus coordination. Chat settings gain default-surface and per-agent launch controls, and the orchestration panel is suspended. Journal cleanup no longer performs outcome compaction or incremental vacuuming. Codex permission-mode selection and related tests also change.
Fixed issue severity: High
Merge Risk: Moderate · previous review fe231
Resumed agent sessions can lose part of the recorded launch arguments when an option is repeated, such as multiple --add-dir entries. Earlier open concerns remain about Codex permission flags on resume, the composer's Full-access display, an E2E test that may time out, and journal disk reclamation. These should be resolved or explicitly accepted before merging.
Pre-merge checks: 1 · 3 · 1
Failed checks: 3 warnings · 1 inconclusive
Check name
Status
Explanation
Resolution
Description check
The description follows the template closely. It has the ELI5, What Changed, Why, Linked Issue (Fixes #33379), Visual Proof (N/A with reason), Testing, Risk, AI Disclosure, Review, Agent skill boundar…
Add a Risk section. Name the riskiest part of the change, such as the persisted launch recipe and the host re-resolution for fresh paired-client launches. Say what users would see if it failed, and state the revert path. Set the Level field…
Out of Scope Changes check
The whole-PR diff from merge base 7518c94 to head fe231e1 contains changes that do not implement the launch-argument or launch-recipe objectives. The PR description states that the change covers 'laun…
1. Rebase the branch onto current main so that the merge base matches the stated base. 2. Remove the unrelated files and commits listed above. This includes the journal compaction and vacuum deletions, overlay focus and composer focus work,…
Docstring Coverage
Docstring coverage is 20.75% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Linked Issues check
Two directly linked issues are open, so both apply: #33379 and #34690.
[#33379] Agents must launch with the permission flag for the configured Full-access mode. Evidence at head fe231e1: - Session re…
To decide #34690, the following evidence is needed: 1. The account-switch restart code path at head, and the input it uses for the restart command (recorded launch config, resume plan, or Settings arguments). 2. Confirmation that a Claude p…
Passed checks: 1 passed
Check name
Status
Explanation
Title check
The title names the two cases the PR fixes: Full-access permissions across session restore and paired-client launches. The changeset matches this. It adds launch-recipe recording and restore handling,…
Full details: Title check
Explanation
The title names the two cases the PR fixes: Full-access permissions across session restore and paired-client launches. The changeset matches this. It adds launch-recipe recording and restore handling, and it stops the web runtime from sending an empty agentArgs override on fresh launches. The title uses the fix(agent-launch) prefix and is 97 characters, a little long but still clear.
Full details: Description check
Explanation
The description follows the template closely. It has the ELI5, What Changed, Why, Linked Issue (Fixes #33379), Visual Proof (N/A with reason), Testing, Risk, AI Disclosure, Review, Agent skill boundary, and Notes sections. The Risk section is missing. The description does not state a risk level, what could break for users, or how to back out the change. Several checklist items are unchecked, including the lint, typecheck, test, and build item. The Visual Proof N/A reason is given.
Resolution
Add a Risk section. Name the riskiest part of the change, such as the persisted launch recipe and the host re-resolution for fresh paired-client launches. Say what users would see if it failed, and state the revert path. Set the Level field to Low, Medium, or High. Also state whether the older paired phones and SSH hosts behave correctly, because the Notes mention this but the Risk section does not. Finally, either check the lint, typecheck, test, and build box or explain why CI covers it.
Full details: Out of Scope Changes check
Explanation
The whole-PR diff from merge base 7518c94 to head fe231e1 contains changes that do not implement the launch-argument or launch-recipe objectives. The PR description states that the change covers 'launch arguments and persisted launch recipes only, with no UI change', and that the branch is rebased onto 5ea047e. The merge base does not match that statement.
Unrelated changes in the diff:
Deleted journal compaction and vacuum modules and tests: journal-compaction-scaling.test.ts, journal-incremental-vacuum.ts, journal-outcome-compaction.ts, journal-outcome-compaction.test.ts. The outcome sweeper no longer compacts or vacuums.
Overlay focus and composer focus-intent work: native-chat-composer-focus-intent.ts, overlay-focus-ownership.ts, use-overlay-focus-scope.ts, visible-overlay.ts, and many ui/* overlay components (dialog, sheet, popover, select, command, context-menu, dropdown-menu).
Chat settings UI and launch-search fixtures: ChatAgentLaunchSettings.tsx, chat-launch-search.ts, ChatSettingsSection.tsx and tests, AgentDefaultSurfaceSection.tsx.
Permission-option display changes: structured-agent-session-permission-option.ts and its test.
package.json version change from 1.4.214 to 1.4.247.
i18n key changes in en.json, ja.json and en-runtime-required.json.
The launch-related files are in scope: agent-session-resume.ts, sleeping-agent-launch-config.ts, tui-agent-resume-startup.ts, tui-agent-launch-defaults.ts, web-runtime-agent-args-override.ts, runtime-agent-terminal-startup.ts, runtime-agent-launch-resolution.ts, pty-registration.ts, and the agent-status launch-config files. Their tests are also in scope.
Resolution
Rebase the branch onto current main so that the merge base matches the stated base.
Remove the unrelated files and commits listed above. This includes the journal compaction and vacuum deletions, overlay focus and composer focus work, Chat settings UI, orchestration-panel removal, i18n changes, and the package.json version change.
Confirm that the whole-PR diff from the new merge base contains only the launch-recipe, resume-startup, paired-client launch, and related test changes.
Full details: Docstring Coverage
Explanation
Docstring coverage is 20.75% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 53 functions across 75 files.
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Full details: Linked Issues check
Explanation
Two directly linked issues are open, so both apply: #33379 and #34690.
[#33379] Agents must launch with the permission flag for the configured Full-access mode. Evidence at head fe231e1:
Session restore: the admitted renderer launch recipe is stored on the PTY record (launch-authority.ts, pty-registration.ts). The renderer reads the recipe only after a hook proves the launch token (agent-status-launch-config.ts, launchTokenProven). Restores with no recorded recipe stay unrecorded (tui-agent-resume-startup.ts, tui-agent-launch-defaults.ts).
Paired-client fresh launch: webRuntimeAgentArgsOverride returns undefined on fresh launches, so the host resolves its own permission default (web-runtime-agent-args-override.ts, web-runtime-terminal-create-operation.ts).
Tests cover these paths (web-runtime-agent-args-override.test.ts, tui-agent-resume-startup.test.ts, launch-authority.test.ts, agent-status-launch-config.test.ts). I did not re-run them. The root-host fallback in the issue is a secondary note and does not block this objective.
On current evidence, the #33379 objective appears met.
[#34690] A restarted Claude session must keep recorded permission arguments after an account switch. Evidence at head:
Recorded recipes now persist across repeated restores (tui-agent-resume-startup.test.ts). Recipes for typed permission commands are recorded (recipeForTypedAgentPermissionLaunch). Panes launched after this change may therefore carry a recipe that a restart can read.
The fallback for a pane with no recorded recipe is unchanged. resolveResumeLaunchRecipe still returns a bare, unrecorded recipe, and a test asserts that no permission flag is added. This is the failure mode the issue reports for Claude.
I did not confirm that the account-switch restart path reads the recorded recipe through the changed code. My repository inspections did not locate that path, so the connection is unverified.
The PR description says #34690 is 'related, not claimed as fixed'. This conflicts with the direct link.
The #34690 outcome cannot be decided from the evidence available.
Overall result: #33379 appears met. #34690 is undetermined.
Resolution
To decide #34690, the following evidence is needed:
The account-switch restart code path at head, and the input it uses for the restart command (recorded launch config, resume plan, or Settings arguments).
Confirmation that a Claude pane launched with Full access after this change restarts with --dangerously-skip-permissions. A test on the account-switch restart path that asserts this flag would provide that confirmation.
A statement of intended behavior for panes launched before this change, which have no recorded recipe. The PR must either address them or state that they remain out of scope. The author should also align the PR description with the direct link to #34690.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Tip
🎯 Customize your risk assessments
Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.
✅ Automatic approvals, with your rules
Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.
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.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
⚠️ Outside diff range comments (1)
Major · Resolve permission arguments on the host for… · web-runtime-terminal-create-operation.ts:98-99
src/renderer/src/runtime/web-runtime-terminal-create-operation.ts:98-99 Major · Functional Correctness · Heavy lift
Resolve permission arguments on the host for prepared-command launches.
Fresh paired launches that carry a permission choice set preparedAgentCommand. That routes them to the legacy session.tabs.createTerminal branch. The branch sends the client-built command, env, and launchConfig to the host. The host uses those values as supplied. It does not resolve the permission arguments from its own settings.
This conflicts with the PR's stated intent that fresh paired-client launches take their arguments from host settings. On this path, a Full-access launch depends on the client-built values. The reported omission can recur if those values do not include the Full-access setting.
The same branch also runs when afterTabId is set. The launch producer in launch-agent-web-host-tab.ts does not set afterTabId, so that case is not shown from this producer.
A host-side rebuild of the prepared command is not a safe fix on its own. The existing comment notes that it can discard prompt and delivery flags. Decide one of two things. Either route permission-bearing prepared launches through host-authoritative creation while keeping prompt and delivery flags. Or document that the client-built values are the intended authority for this path.
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: a70975cf-9250-4535-bd17-7d9d5256b7fe
Commits
Reviewing files that changed from the base of the PR and between aa93f60 and 24be781.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
set -o pipefail
printf'%s\n''--- resume startup implementation ---'
sed -n '876,980p' src/shared/tui-agent-resume-startup.ts
printf'%s\n''--- resume startup tests ---'
sed -n '1,180p' src/shared/tui-agent-resume-startup.test.ts
printf'%s\n''--- related permission tests ---'
sed -n '1,90p' src/shared/tui-agent-permission-choice.test.ts
sed -n '400,470p' src/shared/tui-agent-permission-choice.test.ts
printf'%s\n''--- command assembly ---'
sed -n '1,180p' src/shared/agent-resume-launch-command.ts
Repository: stablyai/orca
Length of output: 13403
Remove permission flags from command-only Codex recipes before non-fork resume.
A typed command such as codex --yolo is stored entirely in agentCommand. The non-fork resume path only strips permission data from agentArgs, so it can replay --yolo and undo a permission change made inside Codex. Preserve the existing fork behavior and add a regression test for a command-only Codex recipe.
* Disable the orchestration panel after reported app lag
* test: expect suspended orchestration card to stay hidden
(cherry picked from commit 7872cb5)
* Preserve open overlays when focusing the chat composer
* Fix chat composer focus after launch menus close
* Fix chat composer focus handoff after overlays close
* Fix composer focus after custom overlays close
* Prevent chat composer from stealing overlay focus
Scope recovery overlays to their own pane and let menus dismiss before
returning focus to the composer. This keeps the quick launcher open
when delayed chat actions complete.
* Fix composer focus across nested overlays
Track focus ownership through portaled overlays so the launch prompt can
regain focus while its model list is open. Close the context menu before
inserting a quote so the caret lands after it.
* Fix overlay focus CI regressions
* Complete overlay focus ownership for inline and retained surfaces
* Declare public overlay focus hook return type
(cherry picked from commit b96d19d)
Cherry-picked feature diff from PR stablyai#37607 at 991938b against its main base 7a03807, including all final UI updates and excluding unrelated main history.
Store the admitted renderer launch recipe on main's PTY record so sleep,
hook and quit captures see it; let renderer captures read the token-keyed
registry once a hook proved the launch token; keep a restore with no recorded
recipe unrecorded instead of recording a flagless one; and record the recipe
for a typed agent command that already sets a permission mode.
Fixesstablyai#33379
…host to empty args
The web runtime create path sent the client-resolved launchConfig.agentArgs as an
explicit override, so the host skipped its stored Full-access permission and
started a bare agent. Only resume replays the recorded recipe now.
Fixesstablyai#33379
The reason will be displayed to describe this comment to others. Learn more.
Major · Stability & Availability · Quick win
Return freed journal pages to the filesystem.
New journal databases use auto_vacuum = INCREMENTAL. After a large chat is deleted, this sweep removes its rows but no longer runs incremental vacuum, so SQLite retains the freed pages in the database file. Users cannot recover that disk space by deleting chats. Restore bounded vacuuming or an equivalent reclamation path. (raw.githubusercontent.com)
Major · Stability & Availability · Heavy lift
Supported by static analysis
Script executed:
ls src/main/native-chat/agent-session-journal/
rg -n 'outcome' src/main/native-chat/agent-session-journal/journal-outcome-table.ts | head -60
rg -n 'compact|Compaction' src/main --glob '!*.test.*'| head -30
Restore bounded cleanup of superseded outcome revisions in live generations.
persistJournalOutcomeRows only inserts. Each revision of a key adds a new journal_outcomes row. No write removes or replaces an earlier row for that key (journal-outcome-table.ts:48-49, :64-66, :106-115). sweepJournalOutcomePage deletes only generations that no current epoch names (journal-outcome-cleanup.ts:14-32). Superseded revisions in a live generation therefore accumulate until that epoch retires. A long-running chat can grow its stored outcome rows without a cap, even when its visible history is small.
Reads stay correct, because JOURNAL_NEWEST_OUTCOME_SQL reads only the newest record per key (journal-outcome-table.ts:19-24).
Restore bounded compaction of superseded records in live generations, or an equivalent cleanup. Keep the newest record for each key, including deletion records, so reads return the same state.
The reason will be displayed to describe this comment to others. Learn more.
Major · Security & Privacy · Heavy lift
Supported by static analysis
Script executed:
sed -n 1,140p src/shared/agent-session/options/structured-agent-session-permission-option.ts
rg -n 'next turn|selectedForNextTurn|valueSource' src --glob '!*.test.*'| head -50
Repository: stablyai/orca
Length of output: 44460
Script executed:
rg -n -F -e 'applied' -e 'reportedPermissionMode' -e 'next turn' -e 'Full access' -e 'full-access' -- src/renderer/src/components/native-chat src/shared/agent-session ||test"$?" -eq 1
echo'--- NativeChatSessionOptionPickers.tsx 150-230 ---'
sed -n 150,230p src/renderer/src/components/native-chat/NativeChatSessionOptionPickers.tsx
echo'--- permission-mode test (head) ---'test -f src/renderer/src/components/native-chat/use-structured-agent-session-options.permission-mode.test.tsx && sed -n 1,160p src/renderer/src/components/native-chat/use-structured-agent-session-options.permission-mode.test.tsx ||echo'test file not present in checkout'
Repository: stablyai/orca
Length of output: 38868
Show the running Full-access state when a Codex pick is pending.
For Codex, the descriptor sets currentValue to the selected mode. When the reported mode differs, valueSource becomes applied, and the reported mode is removed from the descriptor. The composer derives its label and Full-access warning from currentValue. After a user selects ask during a Full-access Codex turn, the composer shows "Ask for approval" with no warning and no next-turn marker. The active turn can still run with Full access.
Show the reported mode next to the selected mode, or label the selection as applying to the next turn.
Use a terminal-backed chat for the Copy Context scenario.
openChat creates a host-backed structured chat. Structured chats do not receive contextMenuActions, so their context menu does not render Copy Context. The click at line 72 can therefore time out.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
You tell Orca "agents get Full access". Orca should then start every agent with its skip-permissions flag. In two cases it forgot: when it brought a session back after a restart or sleep, and when you opened an agent from a paired desktop client connected to a remote host. The agent started in its strictest mode and stopped to ask for approval. Now Orca remembers the Full-access launch and the host applies its own setting.
What Changed
Before: a restored or woken agent could start as the bare command with no permission flag. A fresh agent started from a paired client could do the same, because the client sent an empty argument list that the host treated as "don't add any flags".
After: both paths keep the Full-access flag.
Mechanism:
8a25ea097f3rebased as3b4d9fbec61).2a01d4c628drebased as24be7817383). The web runtime create path no longer sends the client-resolvedlaunchConfig.agentArgsas an override on fresh launches. The host re-resolves from its own stored permission default and per-agent overrides. Only resume replays the recorded recipe (web-runtime-agent-args-override.ts).Why
Reported in #33379 (regression since 1.4.239): every agent started with no permission flag despite Full access, which blocks unattended and orchestrated sessions on prompts.
The client stops sending an explicit empty override on fresh launches rather than teaching the host to ignore empty
agentArgs, because an explicit list is still meaningful when resuming.Linked Issue
Fixes #33379
Related, not claimed as fixed: #34690 (account-switch restart loses
--dangerously-skip-permissions), #31172 (chat view shows Full access but session still prompts), #34270 (first Claude chat in a new worktree ignores the permission default). Historical context: #29672, #10886, #32245 (closed).Visual Proof
N/A. This changes launch arguments and persisted launch recipes only, with no UI change. Coverage is in the unit tests listed below.
Testing
Ran on the rebased branch (latest
stablyai/orcamain at5ea047e34e3), on macOS:oxlinton changed files: cleanoxfmt --checkon changed files: cleanpnpm tc:nodeandpnpm tc:web: passVitest (
ORCA_LOCAL_MODULE_CACHE=0), 6 files, 41 tests: passlaunch-authority.test.tspty-spawn-runtime-handle-binding.test.tsruntime-agent-terminal-startup.test.tsweb-runtime-agent-args-override.test.tsagent-status-launch-config.test.tstui-agent-resume-startup.test.tsNot run locally: the full suite,
pnpm build, and the two Playwright specs touched (pty-connection-remote-runtime-attach.spec.ts,pty-connection-sleeping-resume-banner.spec.ts). CI covers them.Vitest was run directly because
pnpm teststops on the pinned Bun check.I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Authored with Claude (Sonnet 5.5) via Claude Code, reviewed against issue #33379.
Review
Self-reviewed against every concern in #33379. The first commit covers session restore, the second the paired-client host gap.
Agent skill upstream boundary
Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)