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(accounts): keep Claude's bypass when an account switch restarts the session - #36359
When you switch Claude accounts, Orca restarts the running Claude sessions on the new account. If Orca had no record of how a session was started, it restarted it without --dangerously-skip-permissions, so a session that was skipping permission prompts started asking again. Claude already tells Orca which permission mode it is in, so the restart now keeps the bypass when Claude reports it was on.
What Changed
Before: an account-switch restart resumes a Claude pane with its recorded launch arguments. A pane with no record resumes as plain claude --resume <id> (#29898's guard against giving a hand-typed claude a bypass it never had). As #34690 reports, that includes Orca-launched panes whose launch was not recorded, and a claude --dangerously-skip-permissions typed by hand. The restart then records agentArgs: "" for the pane, so later restarts drop the flag even when the recorded launch is found.
After:
The Claude hook listener keeps the lead session's permission_mode on providerSession.permissionMode, the way it keeps effort (fix(agent-resume): resume Claude sessions at their own effort level #33765). Claude sends the field on prompt, tool and stop hooks but not on SessionStart, so hooks without it keep the last value. Subagent hooks are ignored.
normalizeAgentProviderSession, the sleeping-session schema and the recovery-record comparison keep the field, validated as a short alphabetic token. effort and the new field are read by one helper so agent-session-resume.ts stays within its line budget.
agentProviderSessionForHostEnsure leaves the field out of agentSession.ensure, whose strict ProviderSession schema would reject it, as it already does for cwd.
resolveAgentAccountRestartResumeStartup adds Claude's bypass argument when the session reports bypassPermissions and the resume arguments don't already bypass. Recorded arguments are kept as they are. A recorded agentCommand replaces the arguments on resume, so the bypass is spliced into it as well, before any -- terminator, with the builder the resume selectors use; that covers the claude with empty arguments an earlier restart records.
Why
This is the first fix suggested in #34690. It keeps #29898's guarantee: only a session that reports bypassPermissions gets the flag, and Claude only enters that mode when its own flags or settings allow it, so a hand-typed claude without the bypass still gets none. The mode comes from Claude's hooks, which already supply the resume identity, cwd and effort. Terminal OSC status never carries a provider session, so terminal output cannot set it.
The other suggestion in #34690, falling back to Settings → Agents arguments, would also bring back --add-dir and similar flags, but it would give the configured bypass to a hand-typed claude that never had it. That is the case #29898 guards against, so this PR keeps only the permission mode. The restarted pane records the flags it actually launched with, like any Orca launch, so a later restart keeps them even if the session changes mode in between, the same as for a session Orca started with the bypass. Cold restore resumes from the same recorded recipe and could read the field in a follow-up (#32245).
N/A: no UI change. The change is in the command a restart runs, and the tests below assert that command.
Testing
Rebased on main a29461b (the resume module moved to src/shared/agent-session/lifecycle/). pnpm check:changed --maxWorkers=4 passes on macOS for format, lint, typecheck, ratchets and the affected unit tests, except the tests/e2e/cross-version-wire suites. Those fail the same way without this change: with the v1.4.246 tag fetched, the harness imports src/shared/agent-session-record.ts and similar paths that v1.4.246 moved under src/shared/agent-session/.
New tests:
The listener records the mode, ignores a subagent's mode and keeps the mode across hooks without the field.
Normalization and the sleeping-session schema round-trip the mode and drop malformed values.
The restart command keeps a hand-started bypass, adds it to recorded arguments or a recorded command that lost it, places it before a recorded --, and never repeats a recorded one.
The provider session sent to agentSession.ensure still passes the strict ProviderSession schema.
Without the fix, 11 of the new cases fail.
Captured Claude Code 2.1.284's real UserPromptSubmit hook input, blocked with exit code 2 so nothing reached the API. claude --dangerously-skip-permissions reports "permission_mode": "bypassPermissions", and plain claude reports "auto", its default mode on that machine.
Not yet run end to end in a packaged build with two real accounts; I will run it in a local build and update this section.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Written with Claude Code using Claude Opus 5.5; I reviewed the change and the evidence.
SSH / remote and mixed versions: account-switch restarts only move local panes. The field is optional: older hosts and saved records lack it and keep today's behavior. It never goes into agentSession.ensure, so no host's strict schema sees it (a new test parses the shaped value with that schema), and terminal.create's non-strict resume param drops it.
Agent compatibility: Claude only. Other agents' provider sessions never carry the field, and Codex restarts are unchanged.
Performance: one string read per Claude hook.
Security: the mode can only keep a bypass the running session already has. It is accepted only from authenticated hook payloads and from saved records validated against ^[A-Za-z]{1,32}$.
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
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
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)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
Walkthrough
Claude permission mode is validated, read from hook data, and retained in provider-session metadata. Recovery matching now compares permission mode. The host ensure payload omits permission mode. When a Claude session recorded with bypassPermissions restarts, startup arguments add the bypass flag only if it is not already present.
Severity of issue fixed: Medium
Merge Risk: Moderate · up to 828f3
A later restrictive mode change can be lost on account-switch restart, causing Claude to resume without the permissions the user selected. Fix this before merging.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 66.67% 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.
Passed checks: 4 passed
Check name
Status
Explanation
Title check
The title clearly and concisely describes the main change: preserving Claude's bypass permission mode during account-switch restarts.
Description check
The description is detailed and covers the change, rationale, linked issue, testing, compatibility, security, and checklist items. It omits the required Risk section, including an explicit risk level …
Linked Issues check
[#34690] Requirement: an account-switch restart must keep the permission mode that the Claude session runs in. The PR meets this requirement, which is the first fix that #34690 proposes. Evidence at t…
Out of Scope Changes check
Every changed area supports permission-mode preservation for the Claude account-switch restart in [#34690]. The changed areas are: the hook listener field and reader (pane-provider-session.ts); the li…
Full details: Description check
Explanation
The description is detailed and covers the change, rationale, linked issue, testing, compatibility, security, and checklist items. It omits the required Risk section, including an explicit risk level and rollback plan, and manual packaged end-to-end testing remains pending, but the overall description is mostly complete.
Full details: Linked Issues check
Explanation
[#34690] Requirement: an account-switch restart must keep the permission mode that the Claude session runs in. The PR meets this requirement, which is the first fix that #34690 proposes. Evidence at the reviewed head: (1) src/shared/agent-hook-listener/pane-provider-session.ts stores the lead session's permission_mode on providerSession.permissionMode. It ignores hooks with agent_id, so subagent modes are not used, and it keeps the prior value when a hook omits the field. (2) src/shared/agent-provider-session-live-settings.ts validates the value against ^[A-Za-z]{1,32}$. normalizeAgentProviderSession, the sleeping-session schema, and recoveryRecordMatches keep the field. (3) src/renderer/src/lib/agent-account-restart-startup.ts keepLiveClaudeBypass adds the Claude bypass argument only when providerSession.permissionMode is 'bypassPermissions' and the recorded agentArgs or agentCommand do not already enable bypass. Recorded arguments are kept. A recorded agentCommand is spliced through buildClaudeResumeLaunchCommand, which places the flag before any '--' terminator. Tests cover hook persistence, validation, schema round-trip, the strict ProviderSession shape sent to agentSession.ensure, and restart commands. The Settings-arguments fallback is not required here. #34690 offers it as an alternative, and the PR states why it is excluded. The bug text also names --add-dir. That flag is not restored for unrecorded panes, but the linked issue's central requirement is permission-mode preservation, and the proposed fix covers it. Remaining uncertainty: end-to-end behavior in a packaged build with real accounts is not yet verified by the author, and this review did not run tests.
Full details: Out of Scope Changes check
Explanation
Every changed area supports permission-mode preservation for the Claude account-switch restart in [#34690]. The changed areas are: the hook listener field and reader (pane-provider-session.ts); the live-settings validator and reader (agent-provider-session-live-settings.ts); the provider-session type and normalization (agent-session-resume.ts); the sleeping-session schema and its hydration test; recoveryRecordMatches comparison; the restart recipe (agent-account-restart-startup.ts); and agentProviderSessionForHostEnsure, which omits permissionMode from agentSession.ensure so the strict ProviderSession schema accepts the payload. The ensure change is needed because the field is new. The restart code path touches only Claude when the mode is bypassPermissions. Other agents and Codex keep their existing recipe. The PR does not add unrelated product behavior, and it does not change cold restore. The author identifies cold restore as a follow-up in #32245. No unrelated change was found in the reviewed diff.
Full details: Docstring Coverage
Explanation
Docstring coverage is 66.67% 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 9 functions across 12 files.
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
…he session
An account-switch restart resumes a Claude pane with its recorded launch
arguments, and a pane with no record resumes as plain `claude --resume`
so a hand-typed claude never gains a bypass. That also dropped a bypass
the session did have, and the restart then recorded empty arguments, so
later restarts dropped it too.
Claude reports its live permission mode on its prompt, tool and stop
hooks. The hook listener now keeps the lead session's `permission_mode`
on the provider session, like effort, and the restart adds Claude's
bypass argument only when the session reports bypassPermissions.
Fixesstablyai#34690
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Do not persist the injected bypass as a launch preference.
The account-restart path adds the bypass to agentArgs, copies those arguments into startupPlan.launchConfig, and registers that configuration for the pane. A later restart in plan or auto mode can reuse the persisted bypass because existing arguments are kept unchanged.
Keep the injected bypass separate from the recorded launch preference. Apply it only to the current restart command.
…mmand
A recorded `agentCommand` replaces the arguments on resume, so adding
the bypass to `agentArgs` alone did nothing for panes that recorded one,
including the `claude` with empty arguments a lossy restart records.
The restart now adds the bypass to the recorded command too.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Appending the bypass to a recorded `claude --` made it a positional
argument. Splice it in with the same terminator-aware builder the resume
selectors use.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Thanks for this. Capturing Claude's reported permission mode is part of #38998, where it decides whether an unrecorded Claude session resumes with bypass across every restart path, not only account switch. You're credited in the PR description.
Claude names its live permission mode on prompt, tool and Stop hooks. Keep the
root agent's latest value on the provider session, next to effort, so a resume
without a recorded launch can tell whether the session ran in bypass.
Ports the capture from #36359 by Nelef.
Claude names its live permission mode on prompt, tool and Stop hooks. Keep the
root agent's latest value on the provider session, next to effort, so a resume
without a recorded launch can tell whether the session ran in bypass.
Ports the capture from #36359 by Nelef.
Thanks @Jinwoo-H, and thanks for the credit. Covering every restart path in #38998 is a better fix than the account-switch-only change here. I'll close this PR once #38998 is merged.
If it helps, I can try #38998 on my setup before it lands (macOS, two managed Claude accounts, Claude sessions started by hand with --dangerously-skip-permissions) and report back.
…8998)
* feat(agent-session): keep the permission mode a Claude session reports
Claude names its live permission mode on prompt, tool and Stop hooks. Keep the
root agent's latest value on the provider session, next to effort, so a resume
without a recorded launch can tell whether the session ran in bypass.
Ports the capture from #36359 by Nelef.
* fix(agent-launch): resume an unrecorded launch bare unless it reported bypass
Without a recorded launch, every restart path now resumes with no settings
Arguments, env or permission default; the configured Command still runs. A
session whose root agent last reported bypassPermissions keeps its bypass flag,
so a hand-typed claude --dangerously-skip-permissions keeps it while a bare
hand-typed claude never gains one (#29898).
Account-switch restart used the shared rule only for Claude; it now uses it
for every agent. Thanks to JustinCMR (#37304) for finding the account-switch
and cold-restore gaps.
* fix(terminal): keep the launch recipe of a window-started agent in main
A window spawn hands main its recipe, but main kept only the token and agent,
so restarts that main runs (workspace sleep capture, closed-worker reopen)
found no recipe and resumed bare. Keep it with the launch authority, the same
gate that admits the token.
* fix(orchestration): reopen a closed worker with the recipe it launched with
A closed worker's pane record goes away with its tab, so orchestration send
reopened it bare (#37693). The worker row now keeps the recipe Orca launched
the agent with, keeps it when a later capture of the same launch arrives
without one (main loses it on a daemon reattach), and a reopen prefers it over
a pane record that may hold another launch of the conversation.
Adapted from #37757 by Pr1p, without a new column.
* fix(terminal): keep a slept pane's earlier recipe only for the same launch
A host sleep capture without a recipe reused the pane's earlier record for the
same conversation. That is right after a daemon reattach, when Orca's launch
still runs but main lost its recipe, and wrong for an agent typed into the
shell that resumed the conversation: it never ran that launch.
* fix(agent-session): restore a paired pane with the recipe its host recorded
A client restoring a pane on a paired host sends only its recorded Arguments,
and the host filled the rest from its current settings. A saved restore now
replays the host's own record for that pane, or, with none at all, resumes
bare and keeps a bypass only when this host's hooks saw it reported. History
and other user-chosen resumes keep current settings.
* fix(terminal): replay a saved note only for the launch main still holds
A note belongs to the agent in a pane only while main holds that launch's
token: main admits it at spawn and retires it when the launch command
finishes, and a daemon reattach restores neither. Worker, host sleep and
hook/quit captures now take a note only from that attested launch, and no
longer copy an earlier record's note by agent or conversation match, which a
typed resume in the same shell also satisfies. With no attested launch the
unrecorded rule applies.
Replaces the inferred orcaLaunched / recipeLostPaneKeys flags and drops the
mock-only reopen and fixture-echo worker tests.
* fix(agent-status): take a pane's note from the launch main attests
The window carried a pane's saved note into each new record by agent and
conversation match, so an agent typed into the shell that resumed the same
conversation inherited an earlier launch's bypass. Main now sends the note of
the launch it still holds with each status, and the window records only that,
its own launch registration, or, for a restored replay of the very status a
record was written from, that record's note. /clear and compact keep the note
because main still holds the same launch.
* fix(orchestration): reopen a worker with its own recipe or none
A worker without its own note took the note of whichever pane record held the
same conversation. Its reopen now always passes a complete recipe: its own
note, or the unrecorded rule. The unrecorded bypass is also scoped to Claude,
whose hooks are the ones that report a root agent's permission mode.
* fix(agent-session): restore a paired pane from its source pane, never current settings
A saved restore on a paired host looked up the destination pane, which a Wake
opens as a new tab, and fell back to the host's current settings whenever the
client sent its partial Arguments. The client now names the source pane (to
hosts advertising agent-session.restore-source-pane.v1), and the host replays
its note for that pane or, with none, resumes bare keeping only a bypass its
own hooks saw there. Older hosts keep today's behavior.
* fix(terminal): re-arm a launch across a main restart while its agent still runs
The daemon outlives main, so it now keeps main's admitted launch (token and
note) and drops it when that launch's command finishes. On reattach main
re-arms the launch only when the same agent still runs in the foreground:
nothing can be typed into a daemon PTY while main is down, so a running agent
there is the one the unretired note launched. A shell foreground clears the
daemon's note; an unknown read, including every Windows read, declines.
Older daemons keep no note, so restore declines there as before.
* fix(terminal): the daemon retires a launch note when its command finishes
A launch can finish while main is down, so main's own retirement never sees it and a
hand-typed agent in that pane would later pass the reattach foreground check.
* fix(agent-status): a fresh Claude start never inherits the last process's permission mode
A hand-typed resume of the same conversation may run without the bypass the previous
process had, so only /clear and compact carry the mode forward.
* fix(agent-session): name a restore's source pane in the host's own keys
A mirrored pane's key carries the desktop tab prefix, so the host's exact lookup missed
its saved note.
* fix(terminal): retire a daemon launch note by its token from the one retirement owner
A delayed reattach result or a late retire could clear a newer launch's note. Retires now
name the token they retire, the reattach checks its PTY before clearing, and re-arming the
same launch keeps the daemon's completion scanner.
* fix(agent-status): only the launch owner's statement changes a pane's note
Main now states the attested note, or null for none, on every hook status. An OSC or
display update makes no statement, so after a completed turn it no longer erases an Orca
launch's note; a typed resume still drops it through main's null.
* fix(terminal): an attach leaves alone a launch main already holds
The renderer attaches a pane the CLI just launched before its agent starts, so the
attach saw the shell and retired the new launch's daemon note.
* fix(agent-status): a paired client keeps a pane's note only on its host owner's word
The host's session-tabs frame now says whether the Orca launch it admitted still runs on
the published incarnation, and the client applies that fact whichever writer wins the
status. With an owner's word the conversation no longer decides; an older host that says
nothing keeps the same-conversation rule.
* refactor(agent-status): one decision picks a pane's note for every reader
The live entry, quit capture, provider-session updates, account restart and cold
restore now ask the same owner-aware decision. An owner's none is final and, when it
turns, ends the pane's registry entry and saved note, locally and from a paired host's
frame. Cold restore and account restart take that answer for a live invocation and read
the saved record only when none is live. Inlines single-use wrappers.
* refactor(agent-status): a paired retirement test reaches the cold-restore command; trim comments
Replaces the projection and continuity tests with one transition: host frame retires the
launch, the next OSC keeps no note, and the cold-restore command has no old bypass.
* fix(agent-status): an owner's none retires the pane's matched launch registry entry
* chore: satisfy changed-code gates (type guards, SAFETY notes, fixed test clock)
* fix(agent-launch): a teams launch keeps its note; a legacy leaf id restores without throwing
* refactor(daemon): keep the session launch note on the process base so session.ts stays in budget
* fix(agent-launch): a restarted terminal main can't vouch for keeps main's earlier launch rule
* fix(agent-launch): read the pane's current terminal; a finished launch settles an undecided pane
* fix(agent-launch): undecided and held launches end with their process
A finished command, a fresh launch or a replacement process settles an undecided pane;
a newer attach or finish supersedes a foreground read still in flight; a legacy relay
reattach without an incarnation stays undecided; a held launch applies only to the
process it was recorded for.
* refactor(terminal): watch and arm a created terminal's launch in one call
Keeps terminal-create.ts within the 300-line budget after main's growth.
* refactor(terminal): keep main's launch evidence in one immutable record
Replace the undecided flag, the reattach check map and the re-arm's writes
to main's orchestration launch fields with one launchEvidence object
(unknown, gone for an incarnation, or held with its recipe), owned by
launch-evidence.ts.
- A fresh admitted launch is held; any other fresh process is gone.
- A finished command or confirmed exit is gone, sticky for its process:
no reattach, legacy or noted, can revive it.
- A replacement retires its predecessor's evidence without deciding the
newcomer, which may still prove its own launch through a reattach.
- A reattach note is held only after a foreground read sees its agent;
the evidence object fences that read.
- A gone launch clears its recipe and blocks both refill sites; a
deliberate sleep snapshot keeps its recipe past the launch it captured.
- launchToken, launchIncarnationId and launchAgent writes match main.
* fix(terminal): keep launch evidence through a first incarnation and sleep snapshots
- Learning a process's first incarnation binds its held or gone evidence
to it, so a later attach can neither revive a finished launch nor drop
a running one; a known X->Y replacement is fenced as before and now also
clears the predecessor's recipe.
- A status from no Orca launch leaves a sleep snapshot of its session for
the wake and never takes that snapshot's recipe into a live or quit
record.
* fix(terminal): record a runtime split's fresh shell as running no launch
* chore: rerun CI on main with the typecheck fix
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
When you switch Claude accounts, Orca restarts the running Claude sessions on the new account. If Orca had no record of how a session was started, it restarted it without
--dangerously-skip-permissions, so a session that was skipping permission prompts started asking again. Claude already tells Orca which permission mode it is in, so the restart now keeps the bypass when Claude reports it was on.What Changed
Before: an account-switch restart resumes a Claude pane with its recorded launch arguments. A pane with no record resumes as plain
claude --resume <id>(#29898's guard against giving a hand-typedclaudea bypass it never had). As #34690 reports, that includes Orca-launched panes whose launch was not recorded, and aclaude --dangerously-skip-permissionstyped by hand. The restart then recordsagentArgs: ""for the pane, so later restarts drop the flag even when the recorded launch is found.After:
permission_modeonproviderSession.permissionMode, the way it keepseffort(fix(agent-resume): resume Claude sessions at their own effort level #33765). Claude sends the field on prompt, tool and stop hooks but not onSessionStart, so hooks without it keep the last value. Subagent hooks are ignored.normalizeAgentProviderSession, the sleeping-session schema and the recovery-record comparison keep the field, validated as a short alphabetic token.effortand the new field are read by one helper soagent-session-resume.tsstays within its line budget.agentProviderSessionForHostEnsureleaves the field out ofagentSession.ensure, whose strictProviderSessionschema would reject it, as it already does forcwd.resolveAgentAccountRestartResumeStartupadds Claude's bypass argument when the session reportsbypassPermissionsand the resume arguments don't already bypass. Recorded arguments are kept as they are. A recordedagentCommandreplaces the arguments on resume, so the bypass is spliced into it as well, before any--terminator, with the builder the resume selectors use; that covers theclaudewith empty arguments an earlier restart records.Why
This is the first fix suggested in #34690. It keeps #29898's guarantee: only a session that reports
bypassPermissionsgets the flag, and Claude only enters that mode when its own flags or settings allow it, so a hand-typedclaudewithout the bypass still gets none. The mode comes from Claude's hooks, which already supply the resume identity, cwd and effort. Terminal OSC status never carries a provider session, so terminal output cannot set it.The other suggestion in #34690, falling back to Settings → Agents arguments, would also bring back
--add-dirand similar flags, but it would give the configured bypass to a hand-typedclaudethat never had it. That is the case #29898 guards against, so this PR keeps only the permission mode. The restarted pane records the flags it actually launched with, like any Orca launch, so a later restart keeps them even if the session changes mode in between, the same as for a session Orca started with the bypass. Cold restore resumes from the same recorded recipe and could read the field in a follow-up (#32245).Linked Issue
Fixes #34690
Visual Proof
N/A: no UI change. The change is in the command a restart runs, and the tests below assert that command.
Testing
Rebased on main a29461b (the resume module moved to
src/shared/agent-session/lifecycle/).pnpm check:changed --maxWorkers=4passes on macOS for format, lint, typecheck, ratchets and the affected unit tests, except thetests/e2e/cross-version-wiresuites. Those fail the same way without this change: with the v1.4.246 tag fetched, the harness importssrc/shared/agent-session-record.tsand similar paths that v1.4.246 moved undersrc/shared/agent-session/.New tests:
--, and never repeats a recorded one.agentSession.ensurestill passes the strictProviderSessionschema.Without the fix, 11 of the new cases fail.
Captured Claude Code 2.1.284's real
UserPromptSubmithook input, blocked with exit code 2 so nothing reached the API.claude --dangerously-skip-permissionsreports"permission_mode": "bypassPermissions", and plainclaudereports"auto", its default mode on that machine.Not yet run end to end in a packaged build with two real accounts; I will run it in a local build and update this section.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Written with Claude Code using Claude Opus 5.5; I reviewed the change and the evidence.
Review
Agent review summary:
agentSession.ensure, so no host's strict schema sees it (a new test parses the shaped value with that schema), andterminal.create's non-strict resume param drops it.^[A-Za-z]{1,32}$.Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)🤖 Generated with Claude Code