Skip to content

fix(installer): load the OpenCode plugin once on v1 and v2 - #6744

Open
fancyboi999 wants to merge 1 commit into
volcengine:mainfrom
fancyboi999:fix/6736-opencode-install-discovery
Open

fancyboi999 wants to merge 1 commit into
volcengine:mainfrom
fancyboi999:fix/6736-opencode-install-discovery

Conversation

@fancyboi999

Copy link
Copy Markdown
Contributor

Description

The installer puts both plugins/openviking/ and plugins/openviking.js in OpenCode's discovery directory. OpenCode v2 discovers both sources and rejects the second instance with Duplicate plugin ID: openviking, although the installer reports success.

Put the package in ~/.config/opencode/openviking-plugin/ and keep plugins/openviking.js as the single discoverable entrypoint. This layout works with v1's file scanner and v2's file/directory scanner without version detection. Reinstallation removes the old package directory while preserving runtime state and unrelated plugins.

Human Involvement

  • A human participated in the implementation or review loop
  • This PR was generated entirely by AI agents without human participation in the loop

Related Issue

Fixes #6736

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test update

Changes Made

  • Move the installer-owned payload outside plugin discovery; update the source-install wrapper, validation, path preview and uninstall instructions.
  • Update the existing dev/archive installation contract to cover legacy-directory cleanup, preserved session state and unrelated plugins, and importing the installed wrapper.
  • Update both English/Chinese installation guides and bump the OpenCode plugin to 0.5.24.

Testing

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have tested this on the following platforms:
    • Linux
    • macOS (arm64)
    • Windows
Check Result
node --test examples/memory-plugin-shared/install-opencode-jsonc.test.mjs examples/memory-plugin-shared/install-sources.test.mjs 27 passed
npm test --prefix examples/opencode-plugin 56 passed
npm run check --prefix examples/opencode-plugin Passed
node docs/scripts/check-docs-consistency.mjs Passed; six existing JSONC/illustrative blocks excluded from strict JSON parsing
bash -n examples/memory-plugin-shared/install.sh Passed
Plugin version gate and diff whitespace checks Passed

Real host checks used the published OpenCode 2.2.0 and 1.18.32 binaries with isolated HOME/XDG paths:

  • The original installer produces two v2 inventory entries: one active, one failed with the duplicate-ID error. The updated dev-install contract also fails against the original installer because the legacy directory survives.
  • Dev and staged-release archive installs each produce one active v2 plugin and one connected MCP server. The archive home contains spaces. Repeated installs preserve the config, its comment, existing runtime state, and another working plugin.
  • Restoring the legacy directory recreates the duplicate-ID failure; rerunning the patched archive installer restores one active instance.
  • v1 resolves one OpenViking wrapper, records one plugin MCP registration, and connects successfully.
  • Both installed proxies complete MCP initialize, list 20 tools, and successfully call list on viking://resources against an isolated OpenViking 0.5.0 server. A local deterministic embedding fixture supports server bootstrap; model inference and retrieval quality were not tested.

The plugin suite emits temporary-log ENOENT diagnostics while exiting successfully. The same diagnostics reproduce on unchanged main with all 56 tests passing. No temporary reproduction scripts or debug instrumentation are included in this PR.

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Screenshots (if applicable)

N/A; validated using host inventories, HTTP responses and MCP calls.

Additional Notes

Restart OpenCode and its background service after updating an existing installation so its cached plugin inventory reloads.

@fancyboi999
fancyboi999 force-pushed the fix/6736-opencode-install-discovery branch from cfbaa5f to 32e7de4 Compare November 6, 2026 01:27

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

agent-plugins Agent harness and plugin integrations

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

OpenCode 2.x loads the OpenViking plugin twice (plugins/openviking + plugins/openviking.js) — duplicate plugin id, one MCP server always failed

2 participants