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
[Bug]: Session loss on first launch after upgrading from pre-#5232-fix version (1.4.65 → 1.4.68) #5356
The fix for #5232 (PRs #5234, #5240) does not protect users upgrading from a version that predates the fix. On first launch after upgrading from 1.4.65 → 1.4.68, in-progress floating terminal sessions — including active Claude agent sessions — are lost and replaced with blank new sessions.
Root cause
The cold-restore mechanism added in PR #5240 requires that the previous Orca version wrote sleepingAgentSessionsByPaneKey at quit time. Pre-fix versions (e.g. 1.4.65) never wrote this field — that was the original bug. So on first launch after upgrading, 1.4.68 finds no session payload to restore from and falls back to spawning fresh sessions.
The fix only takes effect from the second restart post-upgrade, once 1.4.68 itself has written the quit-time state.
Observe floating terminal sessions after Orca relaunches
Expected behavior
Existing sessions are restored, or at minimum the user is notified that session state from the previous version cannot be recovered.
Actual behavior
Active sessions (including in-progress Claude agent sessions) are silently replaced with blank new sessions. No warning is shown. Sessions are unrecoverable.
Additional detail
Two floating terminal sessions were active at update time — one plain shell, one with an active Claude agent mid-session. After relaunch, both were replaced with 2 new sessions created ~132ms apart (programmatic batch, not user action), confirming Orca initiated the replacement rather than the user.
Reproduced — confirmed (source + logic + passing unit test)
The claim holds on current main (HEAD == origin/main). The #5240 cold-restore recovers in-progress agent sessions only from the persisted sleepingAgentSessionsByPaneKey map (written at quit with origin: 'quit'). Builds predating the #5232 fix never wrote that field, so on the first launch after upgrading, the map is absent and every live agent terminal cold-restores as a blank shell — silently and unrecoverably. The fix only engages from the second restart post-upgrade.
Root cause (file:line):
src/shared/workspace-session-sleeping-agents.ts:100-119 — the schema field is .optional() and preprocesses missing/empty to undefined, so a pre-fix payload validates cleanly with no resume records.
src/renderer/src/store/slices/terminals.ts:3220-3224 — the missing-field fallback session.sleepingAgentSessionsByPaneKey ?? {}: an absent field silently becomes an empty resume map. No migration from an older shape, no warning.
src/renderer/src/lib/resume-sleeping-agent-session.ts:145 — resumeSleepingAgentSessionsForWorktree iterates Object.values(...); empty map → 0 launched → blank shell. Nothing inspects the restored tab.launchAgent to detect the lost agent.
Unit test (src/renderer/src/lib/resume-sleeping-agent-session-prefix-upgrade-loss.test.ts, 3 passed):
pre-fix session validates but carries no resume records (sleepingAgentSessionsByPaneKey === undefined);
control (quit record present) → resume returns 1, resumed agent tab + restore banner;
bug (field absent) → resume returns 0, no resumed tab — a silent blank shell.
npx vitest run --config config/vitest.config.ts src/renderer/src/lib/resume-sleeping-agent-session-prefix-upgrade-loss.test.ts
Fix status: PR #5356 (commit 919a9f799) adds an agentSessionCaptureVersion capability stamp and a one-time non-destructive pre-upgrade-loss notice at hydration — but it is not on main (confirmed absent; it lives on origin/brennanb2025/fix-5356-session-loss-upgrade). It can't recover the lost session ids (the pre-fix build never persisted them); it replaces the silent blank shell with an explained notice. On current main the loss is still silent.
Full trace in docs/bug-reproductions/5356-session-loss-upgrade-prefix.md.
🔁 Reproduced via automated Windows bug-reproduction pass.
Closing as not planned. The ongoing agent-session persistence issue was addressed by #5232/#5240. This issue covers only the one-time transition from sessions written before that support existed; those missing session IDs cannot be recovered retroactively, and we've decided not to add a permanent migration notice for that historical transition.
Activity
brennanb2025 commentedon Jul 15, 2026
Taking a look 👀
Classify agentSessionCaptureVersion in the host-split ownership table (…
Harden pre-upgrade session-loss notice (#5356)
OrcaWin commentedon Jul 18, 2026
Reproduced — confirmed (source + logic + passing unit test)
The claim holds on current
main(HEAD ==origin/main). The #5240 cold-restore recovers in-progress agent sessions only from the persistedsleepingAgentSessionsByPaneKeymap (written at quit withorigin: 'quit'). Builds predating the #5232 fix never wrote that field, so on the first launch after upgrading, the map is absent and every live agent terminal cold-restores as a blank shell — silently and unrecoverably. The fix only engages from the second restart post-upgrade.Root cause (file:line):
src/shared/workspace-session-sleeping-agents.ts:100-119— the schema field is.optional()and preprocesses missing/empty toundefined, so a pre-fix payload validates cleanly with no resume records.src/renderer/src/store/slices/terminals.ts:3220-3224— the missing-field fallbacksession.sleepingAgentSessionsByPaneKey ?? {}: an absent field silently becomes an empty resume map. No migration from an older shape, no warning.src/renderer/src/lib/resume-sleeping-agent-session.ts:145—resumeSleepingAgentSessionsForWorktreeiteratesObject.values(...); empty map → 0 launched → blank shell. Nothing inspects the restoredtab.launchAgentto detect the lost agent.Unit test (
src/renderer/src/lib/resume-sleeping-agent-session-prefix-upgrade-loss.test.ts, 3 passed):sleepingAgentSessionsByPaneKey === undefined);1, resumed agent tab + restore banner;0, no resumed tab — a silent blank shell.Fix status: PR #5356 (commit
919a9f799) adds anagentSessionCaptureVersioncapability stamp and a one-time non-destructive pre-upgrade-loss notice at hydration — but it is not onmain(confirmed absent; it lives onorigin/brennanb2025/fix-5356-session-loss-upgrade). It can't recover the lost session ids (the pre-fix build never persisted them); it replaces the silent blank shell with an explained notice. On currentmainthe loss is still silent.Full trace in
docs/bug-reproductions/5356-session-loss-upgrade-prefix.md.🔁 Reproduced via automated Windows bug-reproduction pass.
brennanb2025 commentedon Jul 19, 2026
Closing as not planned. The ongoing agent-session persistence issue was addressed by #5232/#5240. This issue covers only the one-time transition from sessions written before that support existed; those missing session IDs cannot be recovered retroactively, and we've decided not to add a permanent migration notice for that historical transition.