Summary
On OpenCode V2 (2.0.18), loading @cortexkit/opencode-magic-context (npm latest 0.43.2, freshly installed) makes every session turn die in silence: the user message is stored, the turn is refused before the provider call, the host records idle {outcome:"interrupted"} ~60–360 ms later, and no assistant message is ever produced. The TUI shows no reply and no visible error. Same symptom class as the closed #493; still reproducible with the current npm release on this host.
Environment
- OpenCode V2:
2.0.18 (both ~/tools/ocv2/opencode and ~/.opencode/bin/opencode2), Linux
- magic-context:
0.43.2 — reproduced with the previously cached install and with a fresh install after clearing ~/.cache/opencode/npm/@cortexkit/opencode-magic-context@latest (new cache dir created, version verified 0.43.2)
- V1:
1.18.32 with the same plugin on the same host works normally (its Magic Context transforms run; see the plugin log)
- Context store:
~/.local/share/cortexkit/magic-context/context.db (118 MB, journal_mode=wal, WAL ~6 MB, actively written; the store is V1-era — the plugin log contains historical refusing to migrate … from upstream migration v79 to v85 lines from 2026-09-24)
~/.local/share/opencode/opencode.db is ~2.7 GB and shared by V1+V2 on this host
Symptom / evidence
session_message rows (~/.local/share/opencode/opencode.db) for a refused turn:
seq 4 user "say PB-shared" t=…4983132
seq 5 idle {"outcome":"interrupted"} t=…4983492 ← 360 ms later; no assistant row
Console trace at refusal time (observed in a standalone V2 run):
[magic-context] v2 refuseIfUnsafe warn: context storage is not durable
Timeline: last successful assistant message = 2026-09-26 21:28:52 (before V2 had ever loaded plugins on this host); the V2 plugin caches were first populated 21:34–35 that day; every V2 turn since has been interrupted.
Controlled experiment (minimal repro)
Standalone V2 server (opencode --standalone, isolated XDG_CONFIG_HOME) with a minimal opencode.json containing exactly one plugin entry; submit a message; read session_message.outcome:
| plugin loaded |
outcome |
| (none) |
succeeded — assistant reply generated (tokens billed) |
only oh-my-opencode-slim |
succeeded |
only a local herdr reporting plugin (V2 setup() no-op) |
succeeded |
only @cortexkit/opencode-magic-context@latest (fresh 0.43.2) |
interrupted, no assistant message |
Code pointers (master)
packages/plugin/src/v2/hooks/context.ts:709 and :838 — if (!db || !isDatabasePersisted(db)) throw new Error("context storage is not durable");
packages/plugin/src/v2/hooks/context.ts:277 — reportPreProviderRefusal() → console.warn("[magic-context] v2 refuseIfUnsafe", error); its comment states the host then stores the turn as interrupted and the user simply never receives a reply — no error on screen and no assistant message.
packages/plugin/src/v2/hooks/context.ts:1291–1305 — refusals are thrown as V2ContextRefusal (a fail-open branch exists only for compactionOff).
packages/plugin/src/features/magic-context/storage-db.ts:2529 — isDatabasePersisted(db) returns a WeakMap flag set during database open; getDatabasePersistenceError(db) holds the reason and is not surfaced anywhere user-visible.
- On this host the plugin's own session log (
$TMPDIR/opencode/magic-context/magic-context.log) contains no v2 refusing this turn before the model call lines for the V2 refusals — the only trace is the console warning.
Related
Expected
Repro steps
- V2 config with only this plugin:
{"$schema":"https://opencode.ai/config.json","plugin":["@cortexkit/opencode-magic-context@latest"]}
opencode --standalone (or any V2 server) and send any prompt.
- Observe: no assistant reply;
session_message = user → idle {outcome:"interrupted"}; console = v2 refuseIfUnsafe + context storage is not durable.
Summary
On OpenCode V2 (2.0.18), loading
@cortexkit/opencode-magic-context(npm latest 0.43.2, freshly installed) makes every session turn die in silence: the user message is stored, the turn is refused before the provider call, the host recordsidle {outcome:"interrupted"}~60–360 ms later, and no assistant message is ever produced. The TUI shows no reply and no visible error. Same symptom class as the closed #493; still reproducible with the current npm release on this host.Environment
2.0.18(both~/tools/ocv2/opencodeand~/.opencode/bin/opencode2), Linux0.43.2— reproduced with the previously cached install and with a fresh install after clearing~/.cache/opencode/npm/@cortexkit/opencode-magic-context@latest(new cache dir created, version verified 0.43.2)1.18.32with the same plugin on the same host works normally (its Magic Context transforms run; see the plugin log)~/.local/share/cortexkit/magic-context/context.db(118 MB,journal_mode=wal, WAL ~6 MB, actively written; the store is V1-era — the plugin log contains historicalrefusing to migrate … from upstream migration v79 to v85lines from 2026-09-24)~/.local/share/opencode/opencode.dbis ~2.7 GB and shared by V1+V2 on this hostSymptom / evidence
session_messagerows (~/.local/share/opencode/opencode.db) for a refused turn:Console trace at refusal time (observed in a standalone V2 run):
Timeline: last successful assistant message = 2026-09-26 21:28:52 (before V2 had ever loaded plugins on this host); the V2 plugin caches were first populated 21:34–35 that day; every V2 turn since has been
interrupted.Controlled experiment (minimal repro)
Standalone V2 server (
opencode --standalone, isolatedXDG_CONFIG_HOME) with a minimalopencode.jsoncontaining exactly onepluginentry; submit a message; readsession_message.outcome:succeeded— assistant reply generated (tokens billed)oh-my-opencode-slimsucceededsetup()no-op)succeeded@cortexkit/opencode-magic-context@latest(fresh 0.43.2)interrupted, no assistant messageCode pointers (master)
packages/plugin/src/v2/hooks/context.ts:709and:838—if (!db || !isDatabasePersisted(db)) throw new Error("context storage is not durable");packages/plugin/src/v2/hooks/context.ts:277—reportPreProviderRefusal()→console.warn("[magic-context] v2 refuseIfUnsafe", error); its comment states the host then stores the turn as interrupted and the user simply never receives a reply — no error on screen and no assistant message.packages/plugin/src/v2/hooks/context.ts:1291–1305— refusals are thrown asV2ContextRefusal(a fail-open branch exists only forcompactionOff).packages/plugin/src/features/magic-context/storage-db.ts:2529—isDatabasePersisted(db)returns a WeakMap flag set during database open;getDatabasePersistenceError(db)holds the reason and is not surfaced anywhere user-visible.$TMPDIR/opencode/magic-context/magic-context.log) contains nov2 refusing this turn before the model calllines for the V2 refusals — the only trace is the console warning.Related
context storage is not durable) appears to be a distinct one.Expected
Repro steps
{"$schema":"https://opencode.ai/config.json","plugin":["@cortexkit/opencode-magic-context@latest"]}opencode --standalone(or any V2 server) and send any prompt.session_message=user→idle {outcome:"interrupted"}; console =v2 refuseIfUnsafe+context storage is not durable.