Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/lib/agent-interface.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,18 @@ describe('runAgent retry loop', () => {
}) as typeof emitter.emit;
});

it('isolates the agent from user Claude Code settings and MCP servers', async () => {
mockQuery.mockImplementation(createMockSDKResponse([{ text: 'Done!' }]));

await runAgent(makeAgentConfig(), 'Test prompt', makeOptions(), undefined, emitter);

const { options } = mockQuery.mock.calls[0][0] as { options: Record<string, unknown> };
// Omitted, the SDK loads ~/.claude settings: user plugins, MCP servers, hooks, and
// permission rules that would apply before installerCanUseTool.
expect(options.settingSources).toEqual([]);
expect(options.strictMcpConfig).toBe(true);
});

it('returns retryCount=0 when no retryConfig provided', async () => {
mockQuery.mockImplementation(createMockSDKResponse([{ text: 'Done!' }]));

Expand Down
6 changes: 6 additions & 0 deletions src/lib/agent-interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,12 @@ export async function runAgent(
return Promise.resolve(result);
},
tools: { type: 'preset', preset: 'claude_code' },
// Load no ~/.claude or project settings. Omitted, the SDK (since 0.2.89) loads them
// all: the user's plugins, MCP servers, hooks, CLAUDE.md, and permission rules,
// which apply before installerCanUseTool and would bypass the Bash gate.
settingSources: [],
// Only MCP servers we pass explicitly (none), even if the SDK's defaults change again.
strictMcpConfig: true,
allowedTools: agentConfig.allowedTools,
plugins: [{ type: 'local', path: pluginPath }],
pathToClaudeCodeExecutable: agentConfig.claudeExecutablePath,
Expand Down
Loading