orca icon indicating copy to clipboard operation
orca copied to clipboard

[Bug]: Agent panes come back empty after an auto-update relaunch (v1.4.97, Windows) — cold restore skips live agent records

Open taifunk opened this issue 5 months ago • 0 comments

Operating system

Windows

Orca version

v1.4.97

Details

Following up on #5626 — I had the cause wrong there, and since that one's closed I'm filing this as a corrected analysis against the current 1.4.97 build.

Summary: after Orca auto-updates and relaunches, a terminal pane that was running an active claude agent comes back as a plain shell with no agent attached. It isn't a crash — the relaunch is clean. You get the scrollback back, but the live agent is gone.

How to reproduce:

  1. Run a claude agent in an Orca pane and leave it actively working.
  2. While it's mid-session, let Orca auto-update and relaunch (on Windows this is a force-exit).
  3. After relaunch the pane reopens as a bare shell — old text repainted, no live agent.

In my case the pane's Claude Code transcript was still being written about 70 seconds before the relaunch, so it was definitely a live session, not an empty terminal I'd left lying around.

In #5626 I assumed the session record just never got written at quit, and pointed at prepareColdRestoreAgentResumeCommand. That was wrong for 1.4.97 — that function doesn't exist anymore, and records actually do get written continuously while an agent runs. The status reducer writes a liveRecoveryRecord with origin:"live" into sleepingAgentSessionsByPaneKey whenever the agent isn't done, and the store flushes to disk on a ~150ms debounce. Those records survive a force-exit: right now my orca-data.json has four origin:"live" records, and the freshest one's tabId matches activeTabId — so the foreground pane that's actively working has its record sitting on disk. Capture isn't the problem.

The problem is on the resume side. The only thing that re-runs claude --resume on startup is launchSleepingAgentSession, and its caller skips any record whose origin is "quit" or "live" — those are only used for dedup/ownership, never to relaunch. The main-process cold-restore just replays output.log to repaint the scrollback. That's why you get the old text back but no live agent. The records that would be resumed (worktree-sleep) come from the idle/hibernation path, which doesn't fire for an active visible pane. (#6248 is related but on the hibernation side — this still reproduces with experimentalAgentHibernation off, so it isn't the cause here.)

I couldn't grab the store in the exact relaunch window, and the lost pane's own record didn't survive for me to inspect, so I can't completely rule out a capture miss for that specific pane. But both halves — the continuous persistence and the resume-side skip of live/quit records — are right there in the shipped code, and the fix works either way.

Fix suggestion: on cold restore, also resume from origin:"live" (and "quit") records, not just the rest — re-run claude --resume <providerSessionId> for any pane that was working at exit. The session id is already persisted; it's just being filtered out on the way back in.

Workaround in the meantime: the Claude Code transcript is still on disk under ~/.claude/projects/, so claude --resume from the pane's working directory gets the session back.

Related: #5626 (closed, superseded), #5356.

taifunk avatar Jun 25 '26 16:06 taifunk