Description
The /ctx-* slash commands (ctx-status, ctx-recomp, ctx-aug, ctx-dream, ctx-flush) fail when OpenCode is running in web mode (opencode web --port <port>). The commands execute their logic and send a toast via /tui/show-toast, but the sentinel error they throw to prevent LLM forwarding causes the web server to report a failure to the browser UI.
Environment
- OpenCode: web mode (
opencode web --port 3456 --hostname 127.0.0.1) - Magic Context:
@cortexkit/opencode-magic-context@0.7.3 - OS: Ubuntu (cloud VM, headless)
Steps to Reproduce
- Run OpenCode in web mode:
opencode web --port 3456 - Open a session in the browser
- Run any
/ctx-* command (e.g. /ctx-status, /ctx-aug, /ctx-recomp) - Command appears to fail in the UI
Expected Behavior
Commands should execute and display their output in the web UI, same as in TUI mode.
Actual Behavior
The web server catches the sentinel error (e.g. __CONTEXT_MANAGEMENT_CTX-AUG_HANDLED__) and returns a failed status. The toast sent to /tui/show-toast doesn't render in the web client.
From OpenCode logs:
INFO service=session.prompt command=ctx-aug parts=[] sessionID=ses_xxx command
ERROR service=server error=__CONTEXT_MANAGEMENT_CTX-AUG_HANDLED__ failed
INFO service=session.prompt command=ctx-recomp parts=[] sessionID=ses_xxx command
ERROR service=server error=__CONTEXT_MANAGEMENT_CTX-RECOMP_HANDLED__ failed
The toast request fires but targets the TUI endpoint:
INFO service=server method=POST path=/tui/show-toast request
Notes
- The agent tools (
ctx_reduce, ctx_expand, ctx_note, ctx_memory, ctx_search) work perfectly in web mode - only the slash commands are affected. - The sentinel error pattern works in TUI mode because the TUI swallows the error and renders the toast inline.
- Web mode doesn't have a toast renderer, so the command output is lost and only the error surfaces.
Description
The
/ctx-*slash commands (ctx-status,ctx-recomp,ctx-aug,ctx-dream,ctx-flush) fail when OpenCode is running in web mode (opencode web --port <port>). The commands execute their logic and send a toast via/tui/show-toast, but the sentinel error they throw to prevent LLM forwarding causes the web server to report a failure to the browser UI.Environment
opencode web --port 3456 --hostname 127.0.0.1)@cortexkit/opencode-magic-context@0.7.3Steps to Reproduce
opencode web --port 3456/ctx-*command (e.g./ctx-status,/ctx-aug,/ctx-recomp)Expected Behavior
Commands should execute and display their output in the web UI, same as in TUI mode.
Actual Behavior
The web server catches the sentinel error (e.g.
__CONTEXT_MANAGEMENT_CTX-AUG_HANDLED__) and returns afailedstatus. The toast sent to/tui/show-toastdoesn't render in the web client.From OpenCode logs:
The toast request fires but targets the TUI endpoint:
Notes
ctx_reduce,ctx_expand,ctx_note,ctx_memory,ctx_search) work perfectly in web mode - only the slash commands are affected.