Skip to content

List other connections' panes in the pane switcher with All servers - #601

Open
thiblahute wants to merge 1 commit into
powerfooI:mainfrom
thiblahute:upstream/other-connections-workspaces
Open

thiblahute wants to merge 1 commit into
powerfooI:mainfrom
thiblahute:upstream/other-connections-workspaces

Conversation

@thiblahute

Copy link
Copy Markdown
Collaborator

Summary

With All servers selected in the workspaces panel, the pane switcher (Ctrl+Tab) and Pane Search (Alt+K) also list the panes of every other ready connection, labelled with their connection. Selecting one switches to that connection and focuses the pane.

Why

The workspaces panel already shows every server's workspaces under All servers, but the switchers only knew the displayed connection's panes (plus agent panes on other servers in search). Reaching a shell or a workspace on another connection meant switching connections by hand first, then finding the pane.

What changed

  • store.ts: while All servers is on, each other ready connection's topology (workspaces, tabs, panes, agents) is kept in its sessionsByConnectionId entry, in the same shape the displayed connection keeps at the top level. Reads follow that connection's Herdr events (one read per 150 ms burst) with the metadata poll as a backstop, run again when a connection becomes ready or reconnects into a new runtime, and stop entirely with Current. A failed read keeps the last known topology with its error instead of blanking it, and a read is only published into the runtime generation it was issued against. jumpToConnectionPane switches connection, waits for its refresh and focuses the pane.
  • api.ts: Bridge.readConnection issues a read-only RPC to a connection other than the active lease. It accepts only workspace.list, tab.list, pane.list and agent.list; every mutating call still goes through connection() and its isCurrent/generation checks.
  • connectionSessions.ts (new): which connections are read, and every connection's topology in catalog order (never active-first, so a switch does not reorder the list under the pointer).
  • paneJump.ts: other connections' panes come after every displayed pane: one per workspace in the recent switcher (the one most recently used there), every pane in search. Entries get a key unique across connections, since pane ids are only unique within one. Search no longer adds the server agent entries of a connection it already lists in full.
  • showAllConnections.ts (new): the All servers choice (same agentListScope storage key as before) as a shared value the tree, the switchers and the store read in the same page.
  • FEATURES.md: the pane switcher and Pane Search sections.

Verification

  • bun test web/src/connectionSessions.test.ts web/src/paneJump.test.ts web/src/store.test.ts web/src/components/WorkspaceTree.servers.test.ts web/src/components/WorkspaceTree.test.ts: 114 pass. New tests cover which connections are read, catalog order, staleness after a reconnect, the store reads (only while All servers is on, events of a replaced runtime ignored, kept on a failed read), and the switcher entries.
  • bun run format:check, bun run lint (only the existing TerminalView.tsx warning), bun run typecheck:bun, bun run build:web.
  • bun run test:quick with an isolated HOME/TMPDIR: the only failures are the two zsh tests (no zsh here), the worktree-removal process-scan timeout, and timeouts under load that pass when rerun alone.

Asset budget

Initial JS goes from 832.3 to 836.8 KiB (254.4 to 257.9 KiB gzipped), so the ceilings move from 833 to 837 KiB and from 257 to 258 KiB gzipped in scripts/check-web-assets.mjs. The store reads and the switcher entries load with the app.

Manual checks

  • Two connections, All servers on: Ctrl+Tab lists the other connection's workspaces after yours; selecting one switches connection and lands on that pane.
  • Alt+K finds a plain shell pane on the other connection by its directory.
  • Switch the scope to Current: only the displayed connection is listed, and no more reads go to the other one.
  • Stop the other connection's Herdr: its panes stay listed until the connection is no longer ready.

Compatibility

No stored format change: the All servers choice keeps its agentListScope key and values.

The workspaces panel already shows every server's workspaces under
All servers, but the pane switcher (Ctrl+Tab) and Pane Search (Alt+K)
only knew the displayed connection's panes, plus agent panes on others
for search. Reaching a shell or a workspace on another connection meant
switching connections first.

While All servers is selected, the store now keeps every other ready
connection's topology (workspaces, tabs, panes, agents) in its
sessionsByConnectionId entry, in the same shape the displayed connection
keeps at the top level. Reads follow each connection's Herdr events
(coalesced to one read per burst), with the metadata poll as a backstop,
and stop entirely when the scope is Current. A failed read keeps the last
known topology with its error rather than blanking it, since it is
usually a transient reconnect, and a read is only published into the
runtime generation it was issued against.

The switcher lists those panes after every displayed pane, labelled with
their connection: one per workspace (the one most recently used there),
every pane in search. Selecting one switches to that connection, waits
for its refresh and focuses the pane. Entries get a key that is unique
across connections, since pane ids are only unique within one.

Reading another connection needs an RPC off the active lease, so
Bridge.readConnection bypasses the single-active-connection guard. It is
limited to workspace.list, tab.list, pane.list and agent.list; mutating
calls keep going through connection() so the isCurrent and generation
checks still apply.

The All servers choice moves into a small shared module so the tree, the
switchers and the store read the same value in the same page. Reading
and listing other connections costs about 4.5 KiB of initial JS (3.5 KiB
gzipped), so the initial JS ceilings move from 833 to 837 KiB, and from
257 to 258 KiB gzipped.
@github-actions github-actions Bot added the enhancement New feature or request label Nov 18, 2026

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

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant