Skip to content

fix: merge plugin selections (resolves #4565)#4724

Merged
rekram1-node merged 8 commits into
anomalyco:devfrom
ariane-emory:fix/merge-plugin-selections
Nov 25, 2025
Merged

fix: merge plugin selections (resolves #4565)#4724
rekram1-node merged 8 commits into
anomalyco:devfrom
ariane-emory:fix/merge-plugin-selections

Conversation

@ariane-emory

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

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Collaborator

2 nits but looks good

@ariane-emory

Copy link
Copy Markdown
Contributor Author

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

@ariane-emory

Copy link
Copy Markdown
Contributor Author

Done.

@rekram1-node

Copy link
Copy Markdown
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

opencode-agent Bot commented Nov 25, 2025

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Collaborator

Thank you!

@ariane-emory
ariane-emory deleted the fix/merge-plugin-selections branch November 27, 2025 04:07
xywsxp pushed a commit to xywsxp/opencode that referenced this pull request Apr 24, 2026
Co-authored-by: Dax Raad <d@ironbay.co>
Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com>
Rwanbt pushed a commit to Rwanbt/opencode that referenced this pull request May 5, 2026
Co-authored-by: Dax Raad <d@ironbay.co>
Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com>
AIALRA-0 pushed a commit to AIALRA-0/opencode-turn-engine that referenced this pull request Jun 10, 2026
Co-authored-by: Dax Raad <d@ironbay.co>
Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com>
AIALRA-0 pushed a commit to AIALRA-0/opencode-turn-engine that referenced this pull request Jun 10, 2026
Co-authored-by: Dax Raad <d@ironbay.co>
Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com>
avion23 pushed a commit to avion23/opencode that referenced this pull request Jun 10, 2026
Co-authored-by: Dax Raad <d@ironbay.co>
Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com>
Rwanbt pushed a commit to Rwanbt/opencode that referenced this pull request Jun 14, 2026
Co-authored-by: Dax Raad <d@ironbay.co>
Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com>
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