Repository navigation
fix(desktop): handle broken console output pipes - #495
Merged
Merged
Conversation
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused tests and implementation correctly preserve file logging while suppressing only the failed console transport.
Review effort: Lite
Findings: None
What changed in this PR
Fixes desktop stdout/stderr EPIPE failures without interrupting the main process or file logging.
Changes:
- Installs one-time stream error handlers and disables the console transport after
EPIPE. - Preserves file logging and console transport state across log-level changes and reinitialization.
- Adds regression tests for stream failures and logger lifecycle behavior.
| File | Description |
|---|---|
App/shell/desktop/src/main/logger.ts |
Handles broken console output pipes safely. |
App/shell/desktop/tests/logger.test.ts |
Covers EPIPE, unrelated errors, and reinitialization. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a launcher closes the read end of the desktop process's stdout/stderr pipe, subsequent UI logging can show an uncaught
write EPIPEmain-process dialog. This was reproduced on main (65c1825d) by closing a controlled output pipe and navigating between the welcome and token-detail pages; it is not specific to chat.Handle
EPIPEon stdout/stderr before initializing logging, disable the failed console transport for the remainder of the process, and preserve file logging. Log-level changes do not re-enable the broken transport. Other stream errors are rethrown, and repeated logger initialization does not add duplicate handlers.Validation:
--noEmitcheck passed;git diff --checkpassed.main.logcontinues receiving page-view records.memory-restart-lifecycle.test.ts: Memory exits before readiness, code 1). The same failure reproduces with the logger source restored to upstream main in this environment (Node 26.0.0).Packaged releases and other operating systems were not exercised. This does not address the separate conversation-context behavior observed during investigation.