Skip to content

opencode plugins: V2 primary-session prompt hangs when @cortexkit/opencode-magic-context@0.42.6 is loaded #493

Description

@deltacat

Short description

opencode v2 hangs when the plugin enabled

What happened?

Summary

Loading the third-party plugin @cortexkit/opencode-magic-context@0.42.6 as a server plugin
(plugins in opencode.jsonc) makes OpenCode V2 primary-session prompts hang: the user message
is accepted but no assistant response ever arrives. Removing the plugin restores normal responses
immediately.

Environment

  • opencode version: 2.0.11
  • OS: Linux 6.6.87.2-microsoft-standard-WSL2 (WSL2), x86_64
  • Terminal: TERM=xterm-256color, TERM_PROGRAM=vscode, COLORTERM=truecolor
  • Shell: /bin/zsh
  • Install/channel: latest
  • Active plugins: none while reproducing the workaround; plugin under test is
    @cortexkit/opencode-magic-context@0.42.6 (latest on npm, published 2026-09-19), which declares
    OpenCode 2 support.

Reproduction

  1. Add @cortexkit/opencode-magic-context@latest to plugins in ~/.config/opencode/opencode.jsonc
    (server config) and set compaction.auto: false.
  2. Start or restart OpenCode V2. (Config hot-reload also picks the change up.)
  3. Open a session and submit any prompt.
  4. The prompt is accepted, but no assistant response is produced; the session appears to wait forever.

Expected Behavior

The plugin loads, the session responds normally, and Magic Context manages context.

Actual Behavior

The session never responds. Observed diagnostics:

  • Server log shows the plugin loaded repeatedly within a single run (6 loads in one run; e.g. 4 loads
    within one second at 2026-09-21T01:17:56).
  • During the hung window the plugin wrote nothing to its data dir
    ~/.local/share/cortexkit/magic-context/ (rpc/ and context.db kept an older timestamp),
    suggesting it stalls before initializing storage.
  • No FailClosedBlockingError was logged during the V2 period.
  • Removing the plugin from plugins immediately restores responses.

Additional Context

  • The plugin is V2-aware: 0.42.6 ships dist/v2/server.js, detects a V2 host via ctx.session.hook,
    and writes model-context-limits-opencode2.json.
  • It declares "oc-plugin": ["server", "tui"] and exports . (server) plus ./tui (terminal).
  • Its config exposes fail_closed_blocking (default true): "When Magic Context cannot operate
    (schema fence mismatch, storage open/migration failure), block the primary-session prompt with a
    loud recovery error". No such error appeared in the logs, so the hang looks more like an early
    setup deadlock than the fail-closed path.
  • Registration placement verified: cli.json plugins only loads terminal-only plugins, so the
    server half must live in opencode.jsonc plugins. Both "server only" and "server + cli"
    placements still hang.
  • Workaround in use: keep the plugin disabled. Reproducibility: consistent (100%).

Diagnostics

Plugin version

0.42.6

OpenCode version

2.0.11

Platform

Win11 x64 -> WSL2

Client

OpenCode TUI (CLI)

Log output (optional)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions