Repository navigation
fix(core): reload plugins when file policies change - #27
Merged
Merged
Conversation
The plugin supervisor only reacted to config.updated events for the plugins section, but Config reports a policy-only edit under experimental (deprecated experimental.policies) or policies (top-level). A policy-only file edit therefore never re-evaluated running external plugins against the new policy. The config policy plugin had the same gap for top-level policies. Also drive the supervisor-reload organization test through the real Config.reload() path instead of publishing config.updated by hand, which left Config's cached (denying) entries in place. Fixes #26
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 72 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing: 3
✨ Finishing Touches
Comment |
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.
Fixes #26.
Problem
supervisor-reload.test.ts— 'applies organization integration changes to running external plugins' — failed on unmodified main. Investigation showed a real product bug, not an env flake:PluginModule.loadblocks plugins when file policy deniesintegration.useforplugin:<target>.policiesor deprecatedexperimental.policies, soConfig.reload()reports a policy-only edit as sections["policies"]/["experimental"](changedSectionscompares top-level keys).config.updatedwhen thepluginssection changed — so a policy-only file edit never re-evaluated running external plugins. Removing a deny policy left the plugin blocked until restart; adding one left a denied plugin running.The test also bypassed the real reload path: it wrote the config file and published
config.updatedby hand, which never refreshedConfig's cached entries, so the old deny policy stayed in effect regardless.The config policy plugin (
opencode.config.policy) had the same gap for top-levelpolicies: it only observedexperimental.Solution
packages/core/src/plugin/supervisor.ts: react toconfig.updatedforplugins,policies, andexperimentalsections.packages/core/src/config/plugin/policy.ts: observepoliciesalongsideexperimental.Config.reload()(re-reads the file, refreshes cached entries, publishes the real sections) instead of a hand-published bus event.Verification
error: pending(retry exhausts).supervisor-reload.test.ts+changed-sections.test.ts17/17 pass;bun typecheckinpackages/coreexits 0; prettier clean.--no-verify: husky pre-push runs the full turbo check, which spuriously fails @opencode/core typecheck in this 8GB sandbox while the identical standalone typecheck passes (documented sandbox quirk); GitHub CI is the gate.Summary by CodeRabbit