From 69eb369675e098c75ba6975c976516a75b541e86 Mon Sep 17 00:00:00 2001 From: Tibsfox Date: Mon, 6 Apr 2026 19:06:59 -0700 Subject: [PATCH] fix(gsd): restore full tool set after discuss flow scoping dispatchWorkflow scoped tools down for discuss-* flows but never restored them. The narrowed set persisted into subsequent dispatches, making GSD execution tools permanently unavailable for the session. Now saves the full tool list before scoping and restores it immediately after sendMessage queues the turn. The LLM turn has already captured the scoped set so it's unaffected. Closes #3628 Co-Authored-By: Claude Opus 4.6 (1M context) --- src/resources/extensions/gsd/guided-flow.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/resources/extensions/gsd/guided-flow.ts b/src/resources/extensions/gsd/guided-flow.ts index d0f400448..c0bd063d6 100644 --- a/src/resources/extensions/gsd/guided-flow.ts +++ b/src/resources/extensions/gsd/guided-flow.ts @@ -295,8 +295,10 @@ async function dispatchWorkflow( // "Grammar is too complex" when the combined tool schema is too large. // Discuss flows only need a small subset of GSD tools — strip the heavy // planning/execution/completion tools to keep the grammar within limits. + let savedTools: string[] | null = null; if (unitType?.startsWith("discuss-")) { const currentTools = pi.getActiveTools(); + savedTools = currentTools; // Keep all non-GSD tools (builtins, other extensions) and only the // GSD tools on the discuss allowlist. const scopedTools = currentTools.filter( @@ -322,6 +324,13 @@ async function dispatchWorkflow( }, { triggerTurn: true }, ); + + // Restore full tool set after the message is queued. The LLM turn has + // already captured the scoped set — restoring prevents the narrowed + // tools from leaking into subsequent dispatches (#3628). + if (savedTools) { + pi.setActiveTools(savedTools); + } } /**