Skip to content

fix: update plugin for OpenCode 1.16.0+ compatibility and add schema migration#527

Open
High-cla wants to merge 2 commits into
NeuralNomadsAI:devfrom
High-cla:dev
Open

fix: update plugin for OpenCode 1.16.0+ compatibility and add schema migration#527
High-cla wants to merge 2 commits into
NeuralNomadsAI:devfrom
High-cla:dev

Conversation

@High-cla

@High-cla High-cla commented Jun 7, 2026

Copy link
Copy Markdown

Summary

Fixes two compatibility issues between CodeNomad and OpenCode v1.16.0+:

Issue #525 — Plugin Compatibility with OpenCode 1.16.0+

Changes:

  • packages/opencode-plugin/package.json: Bumped @opencode-ai/plugin from 1.3.7 to ^1.16.0 and added the "oc-plugin" field for npm plugin discovery
  • packages/opencode-plugin/plugin/codenomad.ts: Updated to the new Plugin type from @opencode-ai/plugin, replaced the old chat.message hook with experimental.chat.system.transform, and added export const server: Plugin for the PluginModule format (required by the v1.16+ loader)
  • packages/opencode-plugin/plugin/lib/background-process.ts: Changed tool import from @opencode-ai/plugin/tool to @opencode-ai/plugin (tool is now re-exported from the main entry)

Issue #31204 — session_message.seq NOT NULL Constraint Failure

Changes:

  • packages/server/src/workspaces/migration.ts (new): Non-blocking schema migration utility that checks the OpenCode database and fixes the seq column if needed
  • packages/server/src/workspaces/runtime.ts: Calls checkAndFixOpencodeSchema() before spawning OpenCode instances

The migration handles three cases:

  1. Column missingALTER TABLE ADD COLUMN seq INTEGER NOT NULL DEFAULT 0
  2. Column exists, no default → Full table recreation via SQL
  3. Already has DEFAULT 0 → No-op

Testing

  • tsc --noEmit on both packages: Zero errors
  • Integration tests added for migration module (4 tests, all passing)
  • All existing tests continue to pass
  • Uses opencode db command (no external dependencies)

High-cla added 2 commits June 7, 2026 16:30
- Tests database path detection
- Verifies PRAGMA schema inspection
- Confirms no-op when seq already has DEFAULT 0
- Validates graceful failure on missing binary
@github-actions

github-actions Bot commented Jun 7, 2026

Copy link
Copy Markdown

PR builds are available as GitHub Actions artifacts:

https://github.com/NeuralNomadsAI/CodeNomad/actions/runs/27087761913

Artifacts expire in 7 days.
Artifacts: (none found on this run)

@shantur

shantur commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator

Hi @High-cla

Thanks for the PR. I have made some fixes in dev for the 1.16+ support. Can you check if that works for you

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.

2 participants