Skip to content

Conversation

@ariane-emory
Copy link
Contributor

@ariane-emory ariane-emory commented Nov 25, 2025

Resolves #4565.

I stumbled onto a version of 4565 myself while I was messing around editing opencode's source: when I launched opencode in it's own source directory, my bell plugin at ~/.config/opencode/plugin/bell.ts (just plays a sound when the session idles, nothing fancy) stopped making noise. After poking around a bit, I discovered that this was a consequence of opencode/.opencode/opencode.jsonc specifying plugin selections, which were replacing (instead of being combined with) my own globally selected plugins.

This PR fixes that, merging the globally selected plugins with those selected locally in the project.

@ariane-emory ariane-emory changed the title fix: merge plugin selections (resolves 4565) fix: merge plugin selections (resolves #4565) Nov 25, 2025
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we undo this? Whyd we change it

Copy link
Collaborator

Choose a reason for hiding this comment

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

ditto?

@rekram1-node
Copy link
Collaborator

2 nits but looks good

@ariane-emory
Copy link
Contributor Author

Not sure why or how that file changed, I will revert it back to match HEAD.

@ariane-emory
Copy link
Contributor Author

Done.

@rekram1-node
Copy link
Collaborator

/oc update the plugin merging so that it uses a set to prevent duplicates

@anomalyco anomalyco deleted a comment from opencode-agent bot Nov 25, 2025
@opencode-agent
Copy link
Contributor

opencode-agent bot commented Nov 25, 2025

Excellent! All typechecks pass. Let me create a summary of what was changed:

Summary

I've successfully updated the plugin merging logic in /home/runner/work/opencode/opencode/packages/opencode/src/config/config.ts to use a Set for deduplication. Here's what was changed:

Changes Made

File: packages/opencode/src/config/config.ts

  • Line 29: Modified the mergeConfigWithPlugins function to use a Set for plugin deduplication
  • Before: merged.plugin = [...target.plugin, ...source.plugin]
  • After:
    const pluginSet = new Set([...target.plugin, ...source.plugin])
    merged.plugin = Array.from(pluginSet)

File: packages/opencode/test/config/config.test.ts

  • Added new test: "deduplicates duplicate plugins from global and local configs" to verify the deduplication functionality works correctly

Benefits

  1. Prevents duplicate plugins: When the same plugin appears in both global and local configs, it will only be loaded once
  2. Maintains existing behavior: All unique plugins from both configs are still merged and loaded
  3. Performance improvement: Avoids loading the same plugin multiple times
  4. Backward compatibility: No breaking changes to the API or configuration format

Verification

  • ✅ All existing tests pass (18/18)
  • ✅ New deduplication test passes
  • ✅ Type checking passes for all packages
  • ✅ No linting issues

The change is minimal, focused, and maintains the existing plugin merging behavior while adding deduplication to prevent duplicates as requested.

New%20session%20-%202025-11-25T17%3A32%3A12.700Z
opencode session  |  github run

Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com>
@rekram1-node rekram1-node merged commit 4273fa9 into anomalyco:dev Nov 25, 2025
3 checks passed
@rekram1-node
Copy link
Collaborator

Thank you!

@ariane-emory ariane-emory deleted the fix/merge-plugin-selections branch November 27, 2025 04:07
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.

[QUESTION] Should .opencode/opencode.jsonc should be removed and gitignored?

4 participants