Skip to content

feat(sessions): open sidebar sessions in a new browser tab - #1169

Open
wowayou wants to merge 2 commits into
agegr:mainfrom
wowayou:feat/session-open-new-tab
Open

wowayou wants to merge 2 commits into
agegr:mainfrom
wowayou:feat/session-open-new-tab

Conversation

@wowayou

@wowayou wowayou commented Oct 10, 2026 •

Copy link
Copy Markdown

Summary

  • A saved session's title in the sidebar is now a real link (?session=<id>),
    so middle-click, Ctrl/Cmd-click and other native link gestures open it in a
    new browser tab without changing the current tab's session.
  • A plain click and Enter still select the session in place, with no page reload.
  • The row menu (right-click and ⋯) has Open in new tab (shortcut T),
    after the session-management actions and just before Delete. It is available
    for normal, pinned, archived and running sessions.
  • Transient sessions keep their button and get no link or menu.

Implementation

  • lib/session-links.ts builds a relative ?session=<encoded-id> link. It
    preserves the current origin and path for sub-path deployments and removes
    stale query parameters and the hash. isPlainActivation() keeps ordinary
    link activation in the current page.
  • SessionTree retains the latest upstream sidebar layout and row markup. Only
    the main control of a saved session becomes an <a href>; archive and ⋯
    controls remain outside the link. Plain activation is handled in place;
    modifier and auxiliary clicks use the browser's native behavior. The row's
    own click handler remains unchanged, so transient rows and row whitespace
    preserve their previous behavior.
  • Focus restoration now targets the first a[href], button, so a revealed or
    forked saved session focuses its link instead of its archive button.
  • SessionSidebar adds the synchronous window.open(..., "_blank", "noopener,noreferrer") menu action for the clicked row. It does not select,
    move cwd, create, fork or prompt a session. The downstream
    pi-web:session-row-contextmenu hook remains unchanged.
  • The link is styled like the existing button and uses the existing focus ring.
    OpenInNewTabIcon and translations for en, zh-CN and zh-TW are included.
  • The change was rebased onto upstream main at 30af3b4 (v0.11.1), including
    the newer files-below-sessions layout, archive motion, row sizing and drag
    behavior. No backend, Agent lifecycle, session format, dependency or Demo
    changes were introduced.

Testing

  • node_modules/.bin/tsc --noEmit: PASS
  • npm run lint: PASS
  • npm test: PASS, 2935 tests; 2934 passed, 0 failed, 1 skipped
  • npm run test:e2e: PASS, 27 checks. The first migration run hit the known
    upstream reading-offset timing assertion; the next run passed completely.
  • The new session-navigation checks cover plain click, Enter, Ctrl/Cmd-style
    modifier behavior, middle-click, right-click and ⋯ menus, reload and
    per-tab memory, pinned and archived rows, no session creation/fork/prompt,
    missing-session behavior in a fresh profile, and focus after keyboard Fork.
  • The final branch contains only the latest upstream plus the two feature
    commits (dd5bd92, b1b5e13). git diff origin/main..HEAD contains the
    feature files only; git diff --check is clean.

Compatibility

  • Verified on Linux with Chromium (headless), including the latest upstream
    sidebar layout.
  • Firefox, Safari, macOS Cmd-click, Windows and a real mobile device were not
    tested.
  • The Demo and search-result deep links are unchanged and remain outside this
    PR.

Known limitation (tracked separately)

A link to a session that no longer exists falls back to that project's last
open session when the browser profile has previously opened a session in that
project. This behavior is reproduced in the final feature branch and is
tracked in #1168. A fresh browser profile selects no session.

Upstream synchronization

This branch was rebased after upstream merged the sidebar layout and release
commits that landed during development. The fork's main is now identical to
agegr/pi-web:main, and the PR no longer has merge conflicts.

Closes #1167

A saved session's title in the sidebar is now a real link (?session=<id>),
so middle-click and Ctrl/Cmd-click open it in a new browser tab while the
current tab keeps its session. A plain click and Enter still select it in
place without a page load. The row's own click handler is unchanged.

The row menu (right-click and ⋯) gets "Open in new tab" (T), just before
Delete; never first, since a menu's first item takes focus when it opens.
Transient sessions keep their button and get no link.

When focus is put back into a row it now goes to its first a[href] or
button, so a keyboard Fork focuses the copy's link, not its archive button.

Closes agegr#1167
@wowayou
wowayou force-pushed the feat/session-open-new-tab branch from e7c0455 to dd5bd92 Compare October 10, 2026 15:58

This branch has not been deployed

No deployments
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.

feat(sessions): open sidebar sessions in a new browser tab

1 participant