fix(core): reload config after create_rule_block so the new rule applies immediately#12920
Open
houssemzaier wants to merge 1 commit into
Open
Conversation
…ies immediately 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When the model creates a rule with the
create_rule_blocktool, the rule file is written viaide.writeFile(), which doesn't trigger VS Code's workspace file-change events. So the new rule isn't picked up until the next manual config reload — the user has to reload (or restart) before the rule they just asked for actually applies.After the
create_rule_blocktool runs successfully, this PR invalidates thewalkDircache and reloads the config, so the freshly-created rule takes effect immediately.It's a small, targeted change in the tool-call handler (
core/core.ts): only thecreate_rule_blocktool triggers the reload, and only when it didn't error (!result.errorMessage).We've been running this in a downstream fork (3,000+ users) and it's been stable.
Tests
Manual: ask the assistant to create a rule (via the
create_rule_blocktool), then immediately rely on it — the rule now applies without a manual reload.Checklist
Summary by cubic
Hot-reloads the config after a successful
create_rule_blockso the new rule applies immediately without a manual reload. This invalidates thewalkDircache and reloads the config in the tool-call handler.ide.writeFile()not emitting VS Code workspace events by reloading only forcreate_rule_blockand only on success.Written for commit a1cceef. Summary will update on new commits.