Skip to content

feat(chat): give a notebook many named chat sessions (#97) - #188

Merged
mrsibe merged 1 commit into
mainfrom
feat/multiple-chat-sessions
Sep 30, 2026
Merged

mrsibe merged 1 commit into
mainfrom
feat/multiple-chat-sessions

Conversation

@mrsibe

@mrsibe mrsibe commented Sep 30, 2026 •

Copy link
Copy Markdown
Owner

What does this PR do?

Gives a notebook many named chat sessions instead of exactly one, and turns the
silent automatic context rollover into a visible, navigable archive boundary.

Why?

A notebook used to hold one conversation, and SessionAutoSwitchService rolled it
over silently when it approached the context budget. Every topic shared one
thread and its context; the reader could not start a separate line of inquiry;
and the rollover was a backend event they could neither see nor navigate. This
implements #97.

Related issue

Fixes #97

What changed?

  • Schema (additive migration 0022_concerned_spyke): chat_sessions gains
    last_opened_at (which session the notebook returns to) and title_is_auto
    (a placeholder title the first message may replace).
  • Queries: getMostRecentSessionByNotebook replaces
    getActiveSessionByNotebook (many sessions can be active, so status can no
    longer identify one); touchSession, deriveSessionTitleIfAuto,
    searchMessagesInNotebook, countSessionsByNotebook, and use-ordered session
    listing.
  • IPC/preload: touch-session and search-messages; send-message names a
    placeholder session from its first user message.
  • Auto-switch: archives the old session, creates a continuation with
    parentSessionId pointing back at it, and drops the silent "context optimized"
    system message. The rollover stays visible through the data, not a one-shot
    toast.
  • Renderer: SessionSwitcher in the chat panel header (list, + New chat,
    rename, confirmed delete, message search across sessions, archived badge) and
    SessionContinuationNotice (the archive boundary with an "open archived chat"
    action).
  • i18n: new strings in en-US and zh-CN.

How was this tested?

  • CI Verify is green on Linux, macOS and Windows — typecheck, design guard,
    unit tests, electron-builder --dir, and smoke:packaged (which runs the real
    packaged app and therefore applies migration 0022).
  • npm test — 478 pass, including new test/sessionTitle.test.ts and the
    updated automatic-switch renderer test.
  • npx electron-vite build — bundles main, preload and renderer.

The manual workflow from the issue (three sessions, restart, confirm histories,
force a rollover) is covered by the packaged smoke run only at startup; a full
interactive pass is still worth doing before release.

Checklist

  • I have reviewed my own changes.
  • npm run typecheck passes (CI).
  • npm run build passes (CI).
  • I have tested the affected user workflow (packaged smoke run; see note).
  • I have not included unrelated changes.
  • I have updated documentation when necessary.

Desktop / build changes

  • Not applicable
  • npm run build:unpack passes (CI).
  • npm run smoke:packaged passes (CI).

@github-actions github-actions Bot added the enhancement New feature or request label Sep 30, 2026
@mrsibe
mrsibe merged commit ed5689e into main Sep 30, 2026
4 checks passed
@mrsibe
mrsibe deleted the feat/multiple-chat-sessions branch September 30, 2026 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feat] Multiple chat sessions per notebook

1 participant