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.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
fix(ssh): agents opened from an SSH project's history or a transfer run on the host
Brandon Bridges6e42ea287fca
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsxindex 869247831..05fc0175e 100644--- a/src/renderer/canvas/Canvas.tsx+++ b/src/renderer/canvas/Canvas.tsx@@ -6196,7 +6196,11 @@ export function Canvas() {scmCwd(scopeCwd),viewCenter(),prompt,- undefined,+ // An SSH project's agent runs on the HOST, like the history it explains. Without the+ // binding the node was local, rooted at a remote path that does not exist here, so the+ // pty fell back to $HOME and `git show` ran outside any checkout. The scope is always+ // the project's own in an SSH project (no worktrees), so the root is the right cwd.+ nodeSshFor(project?.ssh),account,activePermissionMode(),// The owning project, for its own `.nodeterm/settings.json` launch command — the same@@ -9324,7 +9328,10 @@ export function Canvas() {source.data.cwd,undefined,prompt,- source.data.sshRemoteTmux ? projectSsh : undefined,+ // `nodeSshFor`, not the project's binding as-is: the factory reads a remote node's cwd out+ // of `remoteCwd`, so passing `projectSsh` unchanged moved a source running in a subfolder+ // of the project (canvas-control `--cwd`) back to the project root.+ source.data.sshRemoteTmux ? nodeSshFor(projectSsh, source.data.cwd) : undefined,// Inherit the source's Claude account (dropped by the factory unless the target is claude),// so a claude→claude transfer resumes the transcript from the right account dir.source.data.accountId,diff --git a/src/renderer/canvas/ssh-node-binding.source.test.ts b/src/renderer/canvas/ssh-node-binding.source.test.tsnew file mode 100644index 000000000..3866c16b1--- /dev/null+++ b/src/renderer/canvas/ssh-node-binding.source.test.ts@@ -0,0 +1,41 @@+import { describe, it, expect } from 'vitest'+import { readFileSync } from 'node:fs'++/**+ * STRUCTURAL pins for two agent-node funnels in an SSH project — the same class of test as+ * `control-cold-open.source.test.ts`: both live inside Canvas.tsx callbacks with no unit seam, and+ * what they must be pinned on is which `ssh` argument they hand `createAgentNode`. The behavioural+ * half (a `nodeSshFor` binding yields a remote-tmux node rooted at the given cwd) is proven against+ * the real factory in `state/workspace.test.ts` → `nodeSshFor`.+ *+ * THE BUGS (both the shapes `nodeSshFor`'s doc warns about):+ * - Source Control → commit → "Explain changes with AI" passed NO binding, so in an SSH project the+ * agent opened on this machine in the host's path: the pty fell back to $HOME and `git show` ran+ * outside any checkout.+ * - Transfer to agent passed the project's binding UNCHANGED, so a source running in a subfolder+ * (canvas-control `--cwd`) handed off to an agent rooted at the project's `remoteCwd`.+ */+const src = readFileSync(new URL('./Canvas.tsx', import.meta.url), 'utf8').replace(/\r\n/g, '\n')++/** One `useCallback` body: from `const <name> = useCallback(` to the next top-level callback. */+function callbackBody(name: string): string {+ const start = src.indexOf(`const ${name} = useCallback(`)+ expect(start, name).toBeGreaterThan(-1)+ const end = src.indexOf('\n const ', start + 1)+ expect(end, `the declaration after ${name}`).toBeGreaterThan(start)+ return src.slice(start, end)+}++describe('agent nodes opened from an SSH project run on its host (source pins)', () => {+ it('Explain changes with AI binds the node to the project host', () => {+ const body = callbackBody('explainCommit')+ expect(body).toContain('createAgentNode(')+ expect(body).toContain('nodeSshFor(project?.ssh)')+ })++ it("Transfer to agent keeps the source's remote cwd", () => {+ const body = callbackBody('transferConversation')+ expect(body).toContain('nodeSshFor(projectSsh, source.data.cwd)')+ expect(body).not.toMatch(/sshRemoteTmux \? projectSsh :/)+ })+})