cmux: suppress OK output from notify RPC calls#15
Conversation
The cmux CLI outputs 'OK' to stdout on success for notification.create. When opencode-cmux calls the CLI, this pollutes the user's terminal. Redirect stdout/stderr to /dev/null so notifications are silent. Fixes visual noise in live terminal where opencode-cmux is active.
d653270 to
34a782c
Compare
There was a problem hiding this comment.
hey @ErebusBat thanks!
review from my agent:
Thanks for this, and for flagging the noise — silent notifications are absolutely the right goal. Before merging I dug into it, and unfortunately this change can't go in as-is. Two issues, both verified locally against bun 1.3.10:
- > /dev/null 2>&1 is invalid syntax in Bun Shell and throws a parse error.
Bun's $ only supports a single redirect per command. The combined form fails to parse:
error: expected a command or assignment but got: "Redirect"
I tested every variant (>/dev/null 2>&1, > /dev/null 2> /dev/null, with and without spaces, and the exact interpolated form from this PR) — all of them throw at parse time. A single redirect like > /dev/null works, but two do not.
Because the call is wrapped in try { … } catch { /* swallow */ }, that parse error is swallowed silently (it's a thrown JS exception, so .nothrow() doesn't apply). The net effect is that notification.create would never run — notifications would stop working entirely, with no error surfaced. That's strictly worse than the current behavior.
- .quiet() already suppresses both stdout and stderr.
The line has used .quiet() since v0.2.4. I confirmed that .quiet() keeps both the command's stdout and stderr from reaching the terminal, so dropping it in favor of a redirect is moving the wrong way.
Quick summary of what each form does:
- .quiet().nothrow() (current): stdout and stderr suppressed ✅
- > /dev/null (single redirect): valid ✅
- > /dev/null 2>&1 (this PR): parse error → notifications silently break ❌
On the OK you're seeing: since .quiet() already captures stdout/stderr, the most likely cause is that cmux writes OK directly to the controlling TTY (/dev/tty), bypassing its stdout fd. If so, neither .quiet() nor an stdout/stderr redirect would suppress it — it would need a quiet flag on the cmux side (e.g. cmux rpc … --quiet) or an upstream fix.
Could you share a quick repro? Specifically:
- which opencode-cmux version you're running,
- and confirmation that the OK comes from notification.create (vs. another call).
That'll tell us whether this needs a cmux-side flag or something else.
The cmux CLI outputs 'OK' to stdout on success for notification.create. When opencode-cmux calls the CLI, this pollutes the user's terminal with visual noise.
This PR redirects stdout/stderr to /dev/null so notifications are silent.
Fix: Changed
.quiet().nothrow()to>/dev/null 2>&1.nothrow()` in src/cmux.ts:52Fixes visual noise in live terminal where opencode-cmux is active.