fix(browser): survive a parent that closes the std pipes - #80
Merged
Conversation
The open daemon writes diagnostics to stderr for its whole lifetime — the read-only access-guard logs every blocked request there, and a busy site (LinkedIn fires dozens of telemetry POSTs seconds after load) produces a burst of them. A host that closes the pipe after reading the ready line turned that first burst into an unhandled write EPIPE that killed the live session: open reported ready, the first navigate succeeded, and every call after it got session unreachable ECONNREFUSED. Swallow error events on process.stdout/stderr in the CLI entry. Losing diagnostics must never cost the session.
Merged
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.
Summary
The
opendaemon dies with an unhandledwrite EPIPEwhen its parent closes the std pipes after reading the ready line. Trigger found in the wild: the Lethe desktop runtime (lethe 0.28.0) drops the daemon stderr pipe once ready, thelinkedinprofile is sealed read-only, and linkedin.com fires dozens of telemetry POSTs on load — the access-guard logs each blocked request to stderr, the first burst hits the closed pipe, and the session dies seconds after a successful navigate. Signature:openready → first navigate ok → every later callsession unreachable: ECONNREFUSED, respawn loop.Fix: swallow
errorevents onprocess.stdout/process.stderrin the CLI entry. Losing diagnostics must never cost the session.Verification
Python harness mimicking the host (spawn
open --name linkedin, read ready, close stderr, navigate to linkedin.com): unpatched 7.6.0 daemon exits rc=1 within 1s of navigate; patched daemon survives, servespage-text, andclosereseals cleanly.The complementary host-side fix (drain stderr for the daemon lifetime) lands in lethe separately.
🤖 Generated with Claude Code