From c46160064bb722267990defbc8f3d2f213bb6395 Mon Sep 17 00:00:00 2001 From: Jinwoo-H Date: Sun, 26 Apr 2026 20:04:54 -0400 Subject: [PATCH] fix(daemon): checkpoint reconciled sessions, restore legacy cleanup, handle empty scrollback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three fixes from eighth code review cycle: 1. reconcileOnStartup() now adds discovered live sessions to activeSessionIds and registers history writers, so background sessions get checkpointed even before the user reattaches their pane. 2. Restore historyPath for legacy adapters. Checkpoint writes still fail silently (pre-v4 daemons lack getSnapshot), but the HistoryManager is needed for cleanup — close/exit events must mark meta.json as ended and remove history dirs to prevent false cold restores. 3. Alt-screen cold restore now handles empty scrollbackAnsi gracefully. When the emulator had no scrollback above the viewport, skip cold restore entirely rather than showing a blank terminal. Co-authored-by: Orca --- src/main/daemon/daemon-init.ts | 13 +++++++------ src/main/daemon/daemon-pty-adapter.ts | 21 +++++++++++++++++---- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/src/main/daemon/daemon-init.ts b/src/main/daemon/daemon-init.ts index caa5c7172..329cc6dd2 100644 --- a/src/main/daemon/daemon-init.ts +++ b/src/main/daemon/daemon-init.ts @@ -327,16 +327,17 @@ async function createLegacyDaemonAdapters(runtimeDir: string): Promise