Skip to content

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

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

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

@pascalandr

pascalandr commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Thanks @High-cla
We don’t think the DB/schema migration part should live in CodeNomad. OpenCode owns that database, and anomalyco/opencode#32093 addresses this at the opencode layer with db doctor / db repair, dry-run/apply separation, backups, transactions, and post-checks. CodeNomad should not silently mutate the OpenCode DB on workspace launch.

For the OpenCode 1.16+ compatibility concern, I’m not sure there is still an issue to fix here. Issue #525 appears to have been addressed by #526 (“Support OpenCode SDK 1.16 runtime APIs”), and there is also feedback on #525 saying OpenCode v1.16.2 works fine.

Before keeping any plugin compatibility changes, could you provide a fresh repro/evidence for what is still broken on current dev with OpenCode 1.16.2+? For example: plugin failing to load, tools missing, voice-mode hook not running, or a specific error/log.

If there is still a real plugin-specific regression, I think you should narrow the PR to it.

@shantur

shantur commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator

Also as per my investigation, there aren't any changes needed to plugin too.

@shantur

shantur commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator

Please re-open this if you feel otherwise.

@shantur shantur closed this Jun 13, 2026
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.

3 participants