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.

fix(canvas): headless start refuses every node of an SSH project, not only flagged ones (#925)

reviewdb5036b3d856
diff --git a/src/renderer/lib/headlessRun.test.ts b/src/renderer/lib/headlessRun.test.ts
index d7fa2cc1c..5add3e336 100644
--- a/src/renderer/lib/headlessRun.test.ts
+++ b/src/renderer/lib/headlessRun.test.ts
@@ -194,6 +194,22 @@ describe('startHeadless', () => {
expect(d.inFlight.size).toBe(0)
})
+ // The node's own flags are not the only evidence: a node of an SSH project that carries neither
+ // `ssh` nor `sshRemoteTmux` (hand-edited JSON, an older writer) is still remote.
+ it('a node with no SSH flags in an SSH project is refused before any claim, save or launch', async () => {
+ const { d, saved } = deps({ outcome: 'delivered', fresh: true })
+ expect(await startHeadless(d, { project: sshProject, node: node() })).toEqual({
+ id: 'n1',
+ started: false,
+ reason: 'remote-unsupported'
+ })
+ expect(d.savePending).not.toHaveBeenCalled()
+ expect(d.launch).not.toHaveBeenCalled()
+ expect(d.markStarting).not.toHaveBeenCalled()
+ expect(saved).toHaveLength(0)
+ expect(d.inFlight.size).toBe(0)
+ })
+
it('an SSH node is refused even while the same id is in flight (no inFlight read or mutation)', async () => {
const { d } = deps({ outcome: 'delivered', fresh: true })
d.inFlight.add('n1')
diff --git a/src/renderer/lib/headlessRun.ts b/src/renderer/lib/headlessRun.ts
index b3b15be1e..752bf3876 100644
--- a/src/renderer/lib/headlessRun.ts
+++ b/src/renderer/lib/headlessRun.ts
@@ -117,7 +117,7 @@ export interface HeadlessStartDeps {
export async function startHeadless(
deps: HeadlessStartDeps,
- input: { project: Pick<Project, 'id' | 'cwd'>; node: CanvasNodeState }
+ input: { project: Pick<Project, 'id' | 'cwd' | 'ssh'>; node: CanvasNodeState }
): Promise<HeadlessStartOutcome> {
const { node, project } = input
const id = node.id
@@ -125,8 +125,12 @@ export async function startHeadless(
if (!original?.command) return { id, started: false, reason: 'nothing-queued' }
// A remote node is NEVER spawned locally. The launcher only spawns locally, so refuse before
// touching anything (the primary fence): the untouched pending launch starts on view, over SSH.
- // `headlessPtyOptions` also sets `requireRemote` for an SSH-project node, core's belt behind this.
- if (node.ssh || node.sshRemoteTmux) return { id, started: false, reason: 'remote-unsupported' }
+ // The project is asked too, not only the node's flags: a node of an SSH project that carries
+ // neither flag is still remote. `headlessPtyOptions` also sets `requireRemote` for a node with
+ // `sshRemoteTmux`, core's belt behind this.
+ if (project.ssh || node.ssh || node.sshRemoteTmux) {
+ return { id, started: false, reason: 'remote-unsupported' }
+ }
if (deps.inFlight.has(id)) return { id, started: false, reason: 'already-starting' }
deps.inFlight.add(id)
try {