Skip to content

fix(agent-launch): keep Full-access permissions across session restore and paired-client launches - #37144

Closed
Nenzyz wants to merge 11 commits into
stablyai:mainfrom
Nenzyz:Nenzyz/session-restore-full-access
Closed

Nenzyz wants to merge 11 commits into
stablyai:mainfrom
Nenzyz:Nenzyz/session-restore-full-access

Conversation

@Nenzyz

@Nenzyz Nenzyz commented Nov 1, 2026 •

Copy link
Copy Markdown

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:

  • 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.

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/orca main at 5ea047e34e3), on macOS:

  • oxlint on changed files: clean

  • oxfmt --check on changed files: clean

  • pnpm tc:node and pnpm tc:web: pass

  • Vitest (ORCA_LOCAL_MODULE_CACHE=0), 6 files, 41 tests: pass

    • launch-authority.test.ts
    • pty-spawn-runtime-handle-binding.test.ts
    • runtime-agent-terminal-startup.test.ts
    • web-runtime-agent-args-override.test.ts
    • agent-status-launch-config.test.ts
    • tui-agent-resume-startup.test.ts
  • 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)

@coderabbitai

coderabbitai Bot commented Nov 1, 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
Walkthrough

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: Passed 1 · Failed 3 · Inconclusive 1

Failed Failed checks: 3 warnings · 1 inconclusive

Check name Status Explanation Resolution
Description check Warning 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 Warning 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 Warning 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 Inconclusive 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 Passed checks: 1 passed
Check name Status Explanation
Title check Passed 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.
  • Orchestration panel removal: OrchestrationPanelExperimentalSetting.tsx, orchestration-panel-experimental-search.ts, ExperimentalPane.tsx, use-orchestration-panel-enabled.ts.
  • 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

  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, Chat settings UI, orchestration-panel removal, i18n changes, and the package.json version change.
  3. 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:

  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 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.
  3. 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.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
Recent 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: 1555ec68-e77b-47c5-9937-24c5202c8005
Commits

Reviewing files that changed from the base of the PR and between 9b972ec and fe231e1.

Files selected for processing: 5
  • src/renderer/src/store/slices/agent-status/agent-status-launch-config.test.ts
  • src/renderer/src/store/slices/agent-status/agent-status-live-entry-builder.ts
  • src/renderer/src/store/slices/agent-status/agent-status-live-reducer.ts
  • src/shared/tui-agent-resume-startup.test.ts
  • src/shared/tui-agent-resume-startup.ts

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

@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.

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.

Files selected for processing: 25
  • src/main/ipc/pty/pane/launch-authority.test.ts
  • src/main/ipc/pty/pane/launch-authority.ts
  • src/main/ipc/pty/pty-spawn-runtime-handle-binding.test.ts
  • src/main/runtime/runtime-agent-launch-resolution.ts
  • src/main/runtime/runtime-agent-terminal-startup.test.ts
  • src/main/runtime/runtime-agent-terminal-startup.ts
  • src/main/runtime/terminal/lifecycle/pty-registration.ts
  • src/renderer/src/components/terminal-pane/pty-connection-remote-runtime-attach.spec.ts
  • src/renderer/src/components/terminal-pane/pty-connection-sleeping-resume-banner.spec.ts
  • src/renderer/src/runtime/web-runtime-agent-args-override.test.ts
  • src/renderer/src/runtime/web-runtime-agent-args-override.ts
  • src/renderer/src/runtime/web-runtime-terminal-create-operation.ts
  • src/renderer/src/store/slices/agent-status/agent-status-contract.ts
  • src/renderer/src/store/slices/agent-status/agent-status-launch-actions.ts
  • src/renderer/src/store/slices/agent-status/agent-status-launch-config.test.ts
  • src/renderer/src/store/slices/agent-status/agent-status-launch-config.ts
  • src/renderer/src/store/slices/agent-status/agent-status-live-entry-builder.ts
  • src/renderer/src/store/slices/agent-status/agent-status-live-reducer.ts
  • src/renderer/src/store/slices/agent-status/agent-status-provider-session-actions.ts
  • src/shared/agent-resume-record-from-status.ts
  • src/shared/agent-session/lifecycle/agent-session-resume.ts
  • src/shared/sleeping-agent-launch-config.ts
  • src/shared/tui-agent-launch-defaults.ts
  • src/shared/tui-agent-resume-startup.test.ts
  • src/shared/tui-agent-resume-startup.ts

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

