Skip to content

(restore): quit during a restore can save a duplicate fresh session or drop an attaching continuation #550

Closed

Description

@devsuitup

Follow-ups from the review of #548 (integration of #477, #479 and #518). Neither PR shows these alone: the scheduled saves stop during runRestore, and only #479's final exit flush reaches the windows below.

  1. A quit during a fresh restore saves two new sessions. launchNewSession (public/app.js:1349,1363) adds the new id to pendingSessions/openSessions before await openTerminal, while the fresh item is still in restoreInFlight. A quit in that window saves [{cleared, active, fresh}, {started-1, fresh}], and the next start opens two new sessions in the project. Repro written outside the repo. Fix: drop the in-flight fresh item once this restore has created a pending session for its project.
  2. A quit while a continuation opens as attach drops it from the saved set. The entry is open with attach=true and item.sessionId is already the new id (app.js:310), but keepAttached is set only after the open returns (:329, :1550). The held filter (app.js:210) skips it. Fix: also keep entries that are open as attach and still in restoreInFlight.
  3. clearOwner on the process-table path is untested. test/cli-session-state.test.js:540-561 injects readParentPid, which turns the table off. Add a test with readProcessTable injected and win32 as the platform.

All three are narrow: a quit during restore, and a test gap. Bugs 1 and 2 are red-first.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions