magic-context icon indicating copy to clipboard operation
magic-context copied to clipboard

UI glitch briefly showing logs when running /ctx-status

Open beh87 opened this issue 5 months ago • 2 comments

Short description

When running /ctx-status the UI briefly glitches some log lines

What happened?

Hi,

there is a strange UI glitch when running /ctx-status. For a very brief moment there are loglines appearing in the UI before the MC status popup comes up. I reproduced that behaviour on 2 win11 machines and an ubuntu machine. I have attached a screenshot of the loglines as well as a .gif showing the behaviour.

Sometimes elements of the loglines stay visible in the status popup, albeit this is less reproducible.

Image Image

Diagnostics

PS C:\dev\Repositories> npx @cortexkit/magic-context@latest doctor
│
●  Detected OpenCode — using it for diagnose.
│
◇  Running doctor for OpenCode…
┌  Magic Context Doctor
│
◆  OpenCode installed
│
◆  Magic Context CLI v0.24.1 is current (npm latest v0.24.1)
│
◆  OpenCode config: C:\Users\beh\.config\opencode\opencode.jsonc
│
◆  Magic Context config: C:\Users\beh\.config\opencode\magic-context.jsonc
│
◆  magic-context.jsonc parses as valid JSONC
│
◆  Magic Context config loads successfully
│
◆  Plugin registered in opencode.jsonc
│
◆  No conflicts detected (compaction, DCP, OMO hooks)
│
◆  TUI sidebar plugin configured
│
◆  Embedding provider: local (Xenova/all-MiniLM-L6-v2 bundled)
│
◆  Shared context DB exists at C:\Users\beh\.local\share\cortexkit\magic-context\context.db
│
◆  openDatabase() opened the shared DB
│
◆  SQLite integrity_check: ok
│
●  Shared DB row counts: tags=1365, compartments=5, memories=8, notes=0, dream_runs=0
│
◆  Plugin cache up to date (v0.24.1)
│
●  Log file: C:\Users\beh\AppData\Local\Temp\opencode\magic-context\magic-context.log (2109 KB)

│
│  Summary: PASS 14 / WARN 0 / FAIL 0
│
└  Everything looks good! ✨

Plugin version

0.24.1

OpenCode version

1.17.7

Platform

win11 / ubuntu 24

Client

OpenCode TUI (CLI)

Log output (optional)


beh87 avatar Jun 15 '26 13:06 beh87

opencode issue, https://github.com/anomalyco/opencode/issues/32253

FurryWolfX avatar Jun 15 '26 13:06 FurryWolfX

You can downgrade to OpenCode v1.17.4.

FurryWolfX avatar Jun 15 '26 13:06 FurryWolfX

Confirmed, and thanks for linking the upstream issue — that's exactly it.

This is cosmetic and your session is unaffected. Here's the mechanism: when you run a /ctx-* command, Magic Context handles it in the command.execute.before hook. OpenCode's plugin API gives no way to say "handled, stop here" from that hook — the only way to prevent OpenCode from also processing the command as a normal prompt is to throw. So we throw a sentinel error (__CONTEXT_MANAGEMENT_..._HANDLED__) that OpenCode previously swallowed silently.

OpenCode 1.17.x changed that: a recent change (anomalyco/opencode#32253, the "restore effect error logging" PR) now surfaces thrown hook errors into the log/TUI, so our intentional control-flow sentinel leaks visibly even though nothing actually failed.

So: nothing to fix on the Magic Context side without a behavior change, and nothing broken in your session. As you noted, OpenCode v1.17.4 doesn't show it. The real fix is an upstream hook to cancel command execution without throwing (e.g. an output.cancel signal); we're tracking that with OpenCode. Keeping this open until that lands.

alfonso-magic-context avatar Jun 17 '26 12:06 alfonso-magic-context