Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

docs: say exactly what the card modal and the offline relay session keep off this machine

review4d04a05af3ba
diff --git a/CLAUDE.md b/CLAUDE.md
index e59a6b60c..70c4876dd 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -574,29 +574,44 @@ project's nodes only.** The contract:
layers besides the keying above:
(1) `sessionForProject` resolves a REMOTE project (`remote` in the store, or bound while remote in
this run) with no live binding to the OFFLINE relay session (`OFFLINE_RELAY_SESSION_ID`,
- `session/offline-relay-session.ts`: `source 'relay'`, `status 'offline'`, every core call
- rejects), never the local one. Lifecycle code asking "which session is bound to this tab?" (dispose
- it, reconnect it) asks `boundSessionForProject`, which never answers the sentinel.
+ `session/offline-relay-session.ts`: `source 'relay'`, `status 'offline'`), never the local one.
+ Its core-bound calls (pty, fs, git, workspace, …) reject, so no terminal can be created here; it
+ is not a wall around this machine, since its api spreads `...local` like a live relay tab's (the
+ local namespaces — contextLink, transcripts, handoff, media — still act here, and its `boardLog`
+ read answers `unsupported`). "Is this project remote?" is ONE predicate, `isRemoteProjectId`
+ (session.ts), shared by this resolution and the spawn refusal in (3). Lifecycle code asking "which
+ session is bound to this tab?" (dispose it, reconnect it) asks `boundSessionForProject`, which
+ never answers the sentinel.
(2) A surface that mounts a project's node OUTSIDE Canvas's node subtree runs under that project's
session. Both kanban boards render under App's LOCAL provider, so each mounts its card modal
through `ProjectSessionScope` (`session/owning-project.ts`: `sessionForProject(<card's project>)`,
keyed by session id, plus `OwningProjectContext`). Before it, opening a team tab's terminal card
- created the host's node id on this desktop every time. Nothing under the modal reads or writes
- this machine's core for the host's node any more: the terminal runs under the card project's
- session, the comments panel and the card metadata key the board log on the card's project
- (`useOwningProjectId() ?? activeProjectId` — on the Omni board a lane is not the active project,
- and pairing the lane's api with the active id blanked its comments and saved new ones nowhere), a
- relay card's file links are switched off (`cardFileLinkRoute`) and its ⌘M chat is refused
- (`stub.chat`, `E_UNSUPPORTED`). The session is resolved at render, so a reconnect while a modal is
- open takes effect at the board's next render.
- (3) TerminalNode and ModalTerminal ask `spawnBelongsElsewhere(project, session.source)` (the
- project from `OwningProjectContext`) before any SSH resolve or create: a remote project under a
+ created the host's node id on this desktop every time. The terminal, the comments, the metadata
+ strip and the pull-request panel now act on the card's project (`useOwningProjectId() ??
+ activeProjectId`): the terminal runs under the card project's session, the comments panel reads
+ and writes that project's board log, the metadata strip's member pool reads it, and the
+ pull-request panel reads that project's pull requests, SSH flag and auto-move target. On the Omni
+ board a lane is not the active project: pairing the lane's api with the active id blanked a relay
+ lane's comments and saved new ones nowhere, and on a local lane filed them into the ACTIVE
+ project's board log. A relay card's file links are switched off (`cardFileLinkRoute`) and its ⌘M
+ chat is refused (`stub.chat`, `E_UNSUPPORTED`). **Known exceptions (pre-existing, follow-up):** the
+ icon picker (`NodeIconPicker.chooseImage` resolves the ACTIVE project, so a team lane's card
+ opened while a local project is active copies the picked image into the local project's
+ `.nodeterm/images/`), and dictation and file-drop uploads in a relay card, which act on this
+ machine. The session is resolved at render, so a reconnect while a modal is open takes effect at
+ the board's next render.
+ (3) TerminalNode and ModalTerminal ask `spawnBelongsElsewhere(isRemoteProjectId(owner),
+ session.source)` (`owner` from `OwningProjectContext`; the predicate is the one (1) uses, so a tab
+ the store deleted still counts) before any SSH resolve or create: a remote project under a
non-relay session starts nothing and writes a gray "belongs to a remote project that is not
connected here" line. ModalTerminal mirrors TerminalNode's `dialsSsh` (a relay card's SSH-project
node is joined by the HOST with `requireRemote`; this machine dials, refuses and reports nothing
for it), and a non-dialing node's `ownerProjectId` is the owning project, else the active one.
- `components/kanban/cardModalSession.test.tsx` renders both boards' modals under real sessions;
- `session/offline-relay-session.test.ts` replays the switches.
+ `components/kanban/cardModalSession.test.tsx` renders both boards with real sessions and a probe
+ in place of CardModal, asserting which session and owning project each modal mount gets, plus
+ source pins for the two terminals; `components/kanban/boardLogPanelSession.test.tsx` and
+ `cardOwnerProject.test.tsx` render the real comments panel, metadata strip and pull-request panel
+ under a lane's `ProjectSessionScope`; `session/offline-relay-session.test.ts` replays the switches.
- Switching away unmounts the old project's `TerminalNode`s → their tmux clients detach but
the sessions keep running; switching back reattaches. tmux session names are per-node-id
(globally unique), so projects never collide.
@@ -9896,7 +9911,8 @@ under one `$HOME`, with different bytes; the last writer wins.
`context:update` metadata (deploy one core per team); a viewer's socket backlog over 1 MB still
pauses the shared pty through Stage 2 backpressure; the canvas authority's own limits (a project's
non-content fields stay last writer wins between tabs, the share-time window, oversized nodes, board
-edits to another core, load-time repairs that are never cast) are under "Known limits" in the doc.
+edits to another core, load-time repairs that are never cast, the GitHub issue summary modal's
+"Agent runs" log on a relay tab) are under "Known limits" in the doc.
**Surfaces:** Desktop is full (joiner, plus approval and invite code in an owner's hosted tab, plus
Share with team from any desktop OS onto a Linux host). Server Edition is the host (the `team` CLI,
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 3af65a498..11d456828 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -661,7 +661,9 @@ anything else. Board-level fields survive every transform — `pullLinks` is one
- A surface that mounts a terminal outside the canvas (the kanban card modal — both boards live
under App's LOCAL provider) runs under `sessionForProject(<its project>)` and provides
`OwningProjectContext`: wrap it in `ProjectSessionScope` (`session/owning-project.ts`). A new
- terminal-creating path also asks `spawnBelongsElsewhere` before its first create. A component
+ terminal-creating path also asks `spawnBelongsElsewhere(isRemoteProjectId(<owning project>),
+ session.source)` before its first create; ask `isRemoteProjectId` (session.ts), never
+ `getProject(id)?.remote`, which misses a tab the store deleted. A component
under it that keys data by project (the board log, card metadata, pull requests) reads
`useOwningProjectId() ?? activeProjectId`, never `activeProjectId` alone: on the Omni board the
card's project is not the active one, and its `useSession()` api answers for the card's project.
diff --git a/docs/hosted-team-relay.md b/docs/hosted-team-relay.md
index faf7e7351..c8edf8c03 100644
--- a/docs/hosted-team-relay.md
+++ b/docs/hosted-team-relay.md
@@ -798,6 +798,11 @@ it is a new way to use it.
client's baseline and is never cast, so on a governed project it never reaches disk: every load
derives it again. The repairs are deterministic, so this costs nothing visible, but a repair that
must persist on a shared project has to be cast.
+- **The issue summary modal's "Agent runs" on a relay tab** (`GitHubIssueSummaryModal` →
+ `BoardLogPanel`) still pairs the LOCAL api with the relay project's id: `KanbanView` renders under
+ App's local provider, and unlike the card modal this modal is not wrapped in
+ `ProjectSessionScope`, so the history is read from this machine's core, not the host's. It is
+ pre-existing; a follow-up.
## Status and troubleshooting
diff --git a/src/renderer/lib/hostedTeamTabs.ts b/src/renderer/lib/hostedTeamTabs.ts
index 2732470aa..0c10ef825 100644
--- a/src/renderer/lib/hostedTeamTabs.ts
+++ b/src/renderer/lib/hostedTeamTabs.ts
@@ -215,8 +215,8 @@ export function createTeamTabs(ops: TeamTabOps): TeamTabs {
try {
ops.bind(id, t.sessionId)
} catch (error) {
- // The session was disposed while the workspace loaded; an unbound tab would resolve to the
- // local session.
+ // The session was disposed while the workspace loaded. An unbound tab would resolve to the
+ // offline relay session: a dead tab with no session behind it, so it is dropped instead.
ops.removeTab(id, host)
failure = { error }
sessionGone = true
diff --git a/src/renderer/nodes/DinoNode.tsx b/src/renderer/nodes/DinoNode.tsx
index efc5b87e7..869c8b5e8 100644
--- a/src/renderer/nodes/DinoNode.tsx
+++ b/src/renderer/nodes/DinoNode.tsx
@@ -32,9 +32,13 @@ export function DinoNode({ id, data, selected }: NodeProps<CanvasNode>) {
// The active project's presence. DinoNode renders under the SessionProvider Canvas keys on the
// session of the project React Flow's STORE holds (`useFlowStoreOwner`, Canvas.tsx), so this node
- // REMOUNTS on a session swap — once the store holds the incoming project, which by then is also the
- // active one. The mount-time `presence` capture below is therefore the current session's, no ref
- // needed.
+ // REMOUNTS on a session swap — once the store holds the incoming project, which is usually also the
+ // active one, so the mount-time `presence` capture below is the node's own session's. Not always:
+ // when the last team tab closes the welcome screen sets the active project to null while the store
+ // still holds the team project's nodes, and in a rapid A→B→C switch the store can hold B while C
+ // is active. Then this node's `useSession()` and this presence (the active project's) can point at
+ // different cores. Negligible today (those nodes cannot be focused or played: the welcome screen
+ // covers them, B's nodes unmount once C lands); reading the node's own presence is a follow-up.
const presence = useActiveSessionPresence()
// The peer (if any) broadcasting a live dino for THIS node, and our own id for the tiebreak.
// selectDino excludes self and already applies the lowest-clientId rule, so `peer` is the one
diff --git a/src/renderer/session/offline-relay-session.ts b/src/renderer/session/offline-relay-session.ts
index 7bf640181..7e617ecc4 100644
--- a/src/renderer/session/offline-relay-session.ts
+++ b/src/renderer/session/offline-relay-session.ts
@@ -32,8 +32,11 @@ export function deadRelayTransport(): FrameTransport {
/**
* The api of the offline relay session an unbound REMOTE project resolves to (session.ts,
* `sessionForProject`). It is a real relay api — the same core-bound / local split a live relay tab
- * has — over a dead carrier, so everything core-bound (pty, fs, git, workspace, files, …) rejects and
- * nothing a node mounts can reach THIS machine's core under a node id that lives on another machine.
+ * has — over a dead carrier, so every core-bound call (pty, fs, git, workspace, files, …) rejects:
+ * no terminal can be created on THIS machine's core under a node id that lives on another machine.
+ * It is not a wall around this machine: like a live relay tab's api it spreads `...local`, so the
+ * namespaces a relay tab keeps local (contextLink, transcripts, handoff, media, the app-global ones)
+ * still act here, and its `boardLog` read answers `unsupported: true` rather than rejecting.
* Built here rather than in session.ts because relay-api imports session.ts.
*/
export function offlineRelayApi(): NodeTerminalApi {
diff --git a/src/renderer/session/relay-tab.ts b/src/renderer/session/relay-tab.ts
index 8df9b17bd..5912e22b8 100644
--- a/src/renderer/session/relay-tab.ts
+++ b/src/renderer/session/relay-tab.ts
@@ -237,8 +237,12 @@ export interface RelayReconnectDeps {
*
* The stale offline session is NOT torn down here: `mount` disposes it only once the fresh session
* has rebound the project (see Canvas `mountRemoteMirror`). Disposing it up-front would unbind the
- * project, so a connect failure or a declined SAS would strand the tab resolved to the LOCAL
- * session — greyed but no longer recognised as relay, hence no longer reconnectable. */
+ * project before anything replaced the binding, so a connect failure or a declined SAS would leave
+ * the tab with no session of its own. It would still be reconnectable (an unbound remote tab
+ * resolves to the offline relay session, a relay source), but its own session (label, status
+ * stores) would be gone and `boundSessionForProject` would find nothing for the next reconnect to
+ * hand over. Keeping the binding until the fresh one lands leaves a failed reconnect exactly where
+ * it started. */
export async function reconnectRelayTab(projectId: string, deps: RelayReconnectDeps): Promise<void> {
const offer = (await deps.promptForOffer())?.trim()
if (!offer) return