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.

Run a harness's setup and doctor as a login shell

0xdiego25562b1b17ab90
diff --git a/cli/src/dsh/shell.spec.ts b/cli/src/dsh/shell.spec.ts
new file mode 100644
index 000000000..511998685
--- /dev/null
+++ b/cli/src/dsh/shell.spec.ts
@@ -0,0 +1,17 @@
+import { afterEach, describe, expect, it } from 'vitest'
+import { dshShellArgv } from './shell.js'
+
+describe('dshShellArgv', () => {
+ const original = process.env.SHELL
+ afterEach(() => { if (original === undefined) delete process.env.SHELL; else process.env.SHELL = original })
+
+ it('runs a bash user\'s setup and doctor as a LOGIN shell, where .bash_profile (and nvm) live', () => {
+ process.env.SHELL = '/bin/bash'
+ expect(dshShellArgv('./doctor.sh')).toEqual({ path: '/bin/bash', args: ['-lic', './doctor.sh'] })
+ })
+
+ it('keeps zsh as it already was', () => {
+ process.env.SHELL = '/bin/zsh'
+ expect(dshShellArgv('./doctor.sh')).toEqual({ path: '/bin/zsh', args: ['-lic', './doctor.sh'] })
+ })
+})
diff --git a/cli/src/dsh/shell.ts b/cli/src/dsh/shell.ts
index 82d32f634..2d3c7d219 100644
--- a/cli/src/dsh/shell.ts
+++ b/cli/src/dsh/shell.ts
@@ -32,10 +32,23 @@ export function isShellNoise(line: string): boolean {
return /can't change option: zle$/.test(line) || /^\(eval\):\d+: can't change option: zle$/.test(line)
}
-/** `[path, ...args]` that runs `script` through the user's shell, or `/bin/sh -c` when none is known. */
+/**
+ * `[path, ...args]` that runs `script` through the user's shell, or `/bin/sh -c` when none is known.
+ *
+ * AS A LOGIN SHELL, whatever the shell. interactiveEngineShell gives bash `-ic` on purpose for a pane
+ * (see tmuxOnPath.ts on why), but a bash user's PATH conventionally lives in `.bash_profile`, which
+ * only `-l` reads — and Terminal.app opens a login shell, so that file is what "on my terminal it
+ * works" means. Measured 2026-09-16: Solid's doctor answered `miss codex on PATH` from the daemon
+ * while `harness dsh doctor` in Terminal found it, because codex was an npm global under nvm and nvm
+ * is sourced from `.bash_profile`. A setup or a doctor is one process, so the reason bash panes avoid
+ * `-l` (a PATH built in .bashrc compounding across subshells) does not apply here.
+ */
export function dshShellArgv(script: string): { path: string; args: string[] } {
const shell = interactiveEngineShell()
- if (shell) return { path: shell.path, args: [...shell.args, script] }
+ if (shell) {
+ const args = shell.args.map((a) => (a === '-ic' ? '-lic' : a))
+ return { path: shell.path, args: [...args, script] }
+ }
return { path: '/bin/sh', args: ['-c', script] }
}