Skip to content

fix(core): log skipped plugin discovery - #59707

Open
Hamza-Abili wants to merge 1 commit into
anomalyco:devfrom
Hamza-Abili:fix-58647-plugin-discovery
Open

Hamza-Abili wants to merge 1 commit into
anomalyco:devfrom
Hamza-Abili:fix-58647-plugin-discovery

Conversation

@Hamza-Abili

@Hamza-Abili Hamza-Abili commented Oct 27, 2026 •

Copy link
Copy Markdown

Issue for this PR

Refs #58647

Type of change

  • Bug fix

What does this PR do?

Plugin discovery silently dropped a configured plugin directory when it had no server/GUI/TUI entrypoint, or when its entrypoint resolved outside the directory (the NixOS/home-manager symlink case). The plugin never loaded and nothing was logged.

This adds two warnings in ConfigPluginSource.scan:

  • no server, GUI, or TUI entrypoint: log the configured target, but only for explicit plugin entries;
  • entrypoint resolves outside the plugin directory: log the configured target, resolved root, and resolved entrypoint.

Behavior is unchanged: GUI-only directories still list for their GUI part, TUI-only directories remain the TUI's own, and the containment rule still skips the directory. The only difference is that the skip is visible. Auto-discovered helper directories such as .opencode/plugins/lib/ do not warn when they have no entrypoint; only explicit plugins entries are treated as misconfigured.

The new test calls scan directly (exported like SkillScan.scan) and covers both skip paths plus a valid plugin, a GUI-only directory, a TUI-only directory, and an auto-discovered helper directory. The symlink case is skipped on Windows.

This addresses the discovery half of #58647. The report's second half (a plugin import failure producing no log) is already covered by the loader's WARN failed to load plugin once a plugin reaches it; I am leaving the issue open with Refs so the reporter can confirm rather than closing it here.

Thanks to @Dante-dan for the reference patch in the issue.

How did you verify your code works?

  • cd packages/core && bun test test/config/plugin-source.test.ts --rerun-each 10 — 60 pass
  • cd packages/core && bun run typecheck — clean
  • cd packages/core && bun test test/plugin/supervisor.test.ts test/config/plugin-source.test.ts — 14 pass
  • prettier --check on both changed files — clean
  • git diff --check — clean

Visual

Not applicable: logging only.

Screenshots / recordings

Not applicable.

Checklist

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

Added by the opencode bot (AI-generated).

Related: #58647, #52300

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works as described. I ran serve from both checkouts on a project with a symlinked-out entrypoint (the NixOS case) and an empty plugin directory. On the base, both plugins are dropped with nothing logged. With this PR, each one gets its new warning, with the target, resolved root and entrypoint. The new tests pass on the PR, and the supervisor tests still pass.

The public API is unchanged. The only change is that ConfigPluginSource.scan is now exported inside core, for the tests.

One point is worth a look (inline): the no-entrypoint warning also fires for subdirectories found automatically in .opencode/plugin(s)/, not only for configured paths.

The issue's second part (a plugin import failure is not logged) is not addressed here, so Closes #58647 may close that issue before that part is fixed.

Related: #52300

@Hamza-Abili
Hamza-Abili force-pushed the fix-58647-plugin-discovery branch from 56f08ef to bf875c7 Compare October 27, 2026 20:17

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new commit addresses the earlier point: the no-entrypoint warning now fires only for explicit plugins entries, not for helper folders found automatically in .opencode/plugins/. I checked this by running serve on a project with a symlinked-out plugin, an empty configured plugin directory and an auto-discovered plugins/lib/ helper folder. The first two each log their warning, and the helper folder logs nothing. The tests pass. The public API is unchanged. No new concerns.

@Hamza-Abili

Copy link
Copy Markdown
Author

Hi @Hona, could you take a look at this small diagnostics PR when you have a moment? It only adds warnings in ConfigPluginSource; the automatic review has no open concerns. Thanks!

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This push is a rebase onto a newer dev. The PR's own change is identical to the commit reviewed before, and source.ts has not changed upstream since. The focused tests still pass on the new head. The public API is unchanged. No new concerns.

@Hamza-Abili

Copy link
Copy Markdown
Author

Hi @kitlangton, this is a small diagnostics change in ConfigPluginSource.scan (the discovery path from #41784): it logs the two cases where a configured plugin directory is skipped, instead of dropping it silently. The automated review has no open findings.

The required checks (typecheck, unit, e2e, bot-scope) are still action_required because the fork workflows need maintainer approval, so they have not run yet. Could you approve them when you have a moment? Thanks!

@Hamza-Abili
Hamza-Abili force-pushed the fix-58647-plugin-discovery branch from 89aa254 to 022c46a Compare November 3, 2026 09:27

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This push is a rebase onto a newer dev. The PR's change is the same as in the commit reviewed before. The only upstream change to source.ts (#61176) is in the watch and change-feed code, not scan, so there is nothing to reconcile. The focused tests still pass on the new head. The public API is unchanged. No new concerns.

A plugin directory with no server, GUI, or TUI entrypoint, or whose
entrypoint resolves outside the directory (for example a NixOS/home-manager
symlink into /nix/store), was dropped without any log line. Log a warning
with the configured target and, for containment, the resolved root and
entrypoint. The containment and loading behavior is unchanged.

The no-entrypoint warning is limited to explicit plugin entries; helper
directories discovered under .opencode/plugin(s)/ stay silent. Add focused
tests for both skip paths, the GUI-only and TUI-only semantics, a valid
plugin, and an auto-discovered helper directory.

Based on the reference patch by @Dante-dan in the issue.

Refs anomalyco#58647
@Hamza-Abili
Hamza-Abili force-pushed the fix-58647-plugin-discovery branch from 022c46a to bf7b09c Compare November 10, 2026 13:58

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This push is a rebase onto a newer dev. The PR's change is the same as in the commit reviewed before, and source.ts has not changed upstream since the last review. The focused tests still pass on the new head. The public API is unchanged. No new concerns.

This branch has not been deployed

No deployments
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.

1 participant