Skip to content

Avoid packaged Windows console pipe crashes#4206

Draft
SunkenInTime wants to merge 2 commits into
pingdotgg:mainfrom
SunkenInTime:agent/fix-windows-epipe-console-logging
Draft

Avoid packaged Windows console pipe crashes#4206
SunkenInTime wants to merge 2 commits into
pingdotgg:mainfrom
SunkenInTime:agent/fix-windows-epipe-console-logging

Conversation

@SunkenInTime

@SunkenInTime SunkenInTime commented Jul 20, 2026

Copy link
Copy Markdown

What Changed

  • Keep Effect's pretty console logger active in packaged-style Windows desktop runs.
  • Guard that logger against EPIPE; after the inherited pipe breaks, only the unavailable console sink is disabled while the tracer continues writing desktop.trace.ndjson.
  • Add regression coverage for both the expected EPIPE case and unrelated console failures that must still surface.

Why

The packaged Electron main process installs Effect's consolePretty logger. On Windows, a launch path that gives the app piped stdout or stderr can leave it with a broken pipe after the reader exits. The next Effect log calls console.log synchronously and escapes as an uncaught EPIPE, producing Electron's "A JavaScript error occurred in the main process" dialog.

This was reproduced with 0.0.29-nightly.20260720.853 by launching T3 Code Nightly with piped output, closing the parent-side reader after startup, and allowing the desktop updater to emit another main-process Effect log.

The guarded logger preserves normal console output for Windows launches with a usable pipe. It catches only errors whose code is EPIPE, stops retrying that dead sink after the first failure, and rethrows every other console error.

UI Changes

No product UI changes. These artifacts show the existing Windows failure:

Windows EPIPE main-process error

Verification

  • vp exec vitest run apps/desktop/src/app/DesktopObservability.test.ts
  • vp run --filter @t3tools/desktop typecheck
  • vp fmt --check apps/desktop/src/app/DesktopObservability.ts apps/desktop/src/app/DesktopObservability.test.ts
  • vp lint apps/desktop/src/app/DesktopObservability.ts apps/desktop/src/app/DesktopObservability.test.ts
  • Rebuilt the Electron main bundle with the repository-local vp pack.
  • Launched the rebuilt desktop app on Windows with an isolated state directory, closed its parent pipe, and observed the healthy T3 Code (Alpha) window while desktop.trace.ndjson continued receiving events for another 17 seconds without an Electron error dialog.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • Screenshots are not applicable because this PR does not change the UI; the attached image documents the existing failure
  • Animation or interaction video is not applicable; the attached video is reproduction evidence

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 817ac983-240c-45e7-8137-5f9b2de83046

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Jul 20, 2026
@github-actions github-actions Bot added size:M 30-99 changed lines (additions + deletions). and removed size:S 10-29 changed lines (additions + deletions). labels Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant