Skip to content

fix(skill): ensure plugin config hooks run before skill discovery - #28647

Closed
herjarsa wants to merge 1 commit into
anomalyco:devfrom
herjarsa:fix/skill-plugin-config-hook-ordering
Closed

herjarsa wants to merge 1 commit into
anomalyco:devfrom
herjarsa:fix/skill-plugin-config-hook-ordering

Conversation

@herjarsa

Copy link
Copy Markdown

Issue for this PR

Closes #28646
Refs #20940

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Plugin config() hooks (e.g. superpowers) may mutate config.skills.paths to register additional skill directories. However, the Skill service runs its discovery independently during initialization, before plugin hooks have executed. By the time plugins mutate the config object, discoverSkills() has already cached its result and never re-reads config.skills.paths.

This fix ensures that plugin config hooks run before skill discovery completes, by:

  1. Adding Plugin.Service as a dependency in the Skill layer
  2. Calling yield* plugin.init() inside the discoverSkills InstanceState init, so plugins are loaded and their config hooks execute before the config is read for skill path discovery

The change is minimal (9 lines added) and the ordering is safe because:

  • Plugin has no circular dependency on Skill
  • plugin.init() is idempotent (cached via ScopedCache)
  • In pure mode, plugin.init() is a no-op

How did you verify your code works?

  • TypeScript compilation: lsp_diagnostics reports 0 errors on the changed file
  • No circular dependency: verified Plugin module does not import from Skill
  • Import path @/plugin resolves correctly via tsconfig paths (./src/*)
  • All existing callers of plugin.init() are unaffected (it is already idempotent)

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Plugin config() hooks (e.g. superpowers) may mutate config.skills.paths
to register additional skill directories. Skill discovery must wait for
plugins to initialize so those mutations are visible when discoverSkills()
reads the config.

Fixes anomalyco#20940
Closes anomalyco#28646
@XuanMoSR

XuanMoSR commented Jun 1, 2026

Copy link
Copy Markdown

This PR has been open for 2 weeks with 0 reviews. It blocks all superpowers skills (brainstorming, writing plans, test-driven-development, etc.) from being loaded via the skill tool on OpenCode. The fix is only 3 lines and mergeable. Could we get this reviewed and merged? 🙏

@Olyray

Olyray commented Jun 2, 2026

Copy link
Copy Markdown

Damn. Must be tough contributing a PR to a repo that has 965 PRs already.

@Gerkinfeltser

Copy link
Copy Markdown

Still hitting this on Windows 11 specifically — the colon-to-underscore path conversion in the cache dir (superpowers@git+https_/ vs superpowers@git+https://) means git-URL plugin skills are doubly invisible to skill discovery. Combined with #22280, this blocks all superpowers skills on Windows. Happy to test if this gets a review.

@Olyray

Olyray commented Jun 10, 2026

Copy link
Copy Markdown

Still hitting this on Windows 11 specifically — the colon-to-underscore path conversion in the cache dir (superpowers@git+https_/ vs superpowers@git+https://) means git-URL plugin skills are doubly invisible to skill discovery. Combined with #22280, this blocks all superpowers skills on Windows. Happy to test if this gets a review.

How I was able to solve it for myself is that I noticed that I had installed Superpowers in just one project instead of globally.

@Gerkinfeltser

Copy link
Copy Markdown

Thanks for the tip! In my case superpowers is already installed globally — the issue is specifically the plugin config() hook not running before skill discovery (#20940), plus the Windows colon-in-path problem (#22280). The symlink workaround gets it going for now though. Appreciate you sharing what worked for you!

@github-actions

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(skill): Plugin config() hook mutations to skills.paths invisible to skill discovery

4 participants