Short description
OpenCode 2 lane: ctx_* tools, sidebar/RPC data, /ctx-* commands, context numbers, /ctx-dream and compaction-off mode are all missing or broken
What happened?
On OpenCode 2 (plugin lane 0.42.6), a large part of Magic Context's surface never engages. Expected behaviour is parity with the OpenCode 1 lane.
Observed, in order of impact:
- No agent tools. The
ctx_* tool set (ctx_search, ctx_reduce, ctx_note, …) is never registered on the v2 lane, so the agent cannot use them at all.
- Sidebar/status have no data. The v2 TUI is a pure RPC client (no direct SQLite access), and the v2 lane never starts the plugin's RPC server — so the sidebar renders zeros and
/ctx-status has nothing to read.
/ctx-* TUI commands don't exist. Direct keymap registration fails because the host's keymap provider isn't mounted during plugin setup; the lane never falls back to a slot that is mounted.
- Context numbers are wrong. The sidebar reads
Context 0.0% · 0/200k: usage is never persisted on the v2 lane (v1 persists from its event handler), the harness-keyed model-limit cache is never warmed (so every limit falls back to the generic 200k instead of the model's real window), and model recovery for sessions without a live entry reads only the frozen v1 tables.
/ctx-dream can't run. The command isn't wired, and scheduled dream tasks that require a tool loop pile up as failures because v2 hidden completions have no tool loop.
- Compaction-off projects get nothing. When MC compaction is disabled in config, the v2 lane early-returns, so those projects lose the tools, the RPC surface and the memory/docs injection too — unlike v1, where compaction-off only skips the compaction machinery.
- Historian/recomp notify paths are inert on v2 (no SDK-client seam), and the historian runner can't reach the lane's hidden-completion executor.
Reproduction: run OpenCode 2 with the plugin enabled on any project; open the sidebar (zeros), check the available tools (no ctx_*), try /ctx- (no commands), run /ctx-dream (nothing). On a store migrated from OpenCode 1.18, the lane is additionally gated by the migrated-store guard (#477), which is a separate open PR.
Root causes (short)
- v2
registerContext registered neither the tool registry nor the RPC server, and its TUI never registered the command keymap layer.
- The lane has no event handler (by design), so the v1 usage-persistence path doesn't run there; the limit cache is keyed per harness and the
opencode2 file was never created.
- The compaction-off switch was implemented as an early return instead of a mode that only skips compaction machinery.
- Model recovery preferred/only read the frozen v1 message tables.
Diagnostics
- Plugin version: 0.42.6
- OpenCode version: 2.0.10
- Platform: macOS arm64
- Client: OpenCode TUI (CLI)
- Harness: OpenCode 2 only. Pi/OMP are unaffected by the lane defects (two shared modules the fix touches — the dreamer task scheduler and the recomp orchestrator — are covered for Pi/oh-my-pi by the shared suite).
Evidence: sidebar shows Context 0.0% · 0/200k; session_meta.last_context_percentage/last_input_tokens stay at 0 despite active turns; the tool list contains no ctx_* entries; /ctx-status and /ctx-dream are absent from the command palette.
Log output (excerpts)
# sidebar with no live session data (pre-fix)
Context 0.0% · 0/200k
# dream tasks failing instead of being reported as unsupported (pre-fix)
[dreamer] task verify failed code=MC-D02 (transient=false): HiddenCompletionRefusal message="hidden_tools_unsupported: verify requires tools; opencode2 hidden completions have no tool loop"
Relationship to the fix
Draft PR #487 implements the lane fixes above (tools, RPC server, /ctx-* via the app slot, compaction-off mode, context numbers, /ctx-dream, plus review hardening). This issue is the umbrella approval request for that PR per CONTRIBUTING.md (an approved issue is required before the PR leaves draft); it complements the PR rather than closing it.
Related but distinct: #477 (migrated-store guard — required for the lane to engage on stores migrated from 1.18; excluded from #487 to avoid stepping on it), #483 (historian max_output_tokens on ChatGPT-subscription logins), #475 (migration 85 relabels a real OC2 host's rows), #481 (closed — failed historian runs leaving hidden sessions).
Diagnostics
Plugin version
0.42.6
OpenCode version
2.0.10
Platform
macOS
Client
OpenCode TUI (CLI)
Log output (optional)
Short description
OpenCode 2 lane:
ctx_*tools, sidebar/RPC data,/ctx-*commands, context numbers,/ctx-dreamand compaction-off mode are all missing or brokenWhat happened?
On OpenCode 2 (plugin lane 0.42.6), a large part of Magic Context's surface never engages. Expected behaviour is parity with the OpenCode 1 lane.
Observed, in order of impact:
ctx_*tool set (ctx_search,ctx_reduce,ctx_note, …) is never registered on the v2 lane, so the agent cannot use them at all./ctx-statushas nothing to read./ctx-*TUI commands don't exist. Direct keymap registration fails because the host's keymap provider isn't mounted during plugin setup; the lane never falls back to a slot that is mounted.Context 0.0% · 0/200k: usage is never persisted on the v2 lane (v1 persists from its event handler), the harness-keyed model-limit cache is never warmed (so every limit falls back to the generic 200k instead of the model's real window), and model recovery for sessions without a live entry reads only the frozen v1 tables./ctx-dreamcan't run. The command isn't wired, and scheduled dream tasks that require a tool loop pile up as failures because v2 hidden completions have no tool loop.Reproduction: run OpenCode 2 with the plugin enabled on any project; open the sidebar (zeros), check the available tools (no
ctx_*), try/ctx-(no commands), run/ctx-dream(nothing). On a store migrated from OpenCode 1.18, the lane is additionally gated by the migrated-store guard (#477), which is a separate open PR.Root causes (short)
registerContextregistered neither the tool registry nor the RPC server, and its TUI never registered the command keymap layer.opencode2file was never created.Diagnostics
Evidence: sidebar shows
Context 0.0% · 0/200k;session_meta.last_context_percentage/last_input_tokensstay at 0 despite active turns; the tool list contains noctx_*entries;/ctx-statusand/ctx-dreamare absent from the command palette.Log output (excerpts)
Relationship to the fix
Draft PR #487 implements the lane fixes above (tools, RPC server,
/ctx-*via the app slot, compaction-off mode, context numbers,/ctx-dream, plus review hardening). This issue is the umbrella approval request for that PR perCONTRIBUTING.md(an approved issue is required before the PR leaves draft); it complements the PR rather than closing it.Related but distinct: #477 (migrated-store guard — required for the lane to engage on stores migrated from 1.18; excluded from #487 to avoid stepping on it), #483 (historian
max_output_tokenson ChatGPT-subscription logins), #475 (migration 85 relabels a real OC2 host's rows), #481 (closed — failed historian runs leaving hidden sessions).Diagnostics
Plugin version
0.42.6
OpenCode version
2.0.10
Platform
macOS
Client
OpenCode TUI (CLI)
Log output (optional)