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.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
fix: a shell error in the Codex flag probe no longer reads as "unsupported" (#185)
Dee2a2fa5a59d78
diff --git a/cli/src/lib/engineLaunch.spec.ts b/cli/src/lib/engineLaunch.spec.tsindex 5353fcacc..6bcaab8e4 100644--- a/cli/src/lib/engineLaunch.spec.ts+++ b/cli/src/lib/engineLaunch.spec.ts@@ -627,6 +627,20 @@ describe('commandSupportsFlagInInteractiveShell', () => {).resolves.toBe('supported')})+ // A shell's own failure exits 1 — as zsh's read-only `status` did — and must not read as a missing+ // flag: only the probe's own "not in the help" exit refuses an engine.+ it('does not read a shell failure as a missing flag', async () => {+ const shellDir = mkdtempSync(join(tmpdir(), 'harness-engine-shell-'))+ dirs.push(shellDir)+ const shell = join(shellDir, 'bash')+ writeFileSync(shell, '#!/bin/sh\nexit 1\n')+ chmodSync(shell, 0o700)++ await expect(+ commandSupportsFlagInInteractiveShell('codex', '--approve-for-me', shell),+ ).resolves.toBe('unknown')+ })+it('does not reject a CLI when its help command cannot be inspected', async () => {const binDir = mkdtempSync(join(tmpdir(), 'harness-engine-capability-'))dirs.push(binDir)diff --git a/cli/src/lib/engineLaunch.ts b/cli/src/lib/engineLaunch.tsindex 9e3c1b08d..b301b7f08 100644--- a/cli/src/lib/engineLaunch.ts+++ b/cli/src/lib/engineLaunch.ts@@ -798,6 +798,13 @@ export async function commandAvailableInInteractiveShell(export type CommandFlagSupport = 'supported' | 'unsupported' | 'unknown'+/**+ * The probe's one "help ran, the flag is not in it" exit. Not 1: that is what a shell exits with+ * for its own failures (the zsh `status` bug was one), and each of them would be a false refusal.+ * Shells fail with 1, 2, 126, 127 or 128+n, never this.+ */+const FLAG_UNSUPPORTED_EXIT = 64+/*** Checks a CLI's own help from the same interactive shell that would launch* it. `unknown` is deliberately non-blocking: a broken or unusually slow help@@ -819,7 +826,7 @@ export async function commandSupportsFlagInInteractiveShell('help="$("$1" --help 2>&1)"','harness_help_status=$?','[ "$harness_help_status" -eq 0 ] || exit 2',- 'case "$help" in *"$2"*) exit 0 ;; *) exit 1 ;; esac',+ `case "$help" in *"$2"*) exit 0 ;; *) exit ${FLAG_UNSUPPORTED_EXIT} ;; esac`,].join('\n')return await new Promise((resolve) => {execFile(@@ -830,7 +837,7 @@ export async function commandSupportsFlagInInteractiveShell(if (!error) resolve('supported')else {const code = (error as { code?: number | string }).code- resolve(code === 1 || code === '1' ? 'unsupported' : 'unknown')+ resolve(Number(code) === FLAG_UNSUPPORTED_EXIT ? 'unsupported' : 'unknown')}},)