From a1cceef60ca18887596d7464bb7a9c4b51baf76f Mon Sep 17 00:00:00 2001 From: houssemzaier Date: Tue, 30 Jun 2026 02:31:19 +0200 Subject: [PATCH] fix(core): reload config after create_rule_block so the new rule applies immediately MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the `create_rule_block` tool creates a rule, it writes the file via `ide.writeFile()`, which does not trigger VS Code workspace file events — so the new rule is not picked up until the next manual config reload. After the tool runs successfully we now invalidate the walkDir cache and reload the config, so the rule the model just created takes effect right away. --- core/core.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/core/core.ts b/core/core.ts index daba8ffaac5..07652a46f36 100644 --- a/core/core.ts +++ b/core/core.ts @@ -19,6 +19,7 @@ import { fetchModels } from "./llm/fetchModels"; import Ollama from "./llm/llms/Ollama"; import { EditAggregator } from "./nextEdit/context/aggregateEdits"; import { createNewPromptFileV2 } from "./promptFiles/createNewPromptFile"; +import { BuiltInToolNames } from "./tools/builtIn"; import { callTool } from "./tools/callTool"; import { ChatDescriber } from "./util/chatDescriber"; import { compactConversation } from "./util/conversationCompaction"; @@ -1185,6 +1186,18 @@ export class Core { codeBaseIndexer: this.codeBaseIndexer, }); + // Hot-reload config when a rule is created via the create_rule_block tool, + // since ide.writeFile() does not trigger VS Code workspace file events. + if ( + toolCall.function.name === BuiltInToolNames.CreateRuleBlock && + !result.errorMessage + ) { + walkDirCache.invalidate(); + await this.configHandler.reloadConfig( + "Rule created via create_rule_block tool", + ); + } + return result; }