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(codex): a grid move tells the model to use exec_command, not exec (#3110)
lingrd7c8f420fd6a9
diff --git a/cli/src/e2e/e2e.spec.ts b/cli/src/e2e/e2e.spec.tsindex c62a5ff31..ae470b9d5 100644--- a/cli/src/e2e/e2e.spec.ts+++ b/cli/src/e2e/e2e.spec.ts@@ -193,7 +193,7 @@ describe('matrix entry (dry run)', () => {})describe('scenario (what a person does, on each side of the switch)', () => {- it('four plain requests on each side — read, write, edit, then MCP — with nothing shared', () => {+ it('four requests on each side — read, write, edit, then MCP — with nothing shared', () => {expect(LEGS).toEqual(['subscription', 'grid'])// The own account calls the workspace's MCP server; the grid, the harness's web search.expect(SCENARIO.subscription.map((c) => c.id)).toEqual(['read', 'write', 'edit', 'mcp'])@@ -207,16 +207,26 @@ describe('scenario (what a person does, on each side of the switch)', () => {expect(plannedLegs().flatMap((l) => l.checks).every((c) => c.status === 'not-run')).toBe(true)})- it('every prompt is a plain request, and never contains its own proof', () => {- for (const c of SMOKE_CHECKS) {- expect(c.prompt).not.toMatch(/reply with exactly|<result>|RECALL_|TOOL_|MCP_/i)- if (c.logPattern) expect(c.prompt).not.toContain(c.logPattern) // "add 40 2" is asked; "= 42" is only the log's- expect(!!c.log || !!c.answerFromFile || !!c.file || !!c.sessionTool).toBe(true) // proven by the machine, never by the reply- // The result is what is tested, not the route: no request tells the engine which tool to use.- expect(c.prompt).not.toMatch(/\b(Bash|Read|Write|Edit) tool\b|apply_patch|in the shell/)+ it('names each engine its own tool and the exact path, and never its own proof', () => {+ for (const engine of ['codex', 'claude'] as const) {+ const scenario = scenarioFor(engine)+ for (const c of [...scenario.subscription, ...scenario.grid]) {+ expect(c.prompt).not.toMatch(/reply with exactly|<result>|\bRECALL_|\bTOOL_|\bMCP_(?!_)/i)+ if (c.logPattern) expect(c.prompt).not.toContain(c.logPattern) // "a=30 b=12" is asked; "= 42" is only the log's+ expect(!!c.log || !!c.answerFromFile || !!c.file || !!c.sessionTool).toBe(true) // proven by the machine, never by the reply+ const path = c.answerFromFile ?? c.file?.path+ if (path) expect(c.prompt).toContain(path)+ if (engine === 'codex' && ['read', 'write', 'edit'].includes(c.id)) expect(c.prompt).toContain('exec_command')+ }+ }+ const claude = scenarioFor('claude')+ for (const c of [...claude.subscription, ...claude.grid]) {+ if (c.id === 'read') expect(c.prompt).toContain('Read tool')+ if (c.id === 'write') expect(c.prompt).toContain('Write tool')+ if (c.id === 'edit') expect(c.prompt).toContain('Edit tool')}- // And every engine gets the same words.- expect(scenarioFor('codex')).toEqual(scenarioFor('claude'))+ // The engine's own tool name is what differs; a step is still proven only by its result.+ expect(scenarioFor('codex')).not.toEqual(scenarioFor('claude'))})it('firstStuck names the first leg/step that did not pass', () => {@@ -280,20 +290,20 @@ function fakeAgent(opts: { lie?: CheckId[]; empty?: boolean } = {}) {const lie = new Set(opts.lie ?? [])const reply = (p: string): string | null => {let m: RegExpMatchArray | null- if ((m = p.match(/Read (notes\/info-\d\.txt)/))) return lie.has('read') ? 'It says hello.' : `It says: ${files[m[1]].trim()}`- if ((m = p.match(/Search the web .*\((ref-[0-9a-z]{6})\)/))) {+ if ((m = p.match(/Read tool on (notes\/info-\d\.txt)/))) return lie.has('read') ? 'It says hello.' : `It says: ${files[m[1]].trim()}`+ if ((m = p.match(/mcp__harness__web_search tool .*\((ref-[0-9a-z]{6})\)/))) {if (!lie.has('web')) searched[m[1]] = opts.empty ? 'No results.' : 'Node.js 24.11.0 — https://nodejs.org/en/download'return 'The latest stable Node.js is 24.11.0.'}- if ((m = p.match(/Create the file (\S+) with this text: (.*) \(ref-/))) {+ if ((m = p.match(/Write tool to create (out\/hello-\d\.txt) .*text: (.*) \(ref-/))) {if (!lie.has('write')) files[m[1]] = `${m[2]}\n`return 'Done.'}- if ((m = p.match(/In (\S+), change pending to done/))) {+ if ((m = p.match(/Edit tool on (notes\/todo-\d\.txt) .*change pending to done/))) {if (!lie.has('edit')) files[m[1]] = files[m[1]].replace('pending', 'done')return 'Updated.'}- if ((m = p.match(/e2e_calc to add (\d+) and (\d+)/))) {+ if ((m = p.match(/e2e_calc .*add tool with a=(\d+) and b=(\d+)/))) {if (!lie.has('mcp')) logs.lines.mcp.push(`t add ${m[1]} ${m[2]} = ${+m[1] + +m[2]}`)return `${+m[1] + +m[2]}`}diff --git a/cli/src/e2e/smokeChecks.ts b/cli/src/e2e/smokeChecks.tsindex 7d171ae75..8382c7be5 100644--- a/cli/src/e2e/smokeChecks.ts+++ b/cli/src/e2e/smokeChecks.ts@@ -1,7 +1,7 @@/*** smokeChecks — the scenario: what a person does with a coding tool, on its own account and then on* a grid model in the same session: read a file, create one, edit one, use an MCP server. Four- * plain requests per side — worded the way a person types them, no reply formats.+ * requests per side, each naming the engine's own tool and the exact path, no reply formats.** Every step is proven by something the model cannot produce by talking:*@@ -48,7 +48,7 @@ export const WEB_SEARCH_TOOL = 'mcp__harness__web_search'export interface SmokeCheck {id: CheckId- /** Typed into the agent's pane, verbatim. Plain, engine-agnostic wording (codex and claude). */+ /** Typed into the agent's pane, verbatim. The engine's own wording (`scenarioFor`): its tool and the exact path. */prompt: string/** mcp: the log that must gain a line containing `logPattern`. */log?: LogKind@@ -65,29 +65,57 @@ export interface SmokeCheck {const MISS = {read: 'the file was not read: the read tool (or the shell read) fails on this leg — the answer never showed the file\'s token',- write: 'the file was not created with the requested text: the write tool fails on this leg (codex: apply_patch Add File; claude: Write)',- edit: 'the file was not changed as asked: the edit tool fails on this leg (codex: apply_patch Update File; claude: Edit)',+ write: 'the file was not created with the requested text: the write tool fails on this leg (codex: exec_command; claude: Write)',+ edit: 'the file was not changed as asked: the edit tool fails on this leg (codex: exec_command; claude: Edit)',mcp: 'the MCP server was not called: the respawn dropped the MCP config, the resumed session did not reload servers, or it answered without calling it (no log line)',web: 'the web search was not called, or came back without results: the harness web MCP was not given to the engine on the grid, the engine could not read the tool (a namespace tool on llama.cpp / LM Studio), or it answered from its head',}/**- * Plain requests, the way a person types them, and the same for every engine. A step passes on its- * RESULT — the file really read, written, edited; the MCP server really called — never on- * which of the engine's file tools got it there. Which tools it used (claude `Read` or- * `Bash cat`, codex `apply_patch` or a shell write) is read back from the session file and REPORTED- * (sessionTools.ts, the message's Tools line), never judged: an engine is free to reach a result its- * own way, and a person asking for it would be.+ * The request names the engine's OWN tool and the exact path. The switch is what is under test: the+ * tool must still do file work after the move. Choosing a tool is not, so leaving a local model to+ * discover one is not a test of the switch — DeepSeek on a grid spent ten minutes in `find`, then+ * copied a wrapped absolute path that did not exist, and the step timed out. The request hands it+ * the tool and the path instead.*- * That report is still worth reading. It is how it was seen, on the first real runs, that claude- * does file work through Bash unless asked otherwise, and that codex on a grid model writes files- * through the shell where on its own account it uses apply_patch (a grid model is not in codex's- * model catalog, so codex does not offer it apply_patch).+ * The RESULT is still the proof, never the reply — the file really read, written, edited; the MCP+ * server really called. Which tool got there is read back from the session file and REPORTED+ * (sessionTools.ts), not judged.*/-const files = (n: 1 | 2): SmokeCheck[] => [- { id: 'read', prompt: `Read notes/info-${n}.txt and tell me what it says.`, answerFromFile: `notes/info-${n}.txt`, onMiss: MISS.read },- { id: 'write', prompt: `Create the file out/hello-${n}.txt with this text: hello from step ${n}`, file: { path: `out/hello-${n}.txt`, equals: `hello from step ${n}` }, onMiss: MISS.write },- { id: 'edit', prompt: `In notes/todo-${n}.txt, change pending to done.`, file: { path: `notes/todo-${n}.txt`, contains: 'status: done', lacks: 'pending' }, onMiss: MISS.edit },+interface Wording {+ read: (n: 1 | 2) => string+ write: (n: 1 | 2) => string+ edit: (n: 1 | 2) => string+ mcp: string+ web: string+}++/**+ * How each engine names the tool in its own CLI. `exec_command` is codex's declared shell tool+ * (0.166 advertises `functions.exec` but does not declare it, so naming `exec_command` is what keeps+ * it off that path); claude's file tools are `Read`, `Write`, `Edit`.+ */+const WORDING: Record<'codex' | 'claude', Wording> = {+ codex: {+ read: (n) => `Use exec_command to run this exact command from your current directory, then tell me what the file says: cat notes/info-${n}.txt`,+ write: (n) => `Use exec_command to run this exact command from your current directory: printf '%s' 'hello from step ${n}' > out/hello-${n}.txt`,+ edit: (n) => `Use exec_command to run this exact command from your current directory: sed -i 's/pending/done/' notes/todo-${n}.txt`,+ mcp: "Use the e2e_calc MCP server's add tool with a=30 and b=12.",+ web: 'Use the mcp__harness__web_search tool to search the web for the latest stable version of Node.js, then tell me the version number.',+ },+ claude: {+ read: (n) => `Use the Read tool on notes/info-${n}.txt (relative to your current directory) and tell me what it says.`,+ write: (n) => `Use the Write tool to create out/hello-${n}.txt (relative to your current directory) with exactly this text: hello from step ${n}`,+ edit: (n) => `Use the Edit tool on notes/todo-${n}.txt (relative to your current directory) to change pending to done.`,+ mcp: "Use the e2e_calc MCP server's add tool with a=30 and b=12.",+ web: 'Use the mcp__harness__web_search tool to search the web for the latest stable version of Node.js, then tell me the version number.',+ },+}++const files = (n: 1 | 2, w: Wording): SmokeCheck[] => [+ { id: 'read', prompt: w.read(n), answerFromFile: `notes/info-${n}.txt`, onMiss: MISS.read },+ { id: 'write', prompt: w.write(n), file: { path: `out/hello-${n}.txt`, equals: `hello from step ${n}` }, onMiss: MISS.write },+ { id: 'edit', prompt: w.edit(n), file: { path: `notes/todo-${n}.txt`, contains: 'status: done', lacks: 'pending' }, onMiss: MISS.edit },]/**@@ -97,21 +125,22 @@ const files = (n: 1 | 2): SmokeCheck[] => [* llama.cpp (autonomous-grid-cli#41). The own account has no harness web MCP (it is given only on a* grid, gridLaunch.ts), so that side keeps `e2e_calc`.*/-export const SCENARIO: Record<Leg, readonly SmokeCheck[]> = {- subscription: [- ...files(1),- { id: 'mcp', prompt: 'Use the MCP server e2e_calc to add 30 and 12.', log: 'mcp', logPattern: 'add 30 12 = 42', onMiss: MISS.mcp },- ],- grid: [- ...files(2),- { id: 'web', prompt: 'Search the web for the latest stable version of Node.js and tell me the version number.', sessionTool: WEB_SEARCH_TOOL, onMiss: MISS.web },- ],+export function scenarioFor(engine: string): Record<Leg, readonly SmokeCheck[]> {+ const w = WORDING[engine as 'codex' | 'claude'] ?? WORDING.claude+ return {+ subscription: [+ ...files(1, w),+ { id: 'mcp', prompt: w.mcp, log: 'mcp', logPattern: 'add 30 12 = 42', onMiss: MISS.mcp },+ ],+ grid: [+ ...files(2, w),+ { id: 'web', prompt: w.web, sessionTool: WEB_SEARCH_TOOL, onMiss: MISS.web },+ ],+ }}-/** The scenario an engine is given — the same plain requests for every engine (see above). */-export function scenarioFor(_engine: string): Record<Leg, readonly SmokeCheck[]> {- return SCENARIO-}+/** The default wording (claude) for callers that want the flat list without an engine. */+export const SCENARIO: Record<Leg, readonly SmokeCheck[]> = scenarioFor('claude')/** Every step of every leg, for callers that want the flat list (the skill, the tests). */export const SMOKE_CHECKS: readonly SmokeCheck[] = LEGS.flatMap((leg) => SCENARIO[leg])diff --git a/cli/src/engines/codex/providerMove.spec.ts b/cli/src/engines/codex/providerMove.spec.tsindex ee84e2b9e..15dde880d 100644--- a/cli/src/engines/codex/providerMove.spec.ts+++ b/cli/src/engines/codex/providerMove.spec.ts@@ -3,7 +3,7 @@ import { tmpdir } from 'node:os'import { join } from 'node:path'import { describe, expect, it } from 'vitest'import gridInstructions from './gridInstructions.json' with { type: 'json' }-import { appServerArgs, moveCodexConversation } from './providerMove.js'+import { appServerArgs, GRID_SHELL_INSTRUCTION, moveCodexConversation } from './providerMove.js'/** A stand-in `codex` that speaks app-server's JSONL, records what it is asked, and refuses the fork when told to. */function fakeCodex(fork: 'works' | 'refused' = 'works') {@@ -38,7 +38,7 @@ describe.skipIf(process.platform === 'win32')('moveCodexConversation', () => {const asked = codex.requests()expect(asked[0].argv).toEqual(['app-server', '-c', 'model_provider="grid"'])expect(asked.find((r) => r.method === 'thread/fork').params).toEqual({- threadId: 'source', model: 'grid/model', cwd: '/work', baseInstructions: gridInstructions.instructions,+ threadId: 'source', model: 'grid/model', cwd: '/work', baseInstructions: gridInstructions.instructions + GRID_SHELL_INSTRUCTION,})expect(asked.filter((r) => r.method).map((r) => r.method)).toEqual(['initialize', 'initialized', 'thread/fork'])})@@ -78,4 +78,10 @@ describe('the instructions a move to a grid starts with', () => {expect(gridInstructions.instructions.length).toBeGreaterThan(1000)expect(gridInstructions.instructions).not.toContain('functions.exec')})++ it('names exec_command and warns off the exec the resumed conversation used', () => {+ expect(GRID_SHELL_INSTRUCTION).toContain('exec_command')+ expect(GRID_SHELL_INSTRUCTION).toContain('Do not call `exec`')+ expect(GRID_SHELL_INSTRUCTION).not.toContain('functions.exec')+ })})diff --git a/cli/src/engines/codex/providerMove.ts b/cli/src/engines/codex/providerMove.tsindex 4f0cd895e..5718cd0b2 100644--- a/cli/src/engines/codex/providerMove.ts+++ b/cli/src/engines/codex/providerMove.ts@@ -13,6 +13,15 @@ import gridInstructions from './gridInstructions.json' with { type: 'json' }const REQUEST_MS = 30_000+/**+ * Codex 0.166 advertises `exec` in the conversation it resumes but does not declare it as a tool on a+ * grid. A model following that habit calls it, Codex answers `unsupported call: exec`, and the turn+ * never ends. A person's request is one turn and the history still shows the old tool, so the only+ * place a grid move can say otherwise is the instructions the fork starts with.+ */+export const GRID_SHELL_INSTRUCTION =+ '\n\nThe shell tool on this provider is `exec_command`. Do not call `exec`: it does not exist here, and a call to it fails the turn. Run shell commands with `exec_command` directly.'+export interface CodexMove {sessionId: stringtoGrid: boolean@@ -92,7 +101,7 @@ export async function moveCodexConversation(move: CodexMove): Promise<string> {// The launch's model, or the fork asks the new provider for the one the conversation was on.const params: Record<string, unknown> = { threadId: move.sessionId, ...(model ? { model } : {}), ...(move.cwd ? { cwd: move.cwd } : {}) }if (move.toGrid) {- params.baseInstructions = gridInstructions.instructions+ params.baseInstructions = gridInstructions.instructions + GRID_SHELL_INSTRUCTION} else {const listed = await server.request('model/list', { includeHidden: true })const slug = model ?? listed?.data?.find((entry: { isDefault?: boolean }) => entry.isDefault)?.model