You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All of these share the common pattern of TUI output corruption or unwanted background content appearing in the interface that can be cleared by window resize events.
Feel free to ignore if none of these address your specific case.
Root Cause Analysis: Debug console.log Statements in TUI Code + disableStdoutInterception()
I did a deep source code analysis and found the root cause of this issue extends beyond --print-logs mode. The TUI corruption happens even in normal mode due to debug console.log statements left in production TUI code.
Architecture
Main Thread (TUI) Worker Thread (Backend)
@opentui/solid renderer (60 FPS) Sessions, Tools, MCP, Sub-agents
→ renders to process.stdout → shares stdout/stderr fd with main
→ disableStdoutInterception() → Log system → file (after init)
→ console.log → DIRECTLY to terminal → Bus events → RPC → TUI events
Root Cause Chain
renderer.disableStdoutInterception() is called in App() component (src/cli/cmd/tui/app.tsx:190). This disables @opentui/core's built-in stdout protection, meaning ANY console.log or process.stdout.write bypasses the TUI framework and goes raw to the terminal.
Multiple debug console.log statements remain in TUI code:
File
Line
Code
Trigger
app.tsx
214
console.log(JSON.stringify(route.data))
Every route change (in createEffect!)
route.tsx
34
console.log("navigate", route)
Every navigation
sync.tsx
332
console.log("bootstrapping")
During data sync
theme.tsx
319
console.log("resolveSystemTheme")
Theme resolution
theme.tsx
325
console.log(colors.palette)
Palette detection
clipboard.ts
79-149
console.log("clipboard: using ...")
Clipboard operations
Sub-agent execution amplifies the problem: When sub-agents run, heavy event activity (PartUpdated, MessageUpdated) flows from Worker → RPC → TUI EventSource → Solid.js reactivity → createEffect fires → console.log writes raw text to stdout → interleaves with renderer's ANSI escape sequences → visual corruption.
Minimal Reproduction (no --print-logs needed)
Start opencode normally (no flags)
Navigate to a session
Trigger a sub-agent task
As events flow, app.tsx:214's createEffect(() => { console.log(JSON.stringify(route.data)) }) fires, writing raw JSON to stdout mid-render
Suggested Fix
Immediate (high impact, trivial effort): Remove all console.log/console.error debug statements from TUI code:
app.tsx:214 — This single line causes the most corruption
route.tsx:34
sync.tsx:332
theme.tsx:319, 325
clipboard.ts:79, 88, 97, 110, 125, 149
Medium-term: Consider re-enabling stdout interception or routing TUI-internal logs through renderer.console instead of raw console.log.
Related Issues
This analysis also explains the symptoms reported in:
Activity
github-actions commentedon Jan 15, 2026
This issue might be a duplicate of existing issues. Please check:
All of these share the common pattern of TUI output corruption or unwanted background content appearing in the interface that can be cleared by window resize events.
Feel free to ignore if none of these address your specific case.
wudanzy commentedon Jan 15, 2026
If this is the first time this bug gets discovered, I am willing to fix it. (I have discussed opencode and get some idea)
blackas commentedon Feb 5, 2026
Root Cause Analysis: Debug
console.logStatements in TUI Code +disableStdoutInterception()I did a deep source code analysis and found the root cause of this issue extends beyond
--print-logsmode. The TUI corruption happens even in normal mode due to debugconsole.logstatements left in production TUI code.Architecture
Root Cause Chain
renderer.disableStdoutInterception()is called inApp()component (src/cli/cmd/tui/app.tsx:190). This disables @opentui/core's built-in stdout protection, meaning ANYconsole.logorprocess.stdout.writebypasses the TUI framework and goes raw to the terminal.Multiple debug
console.logstatements remain in TUI code:app.tsxconsole.log(JSON.stringify(route.data))route.tsxconsole.log("navigate", route)sync.tsxconsole.log("bootstrapping")theme.tsxconsole.log("resolveSystemTheme")theme.tsxconsole.log(colors.palette)clipboard.tsconsole.log("clipboard: using ...")createEffectfires →console.logwrites raw text to stdout → interleaves with renderer's ANSI escape sequences → visual corruption.Minimal Reproduction (no
--print-logsneeded)app.tsx:214'screateEffect(() => { console.log(JSON.stringify(route.data)) })fires, writing raw JSON to stdout mid-renderSuggested Fix
Immediate (high impact, trivial effort): Remove all
console.log/console.errordebug statements from TUI code:app.tsx:214— This single line causes the most corruptionroute.tsx:34sync.tsx:332theme.tsx:319, 325clipboard.ts:79, 88, 97, 110, 125, 149Medium-term: Consider re-enabling stdout interception or routing TUI-internal logs through
renderer.consoleinstead of rawconsole.log.Related Issues
This analysis also explains the symptoms reported in:
console.logfrom plugin code)Environment
anomalyco/opencodelatest main branch@opentui/solid0.1.77 +@opentui/core0.1.77github-actions commentedon Apr 6, 2026
To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.