Skip to content

fix: preserve sessions and restore native window interactions - #336

Merged
arzafran merged 2 commits into
mainfrom
release/session-reliability-20260914
Sep 14, 2026
Merged

arzafran merged 2 commits into
mainfrom
release/session-reliability-20260914

Conversation

@arzafran

@arzafran arzafran commented Sep 13, 2026

Copy link
Copy Markdown
Member

Closing a window now keeps its workspaces and live terminal sessions available from the Dock or New Window. Autosave acknowledges completed disk writes, retries failures, and cancels quit when sessions cannot be saved. Replacement instances wait for the prior process to exit before restoring or writing snapshots.

  • Preserve snapshot-owned escrow sessions and scrollback, with an explicit notice when recovery starts a fresh shell.
  • Bound ANSI replay style storage and allow every idle renderer to be reclaimed when all windows are hidden.
  • Persist worktree parent relationships and retain workspace colors in selected rows.
  • Simplify provider usage and restore native dragging and titlebar double-click behavior on empty chrome and tab strips.
  • Expose native tab pills and their selection action to accessibility.

Validation on d1c8d3a9479e6992f08542eecbc204754917c37b: PR CI, macOS 15/26 compatibility, both close/reopen UI tests, and the native window-drag UI test all pass. Tagged builds and 156 focused unit tests pass with no failures or skips. Full CI retains three existing headless first-responder test skips; main-only lag/UI jobs are conditionally skipped on the PR. No measured CPU or memory delta is claimed.

The close-window tests intentionally change from destructive-close confirmation to preserving the same shell PID and shell-local state after reopening.

@darkestdarky-bot darkestdarky-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR adds session preservation across window closes and app restarts, with a startup handoff mechanism to wait for previous instances. The changes are largely sound, but one data-loss path exists: resumeStartupSessionAfterHandoff ignores the return value of saveSessionSnapshot, which could silently lose session state if the write fails. No other P0 or P1 issues are visible in the supplied diff.

Review coverage: 500/3806 diff lines supplied. Partial input (truncated: diff, standards). Inline comments are limited to fully visible, valid right-side hunks. Reviewed commit: d1c8d3a9479e6992f08542eecbc204754917c37b.

Comment thread Sources/AppDelegate.swift
guard !isTerminatingApp else { return }
prepareStartupSessionSnapshotIfNeeded()
let primary = mainWindowContexts.values.first(where: { $0.windowId == startupHandoffPrimaryWindowId })
?? mainWindowContexts.values.first

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignoring the return value of saveSessionSnapshot discards a potential write failure. If the save fails, session state will be lost on next quit without any user notification. This is a data-loss path per the code review standards.

@arzafran
arzafran merged commit 01cd644 into main Sep 14, 2026
13 checks passed
@arzafran
arzafran deleted the release/session-reliability-20260914 branch September 14, 2026 00:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant