Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

Merge origin/main into feat/harness-grid

Kelvinbf801ac24129
diff --cc backend/src/server.ts
index 6c07eedf3,a344d3fa7..917074d44
--- a/backend/src/server.ts
+++ b/backend/src/server.ts
@@@ -10,7 -10,7 +10,7 @@@ import { registerAuthMiddleware } from
import { cursorRoutes } from './routes/cursor.js'
import { voiceRoutes } from './routes/voice.js'
import { deviceAuthRoutes } from './routes/deviceAuth.js'
- import { healthRoutes, authRoutes, userRoutes, machineRoutes, planRoutes, gridRoutes, deviceRoutes, mobileRoutes, appRoutes, analyticsRoutes, agentRouteRoutes } from './routes/index.js'
-import { healthRoutes, authRoutes, userRoutes, machineRoutes, planRoutes, deviceRoutes, mobileRoutes, appRoutes, analyticsRoutes, agentRouteRoutes, storeRoutes } from './routes/index.js'
++import { healthRoutes, authRoutes, userRoutes, machineRoutes, planRoutes, gridRoutes, deviceRoutes, mobileRoutes, appRoutes, analyticsRoutes, agentRouteRoutes, storeRoutes } from './routes/index.js'
import { startSubdomainProxy, startMeshProxy } from './lib/subdomainProxy.js'
import { handleDeviceUpgrade } from './lib/deviceWs.js'
import { handleWebUpgrade } from './lib/webWs.js'
diff --cc cli/src/backendSocket.spec.ts
index 2a50dec1d,70703e10d..7068e0503
--- a/cli/src/backendSocket.spec.ts
+++ b/cli/src/backendSocket.spec.ts
@@@ -10,9 -10,8 +10,10 @@@ import { registry, type RegisteredSessi
import * as mediaPreview from './lib/mediaPreview.js'
import * as projectFolder from './lib/projectFolder.js'
import * as projectPreview from './lib/projectPreview.js'
+ import * as storeCatalog from './dsh/catalog.js'
import { randomUUID } from 'node:crypto'
+import { fakeGridAnswers, installFakeGrid, type FakeGrid } from './lib/__fixtures__/fakeGrid.js'
+import { clearGridMcpUrlCache } from './lib/gridMcpUrl.js'
const wsMock = vi.hoisted(() => {
const instances: MockWebSocket[] = []
diff --cc cli/src/cli.ts
index 735294940,61ee2c605..ea5363f51
--- a/cli/src/cli.ts
+++ b/cli/src/cli.ts
@@@ -588,11 -537,14 +591,14 @@@ async function loginCommand
}
throw err
}
- return succeed(true)
+ return await succeed(true)
}
// A forced login may intentionally switch SSO accounts. The old daemon must not keep streaming
- // under its existing socket while this process replaces the durable session.
- if (force) await stopDaemonProcess()
+ // under its existing socket while this process replaces the durable session. A daemon running
+ // WITHOUT a session holds no account to switch away from, and stopping it here would take every
+ // local terminal down for as long as the person is in the browser — it is swapped afterwards
+ // instead (restartDaemonForIdentity), once there is an identity to swap to.
+ if (force && readAuthSession()) await stopDaemonProcess()
const callback = createServer()
await new Promise<void>((resolve, reject) => {
callback.once('error', reject)
@@@ -1026,19 -979,23 +1040,26 @@@ async function updateCommand(force: boo
async function logout(): Promise<void> {
// Through the lock-taking stop, not an inline kill: a logout that lands mid-handoff would otherwise
// SIGTERM the OLD daemon, leave the new one coming up, and then delete the session under it.
- await stopDaemonProcess()
+ const { stopped } = await stopDaemonProcess()
+ // Before clearAuthSession: see the note above on serve children. Its exit code is deliberately
+ // dropped — this command cannot fail — and its own words have already reached the terminal.
+ const gridOut = await passThroughToGridLogout([])
clearAuthSession()
rmSync(MACHINE_NAME_FILE, { force: true })
// Same reason as the name above: the cached machine list describes the account that just left, and the
// local `/api/machines` fallback would otherwise hand it to whoever signs in next on this computer.
rmSync(machineListCachePath(), { force: true })
- console.log('Signed out. Run `harness login`, then `harness start`, to reconnect this computer.')
- // Existence is the whole of the test — nothing is read out of the store, and nothing is written
- // into it. On stderr, so a script reading this command's output is unaffected by it.
- warnIfGridSignInRemains()
+ // Only when there was no `grid` to run at all. A child that ran has already said what it did, and
+ // repeating "your grid sign-in is still here" after a successful sign-out would be false.
+ if (!gridOut.ran) warnIfGridSignInRemains()
+ // A daemon that was up comes back signed out. Signing out is leaving the account, not stopping the
+ // agents on this computer — the desktop window is still open on them, and the dial is still plugged in.
+ if (stopped) {
+ console.log('Signed out. Restarting the daemon for this computer only…')
+ await launch(false) // prints the guest status block and exits
+ return
+ }
+ console.log('Signed out. Run `harness start` to serve this computer; `harness login` to reach other machines.')
process.exit(0)
}
@@@ -3948,13 -3952,8 +4050,13 @@@ async function runForeground(session: A
// only `invalid x-api-key`. Nothing is cleared when no grid is in play: an agent on its own login
// is supposed to use exactly these variables.
const clearEnv = gridLaunch ? gridConflictingEnvToClear(gridLaunch) : undefined
- const extraArgs = [...(gridLaunch?.args ?? []), ...dshArgs]
- const launchOptions = { bypassPermission, extraArgs: extraArgs.length ? extraArgs : undefined, installIfMissing, clearEnv, cwd, harnessNode: dsh ? true : undefined }
+ // The named agent takes the same argv slot on every relaunch (`buildLaunchOverrides` appends it
+ // from the row's `agent`, after the grid's and the DSH's argv, exactly as here). The engine was
+ // checked for a contract at the wire (AGENT_UNSUPPORTED), so this cannot throw.
+ const extraArgs = [...(gridLaunch?.args ?? []), ...dshArgs, ...(agent ? namedAgentArgs(engine, agent) : [])]
+ // The first prompt is a launch option only — never part of `extraArgs`, which the registry row
+ // carries into a relaunch (engineLaunch.ts, `firstPrompt`).
- const launchOptions = { bypassPermission, extraArgs: extraArgs.length ? extraArgs : undefined, installIfMissing, clearEnv, cwd, ...(prompt ? { firstPrompt: prompt } : {}) }
++ const launchOptions = { bypassPermission, extraArgs: extraArgs.length ? extraArgs : undefined, installIfMissing, clearEnv, cwd, harnessNode: dsh ? true : undefined, ...(prompt ? { firstPrompt: prompt } : {}) }
const command = buildEngineCommandArgv(engine, launchOptions)
const argv = buildEngineLaunchArgv(engine, launchOptions)
// A tmux route is enough to stream its screen. Register it before looking for a process so both
@@@ -5809,7 -5733,7 +5933,10 @@@ switch (cmd)
pairingsCommand().catch(onError)
break
case 'grid':
-- if (args[0] === 'login') gridLoginCommand(flags.includes('--force'), flags.includes('--json')).catch(onError)
++ // Same swap as `harness login` (see that case): a daemon that booted signed out must come back
++ // on the account's machineId once this sign-in has one. Its result line has already gone out;
++ // a refused sign-in leaves the session as it was, and the swap is then a no-op.
++ if (args[0] === 'login') gridLoginCommand(flags.includes('--force'), flags.includes('--json')).then(() => restartDaemonForIdentity()).catch(onError)
// Everything but the verb, in the order it was typed — a passthrough that allow-listed flags
// would be a second place that has to know what `grid logout` accepts. Only the FIRST `logout`
// token goes: filtering by value instead would eat an option's *value* the day `grid logout`
diff --cc cli/src/cliCommand.spec.ts
index 268bfdd4c,972ad4784..1868a9223
--- a/cli/src/cliCommand.spec.ts
+++ b/cli/src/cliCommand.spec.ts
@@@ -31,16 -62,25 +62,27 @@@ function run(args: string[], opts: { en
}
describe('CLI login/start command contract', () => {
- it('does not start or open SSO when start has no saved session', () => {
- const result = run('start')
-
- expect(result.status).toBe(1)
- expect(result.stderr).toContain('Not signed in. Run: harness login')
- expect(result.stdout).not.toContain('Sign in to Harness in your browser')
- })
+ it('starts without a saved session, serving this computer only, and never opens SSO', async () => {
+ // The account buys the other machines; everything on THIS computer is served from the daemon over
+ // the loopback, so a missing session is not a reason to refuse. A dev-mode start runs the daemon in
+ // the foreground, so this holds it on a port of its own until it has said what it is doing, then
+ // kills the whole process group (tsx wraps the daemon in a child of its own).
+ const port = String(20_000 + Math.floor(Math.random() * 20_000))
+ const { child, output } = spawnDetached(['start'], { PORT: port, DISABLE_HOOK_INSTALL: '1' })
+ try {
+ const said = await waitFor(output, /serving this computer only|Not signed in|Sign in to Harness/, 20_000)
+ expect(said).toContain('not signed in — serving this computer only')
+ expect(said).not.toContain('Sign in to Harness in your browser')
+ expect(said).not.toContain('dialing') // no backend leg without a session
+ } finally {
+ try { process.kill(-child.pid!, 'SIGKILL') } catch { /* already gone */ }
+ }
- })
++ // The wait above is 20s by design — a dev-mode start transpiles cli.ts and its imports cold, and under
++ // the suite's four workers that alone can pass vitest's 5s default. The case's budget is its wait's.
++ }, 25_000)
it('rejects the removed join command with the two-step migration', () => {
- const result = run('join')
+ const result = run(['join'])
expect(result.status).toBe(1)
expect(result.stderr).toContain('`harness join` has been removed.')
diff --cc cli/src/lib/agentFrame.ts
index b5b6d9b20,45951d2a8..e966a55c4
--- a/cli/src/lib/agentFrame.ts
+++ b/cli/src/lib/agentFrame.ts
@@@ -21,18 -21,9 +21,18 @@@
import { stat } from 'node:fs/promises'
import { agentProject, type AgentProject } from './agentProject.js'
import type { GridAssignment } from './gridAssignment.js'
+import type { GridWebSearchStatus } from './gridLaunch.js'
- import { projectDisplayName, type RegisteredSession } from './registry.js'
+ import { projectDisplayName, type RegisteredSession, titleDisplayName } from './registry.js'
import type { DshVerdict } from '../dsh/verdict.js'
+/**
+ * The grid block on the wire: where the agent's inference goes, and — when the daemon built the
+ * launch — whether it can search the web. `webSearch` is absent, not null, when there is nothing to
+ * say: a discovered grid agent, or a row from before the daemon recorded it. The app shows nothing
+ * for absent and for `on`; the two degraded words each get a sentence.
+ */
+export type GridFrameBlock = GridAssignment & { webSearch?: GridWebSearchStatus }
+
/**
* One agent as it travels to every client.
*
diff --cc cli/src/lib/engineLaunch.spec.ts
index 0af33b51d,ebd7a07dd..d8e10196c
--- a/cli/src/lib/engineLaunch.spec.ts
+++ b/cli/src/lib/engineLaunch.spec.ts
@@@ -1,5 -1,6 +1,6 @@@
-import { afterEach, describe, expect, it } from 'vitest'
+import { afterAll, afterEach, beforeEach, describe, expect, it } from 'vitest'
import { chmodSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'
+ import { execFileSync } from 'node:child_process'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import {
@@@ -13,12 -9,7 +14,13 @@@
buildEngineCommandArgv,
buildEngineLaunchArgv,
commandAvailableInInteractiveShell,
+ firstPromptArgs,
+ gridPanePrelude,
+ harnessNodePrelude,
+ namedAgentArgs,
+ supportsFirstPrompt,
+ supportsNamedAgent,
+ unreadableCwdGuard,
} from './engineLaunch.js'
import { ENGINES } from '../engines/types.js'
import { engineBin } from './engineBin.js'
@@@ -58,115 -37,37 +60,148 @@@ describe('buildEngineLaunchArgv', () =
])
})
+ it('hands the engine a soft open-files limit fit for it, however low the pane started', async () => {
+ // A tmux server started by the desktop app passes launchd's 256 to every pane; Claude Code will
+ // not start under that. The pane's own shell lifts it before exec, so the server never has to.
+ const [shell, flag, paneScript] = buildEngineLaunchArgv('claude', {}, '/bin/sh')
+ const { execFile } = await import('node:child_process')
+ const seenByEngine = await new Promise<string>((resolve, reject) => {
+ execFile(
+ '/bin/sh',
+ ['-c', 'ulimit -S -n 256 || exit 99; exec "$@"', 'pane', shell, flag, paneScript, 'harness-engine', '/bin/sh', '-c', 'ulimit -S -n'],
+ { timeout: 10_000 },
+ (error, stdout, stderr) => (error ? reject(new Error(`${error.message}\n${stderr}`)) : resolve(stdout.trim())),
+ )
+ })
+ expect(seenByEngine).not.toBe('256')
+ expect(seenByEngine === 'unlimited' || Number(seenByEngine) >= Math.min(MIN_OPEN_FILES, 4096)).toBe(true)
+ })
+
+ describe('an unreadable workspace', () => {
+ // Under /bin/sh, with the engine replaced by printf so its run leaves a marker.
+ async function launchInto(dir: string): Promise<{ code: number; stdout: string; stderr: string }> {
+ const [, , paneScript] = buildEngineLaunchArgv('claude', { cwd: dir }, '/bin/sh')
+ const { execFile } = await import('node:child_process')
+ return await new Promise((resolve) => {
+ execFile(
+ '/bin/sh',
+ ['-c', paneScript, 'harness-engine', dir, '/usr/bin/printf', 'ENGINE_RAN\n'],
+ { timeout: 10_000 },
+ (error, stdout, stderr) => {
+ const code = error && typeof (error as { code?: unknown }).code === 'number'
+ ? (error as unknown as { code: number }).code
+ : 0
+ resolve({ code, stdout, stderr })
+ },
+ )
+ })
+ }
+
+ // root reads everything, so the guard has nothing to catch there.
+ const notRoot = process.getuid?.() !== 0
+
+ it.skipIf(!notRoot)('says why and stops instead of letting the engine fail on its first read', async () => {
+ // Enterable but not readable: what macOS privacy settings (TCC) produce for a folder the
+ // responsible app was not granted — `cd` works, the first readdir does not.
+ const dir = mkdtempSync(join(tmpdir(), 'harness-unreadable-'))
+ try {
+ chmodSync(dir, 0o300)
+ const result = await launchInto(dir)
+ expect(result.code).toBe(1)
+ expect(result.stdout).not.toContain('ENGINE_RAN')
+ expect(result.stderr).toContain(`harness: cannot read ${dir}`)
+ } finally {
+ chmodSync(dir, 0o700)
+ rmSync(dir, { recursive: true, force: true })
+ }
+ })
+
+ it('launches the engine when the workspace is readable', async () => {
+ const dir = mkdtempSync(join(tmpdir(), 'harness-readable-'))
+ try {
+ const result = await launchInto(dir)
+ expect(result.code).toBe(0)
+ expect(result.stdout).toContain('ENGINE_RAN')
+ } finally {
+ rmSync(dir, { recursive: true, force: true })
+ }
+ })
+
+ // Both hints are pushed through a real /bin/sh, whatever platform runs the suite: the quoting
+ // of the macOS text (a backtick-free command, `›`, `—`) is what a Linux runner would otherwise
+ // never exercise.
+ async function guardOutput(platform: NodeJS.Platform, dir: string): Promise<string> {
+ const { execFile } = await import('node:child_process')
+ return await new Promise((resolve) => {
+ execFile(
+ '/bin/sh',
+ ['-c', `cd -- "$1" || exit 9\n${unreadableCwdGuard(platform)}echo ENGINE_RAN`, 'guard', dir],
+ { timeout: 10_000 },
+ (_error, stdout, stderr) => resolve(stdout + stderr),
+ )
+ })
+ }
+
+ it.skipIf(!notRoot)('points at the privacy settings on macOS and at permissions elsewhere', async () => {
+ const dir = mkdtempSync(join(tmpdir(), 'harness-unreadable-hint-'))
+ try {
+ chmodSync(dir, 0o300)
+ const darwin = await guardOutput('darwin', dir)
+ expect(darwin).toContain('Full Disk Access')
+ expect(darwin).toContain('tmux kill-server')
+ expect(darwin).toContain('Privacy & Security')
+ expect(darwin).not.toContain('ENGINE_RAN')
+ const linux = await guardOutput('linux', dir)
+ expect(linux).toContain('permissions')
+ expect(linux).not.toContain('Privacy & Security')
+ expect(linux).not.toContain('ENGINE_RAN')
+ } finally {
+ chmodSync(dir, 0o700)
+ rmSync(dir, { recursive: true, force: true })
+ }
+ })
+
+ it('keeps the action inside what a relayed pane summary can show', () => {
+ // First hint line: what to do. It has to survive next to a folder path in a ~180-char summary.
+ const firstHint = unreadableCwdGuard('darwin').match(/'(harness: on macOS[^']*)'/)?.[1] ?? ''
+ expect(firstHint.length).toBeGreaterThan(0)
+ expect(firstHint.length).toBeLessThanOrEqual(120)
+ })
+ })
+
+ it('a DSH agent gets Harness\'s Node at the end of a PATH that has none; a plain launch is unchanged', () => {
+ const argv = buildEngineLaunchArgv('claude', { harnessNode: true }, '/bin/zsh', '/opt/harness runtime/bin/node')
- expect(argv[2]).toBe(`${harnessNodePrelude('/opt/harness runtime/bin/node')}exec "$@"`)
++ // On this branch every pane script opens with the open-files raise and the grid prelude; the Node
++ // line lands after them, and a launch without `harnessNode` is exactly the baseline above.
++ expect(argv[2]).toBe(`${RAISE_OPEN_FILES_SH}${GRID_PRELUDE}${harnessNodePrelude('/opt/harness runtime/bin/node')}exec "$@"`)
+ expect(harnessNodePrelude('/opt/harness runtime/bin/node')).toBe(
+ 'if ! command -v node >/dev/null 2>&1; then PATH="${PATH:+$PATH:}"\'/opt/harness runtime/bin\'; export PATH; fi\n')
- expect(buildEngineLaunchArgv('claude', { harnessNode: false }, '/bin/zsh')[2]).toBe('exec "$@"')
++ expect(buildEngineLaunchArgv('claude', { harnessNode: false }, '/bin/zsh')[2]).toBe(`${RAISE_OPEN_FILES_SH}${GRID_PRELUDE}exec "$@"`)
+ })
+
+ it('the DSH prelude, run by a real shell, reaches the engine\'s PATH only when node is missing', () => {
+ const home = mkdtempSync(join(tmpdir(), 'harness-node-prelude-'))
+ try {
+ const runtimeBin = join(home, 'runtime', 'bin')
+ mkdirSync(runtimeBin, { recursive: true })
+ writeFileSync(join(runtimeBin, 'node'), '#!/bin/sh\n', { mode: 0o755 })
+ const run = (path: string) => {
+ const argv = buildEngineLaunchArgv('claude', { harnessNode: true }, '/bin/sh', join(runtimeBin, 'node'))
+ const script = argv[2]
+ return execFileSync('/bin/sh', ['-c', script, 'harness-engine', '/bin/sh', '-c', 'echo "$PATH"; command -v node'], {
+ env: { HOME: home, PATH: path }, encoding: 'utf8',
+ }).trim().split('\n')
+ }
+ expect(run('/usr/bin:/bin')).toEqual([`/usr/bin:/bin:${runtimeBin}`, join(runtimeBin, 'node')])
+ const own = join(home, 'own')
+ mkdirSync(own)
+ writeFileSync(join(own, 'node'), '#!/bin/sh\n', { mode: 0o755 })
+ expect(run(`${own}:/usr/bin:/bin`)).toEqual([`${own}:/usr/bin:/bin`, join(own, 'node')])
+ } finally {
+ rmSync(home, { recursive: true, force: true })
+ }
+ })
+
it('falls back to direct execution when no absolute shell is available', () => {
expect(buildEngineLaunchArgv('claude', {}, '')).toEqual([engineBin('claude')])
expect(buildEngineLaunchArgv('claude', {}, 'zsh')).toEqual([engineBin('claude')])
diff --cc cli/src/lib/engineLaunch.ts
index 6c45a661b,0dd71b916..c845e19fe
--- a/cli/src/lib/engineLaunch.ts
+++ b/cli/src/lib/engineLaunch.ts
@@@ -313,7 -196,7 +321,9 @@@ export function buildEngineLaunchArgv
// of this shell and inherits what it inherits: `npm` is not going to spend someone's Anthropic key,
// but an install script that probes for credentials to configure itself would, and the whole point
// of this launch is that the agent's environment is the one the user asked for.
- const prelude = clearEnvPrelude(opts.clearEnv) + gridPanePrelude(gridBinary)
- const prelude = clearEnvPrelude(opts.clearEnv) + (opts.harnessNode ? harnessNodePrelude(runtimeNode) : '')
++ // Then the grid's PATH entry at the FRONT (its dir holds only `grid`), and — for a DSH agent — Harness's
++ // Node at the END, only when the shell found none. The two never meet: one prepends, one appends.
++ const prelude = clearEnvPrelude(opts.clearEnv) + gridPanePrelude(gridBinary) + (opts.harnessNode ? harnessNodePrelude(runtimeNode) : '')
// rc files (notably nvm) call getcwd() before running this command. Start the shell in a safe
// directory and enter the selected workspace only after those files have loaded: an IDE can replace
// a workspace inode between the desktop picker resolving it and tmux spawning the pane.
@@@ -327,41 -208,14 +337,46 @@@
: opts.installFirst
? installThenExecScript(opts.installFirst)
: 'exec "$@"'
- return [interactive.path, ...interactive.args, prelude + cwdPrelude + body, 'harness-engine', ...(opts.cwd ? [opts.cwd] : []), ...command]
+ // The open-files raise goes ahead of everything, the installer included: a pane inherits the tmux
+ // SERVER's soft limit, which is launchd's 256 whenever the desktop app started the daemon that
+ // started the server, and an engine (Claude Code refuses outright) or an npm install under 256 is
+ // the failure the person then reads in the pane. See openFiles.ts.
+ return [interactive.path, ...interactive.args, RAISE_OPEN_FILES_SH + prelude + cwdPrelude + body, 'harness-engine', ...(opts.cwd ? [opts.cwd] : []), ...command]
+}
+
+/**
+ * Refuse a workspace the shell could enter but cannot read, and say why — before the engine finds
+ * out on its own terms.
+ *
+ * `cd` succeeding proves only the search bit. macOS privacy protection (TCC) leaves exactly that:
+ * a process whose responsible app was never granted Documents, Desktop or Downloads may enter the
+ * folder and is refused its first readdir with EPERM. The engine then dies with nothing to go on —
+ * Claude Code printed "An unknown error occurred (Unexpected)" on a machine whose tmux server had
+ * been started by a terminal app without Documents access, and every pane the daemon opened on
+ * that server inherited the refusal — so the check is made here, where the reason can be given.
+ * `[ -r . ]` is `access(2)`, which TCC answers the same way as the readdir would.
+ *
+ * The hint names the fix for the platform this daemon generates the script on, which is the one
+ * the pane runs on. `$PWD` is left to the shell so the message names the folder as entered. Short
+ * lines, the action first: a dialog that relays the pane's last lines keeps about 180 characters
+ * (agentCreateDiagnosis.ts), and the folder path alone can take half of that.
+ */
+export function unreadableCwdGuard(platform: NodeJS.Platform = process.platform): string {
+ const hints = platform === 'darwin'
+ ? [
+ 'harness: on macOS, grant Full Disk Access to the app that started tmux (and to Harness), then run: tmux kill-server',
+ 'harness: or pick a folder outside Documents, Desktop and Downloads (System Settings › Privacy & Security).',
+ ]
+ : ['harness: check the folder\'s permissions for this user.']
+ return `if ! [ -r . ]; then printf '%s\\n' "harness: cannot read $PWD — the agent was not started." `
+ + `${hints.map(shellSingleQuote).join(' ')} >&2; exit 1; fi\n`
}
+ /** Harness's Node at the end of PATH when the shell found none — see `LaunchCommandOptions.harnessNode`. */
+ export function harnessNodePrelude(runtimeNode: string = managedNodePath()): string {
+ return `if ! command -v node >/dev/null 2>&1; then PATH="\${PATH:+$PATH:}"${shellSingleQuote(dirname(runtimeNode))}; export PATH; fi\n`
+ }
+
/**
* `unset` for the variables a grid launch must not let through, or nothing at all.
*
diff --cc cli/src/lib/registry.ts
index 12550be9c,4dc4634f4..9d8bb0e69
--- a/cli/src/lib/registry.ts
+++ b/cli/src/lib/registry.ts
@@@ -1065,7 -1000,7 +1065,7 @@@ class Registry
schemaVersion: 2,
active: true,
launch: { state: 'starting' },
- defaultName: normalizedDefaultName(input.defaultName) ?? this.nextAgentName(),
- defaultName: this.nextAgentName(input.cwd),
++ defaultName: normalizedDefaultName(input.defaultName) ?? this.nextAgentName(input.cwd),
agentId,
sessionId: '',
boundAt: null,
diff --cc cli/vitest.setup.ts
index 0e97585ad,e1da3b698..009876eb2
--- a/cli/vitest.setup.ts
+++ b/cli/vitest.setup.ts
@@@ -16,4 -11,8 +16,9 @@@ import { tmpdir } from 'node:os
import { join } from 'node:path'
process.env.ADAPTER_DATA_DIR = mkdtempSync(join(tmpdir(), 'adapter-test-data-'))
+process.env.ADAPTER_RUNTIME_DIR = mkdtempSync(join(tmpdir(), 'adapter-test-runtime-'))
+ process.env.DSH_DIR = join(process.env.ADAPTER_DATA_DIR, 'dsh')
+ // The Store catalog is fetched from GitHub by dsh_list; a test must never depend on what that branch
+ // holds today (a published catalog turned a fixture registry of two into the live shelf of 23).
+ // Loopback port 9 refuses at once, so the live catalog falls back to the registry each test stubs.
+ process.env.HARNESS_STORE_CATALOG_URL ??= 'http://127.0.0.1:9/catalog.json'
diff --cc desktop/README.md
index 6daa3f593,655ee7fc0..e9a5b4206
--- a/desktop/README.md
+++ b/desktop/README.md
@@@ -6,10 -7,11 +7,11 @@@ planned and its runner is unexercised.
## Development
-Install a compatible Flutter SDK, then run the project from this repository
-root:
+Install a compatible Flutter SDK, then run the project from this directory
+(`desktop/` in the monorepo):
```bash
+ cd desktop
flutter pub get
flutter test
flutter run -d macos # or: flutter run -d linux
diff --cc desktop/lib/screens/swarm_screen.dart
index 00ade5b7b,1aaabe606..64109db22
--- a/desktop/lib/screens/swarm_screen.dart
+++ b/desktop/lib/screens/swarm_screen.dart
@@@ -30,9 -29,9 +30,10 @@@ import '../state/swarm_attention.dart'
import '../state/swarm_navigation.dart';
import '../state/swarm_search.dart';
import '../state/swarm.dart';
+import '../widgets/transient_menus.dart';
import '../widgets/layout_palette.dart';
import '../widgets/engine_identity.dart';
+ import '../store/store_screen.dart';
import '../widgets/harness_start_page.dart';
import '../widgets/link_machine_screen.dart';
import '../widgets/machine_actions.dart';
diff --cc desktop/test/new_agent_choices_layout_test.dart
index 907bb3e95,65f15f86e..818850ee3
--- a/desktop/test/new_agent_choices_layout_test.dart
+++ b/desktop/test/new_agent_choices_layout_test.dart
@@@ -63,6 -63,6 +63,9 @@@ class _ChoicesApp extends AppNotifier
String? swarmId,
PaneSplitRequest? split,
String? dsh,
++ String? prompt,
++ String? name,
++ String? agent,
AgentCreationAttempt? attempt,
}) async {
createCalls++;