if (!trimmed || !agent || !agentArgsSetPermission(agent, trimmed)) {
return null
}
return { agent, launchConfig: { agentCommand: trimmed, agentArgs: '', agentEnv: {} } }

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.

Minor · Security & Privacy · Quick win

Supported by static analysis

Script executed:

sed -n '100,140p' src/main/runtime/runtime-agent-launch-resolution.ts
rg -n 'agentArgsSetPermission' src
sed -n '1,200p' src/shared/tui-agent-permission-lift.ts

Repository: stablyai/orca

Length of output: 10610


Script executed:

set -o pipefail
printf '%s\n' '--- permission parser ---'
sed -n '1,330p' src/shared/agent-permission-args.ts
printf '%s\n' '--- resume/helper references ---'
rg -n -F --glob '*.ts' -e 'dropRecordedAgentPermissionArgs' -e 'liftAgentPermissionArgs' -e 'tui-agent-permission-lift' -e 'resume' src/main/runtime src/main src/shared | head -240
printf '%s\n' '--- likely resume startup and launch-defaults files ---'
rg --files src | rg 'resume|launch-default|agent.*startup|startup.*agent' | head -160
printf '%s\n' '--- relevant tests and intent text ---'
rg -n -F --glob '*.{test,spec}.ts' -e 'dropRecordedAgentPermissionArgs' -e 'recipeForTypedAgentPermissionLaunch' -e 'Codex' -e 'permission' src/main src/shared | head -260

Repository: stablyai/orca

Length of output: 41334


Script executed:

set -o pipefail
printf '%s\n' '--- all helper references ---'
git grep -n -E 'dropRecordedAgentPermissionArgs|liftAgentPermissionArgs|tui-agent-permission-lift' -- ':!node_modules' ':!dist' || true
printf '%s\n' '--- permission/launch-default references ---'
git grep -n -E 'agentArgsSetPermission|launchDefaults|launch-default|permission.*lift|lift.*permission|recorded.*permission|permission.*recorded' -- 'src/**/*.ts' 'src/**/*.tsx' || true
printf '%s\n' '--- changed files ---'
git diff --name-only 5ea047e34e337ed742d55256aaedf55fca9fecb9 24be7817383e0124e0f71d5219ea74f304c674bd
printf '%s\n' '--- resume-related changed hunks ---'
git diff --unified=35 5ea047e34e337ed742d55256aaedf55fca9fecb9 24be7817383e0124e0f71d5219ea74f304c674bd -- src/shared/tui-agent-permission-lift.ts src/main/runtime/runtime-agent-launch-resolution.ts src/main/runtime src/shared | rg -n -C 8 'dropRecordedAgentPermissionArgs|tui-agent-permission-lift|agentCommand|agentArgs|permission|resume|launchDefaults' | head -500

Repository: stablyai/orca

Length of output: 43720


Script executed:

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.

@Nenzyz
Nenzyz force-pushed the Nenzyz/session-restore-full-access branch 2 times, most recently from 704b79f to 17d788a Compare November 2, 2026 05:43
brennanb2025 and others added 9 commits November 2, 2026 14:52
…lyai#37419)

Co-authored-by: Brennan Benson <79079362+brennanb2025@users.noreply.github.com>
(cherry picked from commit 96cceba)
* 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.

Fixes stablyai#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.

Fixes stablyai#33379
@Nenzyz
Nenzyz force-pushed the Nenzyz/session-restore-full-access branch from 17d788a to 9b972ec Compare November 3, 2026 09:05
Comment on lines +116 to +117
if (!database || !this.pace.work(() => sweepJournalOutcomePage(database))) {
return

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.

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

Repository: stablyai/orca

Length of output: 18051


Script executed:

cd src/main/native-chat/agent-session-journal || exit 1
echo '=== journal-outcome-table.ts ==='
cat -n journal-outcome-table.ts
echo '=== journal-outcome-write.ts ==='
cat -n journal-outcome-write.ts
echo '=== journal-outcome-cleanup.ts ==='
cat -n journal-outcome-cleanup.ts
echo '=== DELETE/UPDATE on journal_outcomes ==='
rg -n -F -e 'DELETE FROM journal_outcomes' -e 'UPDATE journal_outcomes' -e 'journal_outcomes' . || test "$?" -eq 1

Repository: stablyai/orca

Length of output: 22329


Script executed:

echo '=== journal-outcome-compaction references anywhere in repo ==='
rg -n -F 'journal-outcome-compaction' . || test "$?" -eq 1
echo '=== incremental_vacuum / auto_vacuum ==='
rg -n -F -e 'incremental_vacuum' -e 'auto_vacuum' src/main || test "$?" -eq 1

Repository: stablyai/orca

Length of output: 1224


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.

return null
}
// Without a report an explicit chat shows the saved mode its next turn applies; own has none.
const selectedForNextTurn = state.record.agent === 'codex' && !own

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.

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.

)
})
await reply.click({ button: 'right' })
await page.getByRole('menuitem', { name: 'Copy Context', exact: true }).click()

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.

