Skip to content

fix(skill): read plugin-modified config for skills.paths discovery#20939

Open
sjawhar wants to merge 1 commit intoanomalyco:devfrom
sjawhar:fix/plugin-config-skill-paths
Open

fix(skill): read plugin-modified config for skills.paths discovery#20939
sjawhar wants to merge 1 commit intoanomalyco:devfrom
sjawhar:fix/plugin-config-skill-paths

Conversation

@sjawhar
Copy link
Copy Markdown

@sjawhar sjawhar commented Apr 3, 2026

Fixes #20940

Issue for this PR

Related: #20026 (same root cause for providers), PR #20777

Type of change

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

What does this PR do?

Plugins that register skill directories via their config() hook (e.g. superpowers) are invisible to skill discovery. The plugin mutates cfg.skills.paths, but the Skill service never sees it.

Root cause: Each service's makeRuntime creates a separate InstanceState scope. When Plugin calls config.get() and a plugin's config() hook mutates cfg.skills.paths, that mutation only affects Plugin's scoped copy of the config. When Skill independently calls config.get(), it gets a separate copy — the mutation is invisible.

This is the same class of bug as #20026 (plugin providers disappearing after instance dispose).

Fix: Plugin already runs config hooks and holds the post-hook config object. This PR:

  1. Plugin: Stores the mutated config in state and exposes Plugin.config() — the single source of truth for post-hook config.
  2. Skill: Calls Plugin.config() (via dynamic import, same pattern Plugin already uses for Skill.all()) to read skills.paths from the authoritative source.

No replay of hooks, no layer dependency changes, no circular imports.

Before: 50 skills (0 from superpowers plugin)
After: 64 skills (14 superpowers skills discovered)

How did you verify your code works?

  • bun typecheck — clean
  • bun test test/skill/skill.test.ts — 11 pass, 0 fail
  • Binary build: verified skill count goes from 50 → 64 with superpowers plugin installed

Checklist

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2026

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@sjawhar sjawhar force-pushed the fix/plugin-config-skill-paths branch 2 times, most recently from c537bbd to 1d7ad72 Compare April 8, 2026 23:10
@Cosss7
Copy link
Copy Markdown

Cosss7 commented Apr 9, 2026

good catch, hope it can be merged soon.

Plugin config() hooks that mutate cfg.skills.paths (e.g. superpowers) were
invisible to skill discovery because each service's makeRuntime creates a
separate InstanceState scope. Plugin.config() now exposes the post-hook
config as the single source of truth.
@sjawhar sjawhar force-pushed the fix/plugin-config-skill-paths branch from 1d7ad72 to a7ce39e Compare April 9, 2026 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants