From 6f31afd499d6428ca840554157e8329a3610365e Mon Sep 17 00:00:00 2001 From: Colby Mchenry Date: Sun, 27 Sep 2026 13:29:07 +0000 Subject: [PATCH] fix(mcp): resolve the pool's project root only when the pool serves the call (#2027) The #1465 change read the default project root on every tool call, before checking whether a query worker would serve it. Resolve it only for a pooled call; in-process dispatch no longer depends on it (restores the oversized-output truncation test). Co-authored-by: Claude Opus 5.5 --- src/mcp/tools.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mcp/tools.ts b/src/mcp/tools.ts index 046490135..fdea0f52c 100644 --- a/src/mcp/tools.ts +++ b/src/mcp/tools.ts @@ -2228,9 +2228,10 @@ export class ToolHandler { // The default may have appeared after the workers started. Pass the // main thread's current root explicitly; with no root or projectPath, // keep the main handler's workspace-specific not-indexed guidance. - const projectPath = args.projectPath ?? this.cg?.getProjectRoot(); - const raw = (projectPath && this.queryPool && this.queryPool.healthy && this.queryPool.ready) - ? await this.queryPool.run(toolName, { ...dispatchArgs, projectPath }) + const pooled = !!(this.queryPool && this.queryPool.healthy && this.queryPool.ready); + const projectPath = pooled ? args.projectPath ?? this.cg?.getProjectRoot() : undefined; + const raw = (pooled && projectPath) + ? await this.queryPool!.run(toolName, { ...dispatchArgs, projectPath }) : await this.executeReadTool(toolName, dispatchArgs); // Record + STRIP before anything else touches the result: the emission is // internal bookkeeping and must never reach the client, whether or not a