Major · Functional Correctness · Quick win

Supported by static analysis

Script executed:

rg -n -C 5 --glob '*.tsx' \
  'NativeChatView|contextMenuActions|showTerminalPaneActions' \
  src/renderer/src/components

Repository: stablyai/orca

Length of output: 41950


Script executed:

set -o pipefail
printf '%s\n' '--- changed test ---'
nl -ba tests/e2e/native-chat-send-focus.spec.ts | sed -n '1,180p'
printf '%s\n' '--- helper references ---'
rg -n -C 8 --glob '*.ts' --glob '*.tsx' -e 'function openChat' -e 'const openChat' -e 'createChatOnHost' -e 'openChat\(' tests/e2e src/renderer/src

Repository: stablyai/orca

Length of output: 44199


Script executed:

set -o pipefail
printf '%s\n' '--- createChatOnHost ---'
nl -ba tests/e2e/helpers/structured-claude-stub.ts | sed -n '1,150p'
printf '%s\n' '--- structured session and menu bindings ---'
rg -n -C 8 --glob '*.tsx' --glob '*.ts' \
  -e 'NativeChatStructuredSession' \
  -e 'showTerminalPaneActions' \
  -e 'Copy Context' \
  -e 'onCopyAgentSessionContext' \
  -e 'contextMenuActions' \
  src/renderer/src/components/native-chat src/renderer/src/components/terminal-pane

Repository: stablyai/orca

Length of output: 45661


Script executed:

set -o pipefail
printf '%s\n' '--- structured session declarations and menu calls ---'
rg -n -F --glob 'NativeChatStructuredSession.tsx' -e 'useNativeChatContextMenu' -e 'showTerminalPaneActions' -e 'NativeChatPaneMenuItems' -e 'contextMenuActions' -e 'NativeChatStructuredSession' src/renderer/src/components/native-chat
printf '%s\n' '--- structured session relevant source ---'
file=$(rg --files src/renderer/src/components/native-chat | rg '/NativeChatStructuredSession\.tsx$' | head -n 1)
printf 'FILE=%s\n' "$file"
nl -ba "$file" | sed -n '1,260p'
printf '%s\n' '--- structured view selection ---'
rg -n -C 12 --glob '*.tsx' -e 'mode="structured"' -e 'NativeChatStructuredSession' src/renderer/src/components/native-chat src/renderer/src/components

Repository: stablyai/orca

Length of output: 45667


Script executed:

set -o pipefail
printf '%s\n' '--- structured session JSX ---'
nl -ba src/renderer/src/components/native-chat/NativeChatStructuredSession.tsx | sed -n '255,430p'
printf '%s\n' '--- structured pane command hook ---'
nl -ba src/renderer/src/components/native-chat/use-structured-native-chat-pane-commands.tsx | sed -n '1,120p'
printf '%s\n' '--- view prop types and structured selection ---'
rg -n -C 8 --glob '*.ts' --glob '*.tsx' \
  -e 'type NativeChatStructuredViewProps' \
  -e 'interface NativeChatStructuredViewProps' \
  -e 'mode: .structured.' \
  -e 'NativeChatStructuredSession' \
  src/renderer/src/components/native-chat/NativeChatView.tsx src/renderer/src/components/native-chat/native-chat-view-types.ts src/renderer/src/components/native-chat/NativeChatSessionGate.tsx

Repository: stablyai/orca

Length of output: 19617


Script executed:

set -o pipefail
printf '%s\n' '--- non-test NativeChatView call sites ---'
rg -n -C 10 --glob '*.tsx' --glob '!*.test.tsx' --glob '!*.spec.tsx' '<NativeChatView|NativeChatView\(' src/renderer/src
printf '%s\n' '--- structured mode construction ---'
rg -n -C 12 --glob '*.tsx' --glob '*.ts' --glob '!*.test.tsx' --glob '!*.spec.tsx' \
  -e "mode: 'structured'" -e 'mode="structured"' -e 'mode={.*structured' \
  src/renderer/src

Repository: stablyai/orca

Length of output: 9797


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.

Comment thread src/shared/tui-agent-resume-startup.ts Resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants