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.

fix: pre-approve the harness web tools for Claude Code on a Local model

Kelvinc4d239f54ca3
diff --git a/cli/src/lib/gridLaunch.spec.ts b/cli/src/lib/gridLaunch.spec.ts
index 1788a3ef9..3774be390 100644
--- a/cli/src/lib/gridLaunch.spec.ts
+++ b/cli/src/lib/gridLaunch.spec.ts
@@ -657,6 +657,18 @@ describe('web tools (grid ADR 0041)', () => {
expect(launchOf('claude', WITH_MCP).args).not.toContain('--disallowedTools=WebSearch')
})
+ it("pre-approves the harness web tools for Claude Code, so a permission mode cannot take them away", () => {
+ // The tools are the daemon's own gift to the agent, and Claude Code's permission system does not
+ // know that: in `default` mode every call prompts, and in `auto` mode the classifier DENIED
+ // `mcp__harness__web_search` outright on a real pane (2026-09-15) — the model then fell back to
+ // curl. An allow rule is honoured before either, so the two tools are listed by name.
+ expect(launchOf('claude', WITH_MCP).args).toContain('--allowedTools=mcp__harness__web_search,mcp__harness__web_read')
+ // ONE token, for the same reason as `--disallowedTools=`: the flag is variadic.
+ expect(launchOf('claude', WITH_MCP).args).not.toContain('--allowedTools')
+ // Nothing to approve when nothing was wired.
+ expect(launchOf('claude', WITH_MODEL).args.some((a) => a.startsWith('--allowedTools'))).toBe(false)
+ })
+
it("turns Codex's native web search off on every grid launch, web tools or not", () => {
// The native tool is an API-side feature of OpenAI's Responses endpoint. Verified on codex-cli
// 0.154.0 with `--strict-config`: the key is `web_search`, the variants `disabled`, `cached`,
diff --git a/cli/src/lib/gridLaunch.ts b/cli/src/lib/gridLaunch.ts
index 6c6e6cfc4..d0f95be0b 100644
--- a/cli/src/lib/gridLaunch.ts
+++ b/cli/src/lib/gridLaunch.ts
@@ -46,6 +46,7 @@ import { homedir } from 'node:os'
import { join } from 'node:path'
import type { AgentEngine } from '../engines/types.js'
import {
+ CLAUDE_ALLOW_WEB_TOOLS_ARG,
CLAUDE_DISALLOW_WEB_TOOLS_ARG,
CODEX_DISABLE_WEB_SEARCH_ARGS,
mcpServersConfig,
@@ -579,7 +580,11 @@ const GRID_ENGINE_CONTRACTS: Partial<Record<AgentEngine, GridEngineContract>> =
// that no grid runs, and the built-in fetch summarises through a model the grid does not
// serve. See `CLAUDE_DISALLOW_WEB_TOOLS_ARG`.
CLAUDE_DISALLOW_WEB_TOOLS_ARG,
- ...(override.mcpUrl ? ['--mcp-config', mcpServersConfig(override.mcpUrl, GRID_KEY_VAR)] : []),
+ // With the server comes its approval: a tool the daemon wired in and a permission mode then
+ // refuses is worse than no tool at all. See `CLAUDE_ALLOW_WEB_TOOLS_ARG`.
+ ...(override.mcpUrl
+ ? ['--mcp-config', mcpServersConfig(override.mcpUrl, GRID_KEY_VAR), CLAUDE_ALLOW_WEB_TOOLS_ARG]
+ : []),
],
webSearch: webSearchWhenWired(override),
}),
diff --git a/cli/src/lib/gridWebMcp.ts b/cli/src/lib/gridWebMcp.ts
index 1c05e1a98..56f0991f0 100644
--- a/cli/src/lib/gridWebMcp.ts
+++ b/cli/src/lib/gridWebMcp.ts
@@ -43,7 +43,7 @@
* authentication with nothing naming why.
*/
-import { HARNESS_MCP_SERVER_NAME } from './harnessWebTools.js'
+import { HARNESS_MCP_SERVER_NAME, HARNESS_MCP_TOOL_NAMES } from './harnessWebTools.js'
/**
* The variable Codex reads its header out of.
@@ -131,6 +131,23 @@ export function mcpServersConfig(mcpUrl: string, keyVar: string): string {
*/
export const CLAUDE_DISALLOW_WEB_TOOLS_ARG = '--disallowedTools=WebSearch,WebFetch'
+/**
+ * The harness web tools, pre-approved for every Claude Code agent launched onto a grid WITH them.
+ *
+ * The server is the daemon's own doing, and Claude Code's permission system has no way to know that:
+ * a call to `mcp__harness__web_search` is, to it, an MCP tool from a server it never saw configured.
+ * In `default` mode that is a prompt per call; in `auto` mode the classifier DENIED it outright —
+ * seen on a real pane (2026-09-15, Claude Code 2.1.272, `permissions.defaultMode: auto`): "The MCP
+ * web search tool was blocked by the auto-mode classifier", after which the model fell back to curl.
+ * The tools were put there on purpose, so they are allowed on purpose: an allow rule is honoured
+ * before a prompt and before the classifier.
+ *
+ * Only when there IS a server to allow — with no MCP url the names would match nothing — and only
+ * for the two tools by name (see [HARNESS_MCP_TOOL_NAMES]). The same one-token `=` form as
+ * [CLAUDE_DISALLOW_WEB_TOOLS_ARG], for the same variadic reason.
+ */
+export const CLAUDE_ALLOW_WEB_TOOLS_ARG = `--allowedTools=${HARNESS_MCP_TOOL_NAMES.join(',')}`
+
/**
* Codex's native `web_search`, turned off on every Codex agent launched onto a grid.
*
diff --git a/cli/src/lib/harnessWebTools.ts b/cli/src/lib/harnessWebTools.ts
index c50d8f19e..c03ca9eba 100644
--- a/cli/src/lib/harnessWebTools.ts
+++ b/cli/src/lib/harnessWebTools.ts
@@ -32,6 +32,13 @@ const WEB_READ_TOOL = 'web_read'
*/
const mcpToolName = (tool: string): string => `mcp__${HARNESS_MCP_SERVER_NAME}__${tool}`
+/**
+ * The server's tools as an engine names them — the list a launch pre-approves. Exactly the two the
+ * control plane serves, by name rather than as a server-wide `mcp__harness` rule: a tool the server
+ * grows later is one nobody here has looked at, and it should prompt like any other.
+ */
+export const HARNESS_MCP_TOOL_NAMES: readonly string[] = [mcpToolName(WEB_SEARCH_TOOL), mcpToolName(WEB_READ_TOOL)]
+
/** The canonical card the desktop and web already render, and the input shape it reads. */
export interface HarnessWebToolCard {
tool: 'WebSearch' | 'WebFetch'