Skip to content

fix(app): resume the last session at launch instead of a new one - #301

Merged
quickbeard merged 1 commit into
mainfrom
fix/startup-last-session
Aug 22, 2026
Merged

quickbeard merged 1 commit into
mainfrom
fix/startup-last-session

Conversation

@quickbeard

Copy link
Copy Markdown
Owner

Issue 2 of two. Independent of #300 — different file, no overlap beyond both touching CHANGELOG.

Problem

LaunchNewSession redirected every desktop boot to a new-session draft, unconditionally:

const draft = tabs.store.find((tab) => tab.type === "draft")
if (draft) { tabs.select(draft); return }
model.openNewSession()

So a window with sessions open still came up on an empty prompt.

Fix

The rule you asked for: a new session opens only when there is nothing else open.

  • Anything open on the showing side → resume that side's last session (layout.home.lastSession, validated with sessionAlive exactly as the Code/Work switch does, so a deleted session or a departed server never becomes a dead route).
  • History unusable → settle on a tab that is already open, preferring a real session over a leftover draft — landing on the draft would look identical to the behaviour this removes.
  • Nothing open → the previous behaviour, unchanged: reuse a persisted draft, else open a new session.

Read per side, so Code and Work each come up where they were left rather than one deciding for the other.

Verification

The decision chain is extracted into an exported pure launchLanding and unit-tested — the same split workspace/side.ts's folderEntry already uses, and for the same stated reason: this path is desktop-only (there is no "launch" distinct from "navigate to /" in a browser), so the web e2e harness cannot drive it. Seven tests cover resuming past an open tab, resuming past a leftover draft, both unusable-history fallbacks, the nothing-open case, draft reuse, and that a window which will not resume never waits on the server.

Four of them fail against the old always-new-session path (confirmed by disabling the branch and re-running).

test:browser 124 pass, test:unit 690 pass, typecheck clean.

Not verified in the running desktop app — it is desktop-only by design, and I cannot see the Electron window from here. Worth one launch with sessions open before merging.

DIVERGENCES: the existing LaunchNewSession row rewritten to describe the new chain. CHANGELOG entry under Desktop / Web UI.

🤖 Generated with Claude Code

LaunchNewSession redirected every desktop boot to a new-session draft,
so a window with work open still came up on an empty prompt. A window
with tabs open on the showing side now resumes that side's last session,
falling back to an already-open tab when that history is unusable; a new
session is only for a window with nothing open.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@quickbeard
quickbeard force-pushed the fix/startup-last-session branch from 26d47ab to 4adc3f8 Compare August 22, 2026 10:39
@quickbeard
quickbeard merged commit f7c6bfc into main Aug 22, 2026
0 of 5 checks passed
@quickbeard
quickbeard deleted the fix/startup-last-session branch August 22, 2026 10:39
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