fix(ssh-tunnel): ignore stderr stream errors during teardown - #100855
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 6, 2026, 11:59 AM ET / 15:59 UTC. Summary PR surface: Source +4, Tests +25. Total +29 across 2 files. Reproducibility: yes. from source inspection. Current main observes stderr data without an stderr error listener, and Node's EventEmitter throws unhandled 'error' events when no listener is present. Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Merge the focused runtime and regression-test fix after the current head's required checks complete, preserving child error and exit as the authoritative SSH failure path. Do we have a high-confidence way to reproduce the issue? Yes, from source inspection. Current main observes stderr data without an stderr error listener, and Node's EventEmitter throws unhandled 'error' events when no listener is present. Is this the best way to solve the issue? Yes. Best-fix verdict: best; observing only the diagnostic stderr stream is the narrowest maintainable fix because child error and exit events still report real SSH failures. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 8547682dd6f3. Label changesLabel justifications:
Evidence reviewedPR surface: Source +4, Tests +25. Total +29 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (4 earlier review cycles)
|
c811108 to
1bd24c3
Compare
c5f455e to
4ea5ebb
Compare
9a0cf57 to
cafce4e
Compare
|
Maintainer review complete for exact head I kept the runtime fix, removed the 76-line one-off proof script, and retained the author's improved table-driven regression coverage for both active-use and teardown timing. The diagnostic stderr pipe is observed without changing the authoritative child Validation:
No remaining proof gaps. Ready to squash merge. |
|
Merged via squash.
|
|
Maintainer repair is land-ready at
Known gap: no external SSH server was used; the regression directly exercises both lifecycle phases around the owned child stream. |
|
Merged via squash.
|
…w#100855) * fix(ssh-tunnel): ignore stderr stream errors during teardown * chore(proof): add real behavior proof for ssh-tunnel stderr stream errors * chore(proof): fix promise executor lint in ssh-tunnel proof * test(ssh-tunnel): keep stream error proof in regression suite * test(ssh): cover active stream errors --------- Co-authored-by: Vincent Koc <vincentkoc@ieee.org> Co-authored-by: Peter Steinberger <steipete@gmail.com>
What Problem This Solves
startSshPortForwardinsrc/infra/ssh-tunnel.tsreads ssh stderr for diagnostics but does not attach an"error"listener to the stderr stream. If stderr errors during ssh teardown (e.g. EPIPE after the child exits), the unhandled error can crash the gateway.Why This Change Was Made
Added a no-op
"error"listener onchild.stderr. stderr is used only for diagnostic lines, so a stream error there is not actionable; swallowing it prevents an unhandled exception while the normal childerror/exitpaths still surface ssh-level failures.User Impact
SSH tunnel teardown and gateway stability improve: stderr stream errors no longer propagate as unhandled exceptions.
Evidence
Regression test:
pnpm test src/infra/ssh-tunnel.test.tsReal behavior proof: