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(control): --run-now goes LAST in either form; run needs verified identity (#925)

review1eb6a39ad611
diff --git a/src/core/canvas-control-core.ts b/src/core/canvas-control-core.ts
index bcd08bd4e..106561136 100644
--- a/src/core/canvas-control-core.ts
+++ b/src/core/canvas-control-core.ts
@@ -433,9 +433,9 @@ export function buildCanvasControlInstructions(shimPath: string): string {
'Verbs:',
'- `list` — current nodes (id, kind, title). Start here when you need a node id.',
'- `help` — print the verb list. Answered by the shim itself, so it works even if the app is down.',
- '- `open-terminal [--count N] [--cwd P] [--cmd C] [--group <id>] [--after <id,id>] [--project <id>]` — open N plain terminals. `--cmd` requires verified node identity.',
- '- `open-claude [--count N] [--cwd P] [--prompt T | --prompt-file F] [--model M] [--group <id>] [--after <id,id>] [--project <id>]` — open N Claude sessions.',
- `- \`open-agent --agent ${agentChoices} [--count N] [--cwd P] [--prompt T | --prompt-file F] [--model M] [--group <id>] [--after <id,id>] [--project <id>]\` — open`,
+ '- `open-terminal [--count N] [--cwd P] [--cmd C] [--group <id>] [--after <id,id>] [--project <id>] [--run-now]` — open N plain terminals. `--cmd` requires verified node identity.',
+ '- `open-claude [--count N] [--cwd P] [--prompt T | --prompt-file F] [--model M] [--group <id>] [--after <id,id>] [--project <id>] [--run-now]` — open N Claude sessions.',
+ `- \`open-agent --agent ${agentChoices} [--count N] [--cwd P] [--prompt T | --prompt-file F] [--model M] [--group <id>] [--after <id,id>] [--project <id>] [--run-now]\` — open`,
' any agent CLI. `--group` parents the node(s) into a group frame; a worktree-bound group also',
' hands its worktree path down as the cwd. `--after <id,id>` opens the node ARMED: it does not',
' start until every listed station has finished a turn SUCCESSFULLY. It is',
@@ -452,10 +452,13 @@ export function buildCanvasControlInstructions(shimPath: string): string {
' and do not report the session as started. `--cwd`/`--count`/`--group`/`--after`/`--prompt`',
' all still apply. If your project is CLOSED the node is still saved into it and the reply',
' says the project is closed; the tab is not reopened for you.',
- ' Add `--run-now` (put it LAST on the line, or write `--run-now=1`) to start a cold-opened',
- ' session immediately instead: it starts headless while the user stays where they are, the',
- ' reply reports `started: true` with `startedIds`, and a closed project gets its tab restored',
- ' (not switched to), except for an SSH project or when no project is open.',
+ ' Add `--run-now` to start a cold-opened session immediately instead. Put it LAST on the line,',
+ ' in either form (`--run-now` or `--run-now=1`): an older shim can still sit on an SSH host (it',
+ ' is rewritten only on connect), and it takes the token after any flag as that flag\'s value,',
+ ' so mid-line either form swallows the flag after it. The session starts headless while the',
+ ' user stays where they are, the reply reports `started: true` with `startedIds`, and a closed',
+ ' project gets its tab restored (not switched to), except for an SSH project or when no',
+ ' project is open.',
' `--run-now` cannot be combined with `--after`. A start that could not be delivered still',
' reports `queued` with a `reason`, and the node keeps its Run now button.',
' `--project <id>` opens the node(s) in another',
@@ -561,7 +564,7 @@ export function buildCanvasControlInstructions(shimPath: string): string {
' `reason`. `remote-unsupported` is an SSH project\'s node while that project is not on screen:',
' its launch is left exactly as it was, so a plain queued launch starts when the user views the',
' project, and an armed or failed one still needs its wait or Run now.',
- ' A node with nothing queued is refused.',
+ ' A node with nothing queued is refused. `run` requires verified node identity.',
`- \`color --node <id,id> --color C\` — recolor nodes, frames, or stickies. C is a palette NAME`,
` or its hex: ${nodeColorChoices()}. The agent names paint a node its CLI's own brand color.`,
'- `write --node <id> --text "..."` / `close --node <id,id>` — type into / close nodes.',
@@ -914,9 +917,9 @@ Verbs:
not seven. It clears itself the moment that station completes another turn.
- \`help\` — print the verb list. The shim answers this itself, without reaching the app, so it
is also what to run when you are unsure whether the control endpoint is alive.
-- \`open-terminal [--count N] [--cwd P] [--cmd C] [--group <id>] [--after <id,id>] [--project <id>]\` — open N plain terminals (default 1). \`--cmd\` requires verified node identity.
-- \`open-claude [--count N] [--cwd P] [--prompt T | --prompt-file F] [--model M] [--group <id>] [--after <id,id>] [--project <id>]\` — open N Claude sessions (default 1).
-- \`open-agent --agent ${agentChoices} [--count N] [--cwd P] [--prompt T | --prompt-file F] [--model M] [--group <id>] [--after <id,id>] [--project <id>]\` — open N sessions of any agent CLI.
+- \`open-terminal [--count N] [--cwd P] [--cmd C] [--group <id>] [--after <id,id>] [--project <id>] [--run-now]\` — open N plain terminals (default 1). \`--cmd\` requires verified node identity.
+- \`open-claude [--count N] [--cwd P] [--prompt T | --prompt-file F] [--model M] [--group <id>] [--after <id,id>] [--project <id>] [--run-now]\` — open N Claude sessions (default 1).
+- \`open-agent --agent ${agentChoices} [--count N] [--cwd P] [--prompt T | --prompt-file F] [--model M] [--group <id>] [--after <id,id>] [--project <id>] [--run-now]\` — open N sessions of any agent CLI.
\`--group\` parents the node(s) into an existing group frame; a worktree-bound group also
hands its worktree path down as the cwd.
\`--after <id,id>\` opens the node **armed**: it does NOT start yet, and launches itself once
@@ -947,12 +950,14 @@ Verbs:
**closed**, the node is still saved into it and the reply says so; the tab is not reopened for
you. So: opening a station is safe to do at any time, but a station you opened while the user was
elsewhere is not running yet — read \`queued\` before you route work to it.
- Add \`--run-now\` (put it LAST on the line, or write \`--run-now=1\`) to start a cold-opened
- session immediately instead: it starts headless while the user stays where they are, the reply
- reports \`started: true\` with \`startedIds\`, and a closed project gets its tab restored (not
- switched to), except for an SSH project or when no project is open. \`--run-now\` cannot be
- combined with \`--after\`. A start that could not be delivered still reports \`queued\` with a
- \`reason\`, and the node keeps its Run now button.
+ Add \`--run-now\` to start a cold-opened session immediately instead. Put it LAST on the line,
+ in either form (\`--run-now\` or \`--run-now=1\`): an older shim can still sit on an SSH host (it
+ is rewritten only on connect), and it takes the token after any flag as that flag's value, so
+ mid-line either form swallows the flag after it. The session starts headless while the user
+ stays where they are, the reply reports \`started: true\` with \`startedIds\`, and a closed
+ project gets its tab restored (not switched to), except for an SSH project or when no
+ project is open. \`--run-now\` cannot be combined with \`--after\`. A start that could not be
+ delivered still reports \`queued\` with a \`reason\`, and the node keeps its Run now button.
**The reply reports launch delivery, not agent health.** \`queued\` is true — and
\`queuedIds\` names which of the returned ids — while launch delivery is pending: waiting for its PTY, or on
\`--after\`, on a worktree's setup script, or on a project the user has not viewed yet (a
@@ -1093,6 +1098,7 @@ Verbs:
\`remote-unsupported\` is an SSH project's node while that project is not on screen: its launch
is left exactly as it was, so a plain queued launch starts when the user views the project, and
an armed or failed one still needs its wait or Run now. A node with nothing queued is refused.
+ \`run\` requires verified node identity.
- \`color --node <id,id> --color C\` — recolor nodes, frames, or stickies. C is a palette NAME or
its hex (either is accepted, and the hex is case-insensitive): ${nodeColorChoices()}.
The agent names are that CLI's own brand color — \`--color claude\` paints a node the color a
diff --git a/src/main/canvas-control-core.test.ts b/src/main/canvas-control-core.test.ts
index 14071d91e..13a73a93d 100644
--- a/src/main/canvas-control-core.test.ts
+++ b/src/main/canvas-control-core.test.ts
@@ -112,6 +112,40 @@ describe('parseControlRequest', () => {
}
})
+ // The `=1` form is NOT position-free: the pre-2026-08-15 shim loop (still on an SSH host that has
+ // not reconnected) takes the token after any `--flag` as its value, so `--run-now=1 --agent claude`
+ // becomes `arg.run-now=1=--agent` and loses `--agent`. Last on the line works in either form
+ // there (control-shim-parse.test.ts runs that old loop). The old text offered `=1` as an
+ // alternative to "last", which is the claim that broke.
+ it('both bodies say --run-now goes LAST in either form, and why (#925 final review)', () => {
+ for (const [name, body] of [
+ ['skill', buildCanvasSkillBody('/x/shim.sh')],
+ ['instructions', buildCanvasControlInstructions('/x/shim.sh')]
+ ] as const) {
+ expect(body, name).toMatch(/Put it LAST on the line,\s+in either form \(`--run-now` or `--run-now=1`\)/)
+ expect(body, name).toMatch(/older shim can still sit on an SSH host/)
+ expect(body, name).toMatch(/mid-line either form\s+swallows the flag after it/)
+ expect(body, name).not.toMatch(/or write `--run-now=1`/)
+ }
+ })
+
+ it('both bodies list [--run-now] on every open verb and say run needs verified identity (#925 final review)', () => {
+ for (const [name, body] of [
+ ['skill', buildCanvasSkillBody('/x/shim.sh')],
+ ['instructions', buildCanvasControlInstructions('/x/shim.sh')]
+ ] as const) {
+ for (const verb of ['open-terminal', 'open-claude', 'open-agent']) {
+ // The verb's signature line: the first line naming it, the same finder the --project
+ // walker below uses.
+ const line = body.split('\n').find((l) => l.includes(`\`${verb} `))
+ expect(line, `${name}: ${verb} signature`).toContain('[--run-now]')
+ }
+ // `run` joined requiresVerified: a legacy-token caller is refused ('Run refused.').
+ const entry = body.slice(body.indexOf('- `run --node'), body.indexOf('- `color --node'))
+ expect(entry, name).toMatch(/`run` requires verified node\s+identity/)
+ }
+ })
+
it('both bodies state the run / --run-now edges the implementation actually has (#925)', () => {
for (const [name, body] of [
['skill', buildCanvasSkillBody('/x/shim.sh')],
diff --git a/src/main/control-shim-parse.test.ts b/src/main/control-shim-parse.test.ts
index a7574bd07..568f5a2c1 100644
--- a/src/main/control-shim-parse.test.ts
+++ b/src/main/control-shim-parse.test.ts
@@ -15,6 +15,7 @@ import fs from 'node:fs'
import os from 'node:os'
import path from 'node:path'
import { CONTROL_SHIM_SCRIPT } from '../core/canvas-control-core'
+import { runNowRequested } from '../shared/control-verbs'
let dir = ''
@@ -103,6 +104,53 @@ describe('the control shim translates flags', () => {
])
})
+ // The agent docs say "put --run-now LAST on the line (either form)", and this is the measurement
+ // behind it. The loop below is the shim's `--*` branch as it shipped BEFORE b7f19f64
+ // (2026-08-15), copied verbatim: it took the token after any `--flag` as that flag's value and
+ // had no `--*=*` branch. An SSH host keeps whatever shim it got at its last connect, so this
+ // loop can still be what an agent there runs. Executed under real `sh`, not modelled.
+ it('on the pre-2026-08-15 shim loop --run-now survives only LAST on the line, in either form (#925)', () => {
+ const oldLoop = [
+ 'nt_count=$#',
+ 'nt_i=0',
+ 'while [ "$nt_i" -lt "$nt_count" ]; do',
+ ' nt_a="$1"; shift; nt_i=$((nt_i + 1))',
+ ' case "$nt_a" in',
+ ' --*)',
+ ' nt_k=${nt_a#--}',
+ ' nt_v=""',
+ ' if [ "$nt_i" -lt "$nt_count" ]; then nt_v="$1"; shift; nt_i=$((nt_i + 1)); fi',
+ ' set -- "$@" --data-urlencode "arg.$nt_k=$nt_v"',
+ ' ;;',
+ ' esac',
+ 'done',
+ 'for a in "$@"; do case "$a" in arg.*) printf \'%s\\n\' "$a" ;; esac; done'
+ ].join('\n')
+ // What the server reads: curl's `--data-urlencode name=content` splits on the FIRST `=`.
+ const oldShim = (flags: string[]): Record<string, string> =>
+ Object.fromEntries(
+ execFileSync('sh', ['-c', oldLoop, 'sh', ...flags], { encoding: 'utf8' })
+ .split('\n')
+ .filter(Boolean)
+ .map((pair) => {
+ const at = pair.indexOf('=')
+ return [pair.slice('arg.'.length, at), pair.slice(at + 1)]
+ })
+ )
+ // Last on the line: both forms are on, and nothing is lost.
+ for (const last of ['--run-now', '--run-now=1']) {
+ const args = oldShim(['--agent', 'claude', '--project', 'p2', last])
+ expect(runNowRequested(args), last).toBe(true)
+ expect(args.agent, last).toBe('claude')
+ expect(args.project, last).toBe('p2')
+ }
+ // Mid-line: either form swallows the next flag, and its value is dropped as a stray positional.
+ for (const mid of ['--run-now', '--run-now=1']) {
+ const args = oldShim([mid, '--agent', 'claude'])
+ expect(args.agent, mid).toBeUndefined()
+ }
+ })
+
it('run takes its node positionally, like rename (#925)', () => {
expect(run(['run', 'n7'])).toEqual(['arg.node=n7'])
})