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.

harness mcp: closing a harness is not destructive, so Codex closes without asking (#1237)

Dee5aa67661be0d
diff --git a/cli/src/agentClient/mcp.spec.ts b/cli/src/agentClient/mcp.spec.ts
index 90c409a19..ed42c1c94 100644
--- a/cli/src/agentClient/mcp.spec.ts
+++ b/cli/src/agentClient/mcp.spec.ts
@@ -43,14 +43,14 @@ describe('harness mcp', () => {
expect(INSTRUCTIONS).toContain('close it once you have its answer (harness_close). At most 4 of yours at once, and a harness another agent started may not start harnesses itself.')
})
- it('says which tools only read or add, so Codex runs them without asking; closing still says it is destructive', async () => {
+ it('says which tools only read, add or close what can be resumed, so Codex runs them all without asking', async () => {
// Codex's rule for a tool with no approval setting of its own (codex-rs core/src/mcp_tool_call.rs
// `requires_mcp_tool_approval`, 0.162.1): destructive asks, read-only does not, and anything else asks unless it
- // says it is neither destructive nor open-world. The plugin's Codex manifest approves close as well.
+ // says it is neither destructive nor open-world. A close keeps the conversation, so it is not destructive either.
const codexAsks = (a: Record<string, unknown> = {}) => a.destructiveHint === true || (a.readOnlyHint !== true && (a.destructiveHint !== false || a.openWorldHint !== false))
const listed = ((await answer({ jsonrpc: '2.0', id: 1, method: 'tools/list' }, deps({ inPane: true })))!.result as { tools: Array<{ name: string; annotations?: Record<string, unknown> }> }).tools
expect(Object.fromEntries(listed.map((tool) => [tool.name, codexAsks(tool.annotations)]))).toEqual({
- harness_list: false, harness_start: false, harness_wait: false, harness_read: false, harness_send: false, harness_close: true,
+ harness_list: false, harness_start: false, harness_wait: false, harness_read: false, harness_send: false, harness_close: false,
})
})
diff --git a/cli/src/agentClient/mcp.ts b/cli/src/agentClient/mcp.ts
index 25e9021a8..4a8f2fd67 100644
--- a/cli/src/agentClient/mcp.ts
+++ b/cli/src/agentClient/mcp.ts
@@ -117,7 +117,11 @@ export const TOOLS: Tool[] = [
name: 'harness_close',
description: 'Close a harness you started, once it is done. Its conversation is kept: the person can resume it. Refused while it works, unless now is true.',
inputSchema: schema({ name: { type: 'string' }, now: { type: 'boolean', description: 'Close it even while it works.' } }, ['name']),
- annotations: { destructiveHint: true },
+ // Not destructive: the conversation is kept and the person can resume it, and Harness itself lets an agent close only
+ // what it started. Said so, Codex closes without asking even where the server was added by hand (`codex mcp add`),
+ // not only through the plugin's manifest: a close that waits on approval in `codex exec` left the harness running
+ // (2026-10-12, in a clean VM).
+ annotations: { destructiveHint: false, idempotentHint: true, openWorldHint: false },
argv: (a) => ['close', str(a.name), ...(a.now === true ? ['--now'] : [])],
},
]