Skip to content

fix(ssh): a quit that aborts an upload whose read already ended no longer crashes main (BUG-23) - #25922

Merged
OrcaWin merged 1 commit into
OrcaWin/node-rt-phase3from
OrcaWin/node-rt-p3-bug23-quit
Oct 6, 2026
Merged

OrcaWin merged 1 commit into
OrcaWin/node-rt-phase3from
OrcaWin/node-rt-p3-bug23-quit

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​98 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​98
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​4 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​4

ELI5

Quitting Orca while it was uploading a managed-server update to an SSH host crashed the main process with an "operation was aborted" error. Electron then showed its error dialog and blocked forever, so the app never quit and had to be killed. The upload code now handles that abort quietly, and the quit completes.

What Changed

  • Before: on quit, disconnectAll → SshConnection.disconnect() aborts the connection's teardown signal. sftp-upload's abort handler destroys the local read stream with the signal's reason. When the read had already reached the end of the file and only the remote write was still flushing, finished(readStream, { cleanup: true }) had already removed its listeners. So destroy(reason) emitted an 'error' with no listener, which became [main_uncaught_exception] AbortError: This operation was aborted (BUG-23).
  • After: the read stream gets a no-op 'error' listener as soon as it's created. The transfer's outcome is still read from finished and the write side, so a real read failure still fails the upload, and an abort still rejects with AbortError.

Why

  • The failing case: the abort is legitimate, since a quit must stop uploads. The only problem was an error event with no listener on a stream whose result had already been collected.
  • Why one listener instead of guarding each destroy call: it covers every path that destroys the stream after its read ended, the abort and the final cleanup alike.

Linked Issue

BUG-23 (final real-host run). The fence half, where a quit mid-activation leaves a lock the next launch waits up to 20 minutes on, is being coordinated with fix-orcad under #25834's token rules and will follow separately.

Visual Proof

N/A. This is a main-process crash fix.

Testing

  • sftp-upload: a quit-time abort of an upload whose read already ended raises no uncaught exception. It reproduces the exact AbortError: This operation was aborted without the fix.

  • Connection level: uploadSshDirectory aborted through the connection's teardown signal, exactly as disconnect() does, rejects with AbortError and raises no uncaught exception. This also fails without the fix.

  • Local runs: pnpm tc:node and the changed-code gate pass. sftp-upload, the quit test and ssh-connection* pass (318).

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Platforms: cross-platform; Node streams behave the same everywhere.
  • Wire: no wire change.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

…nger crashes main (BUG-23)

Quitting while an on-connect orcad update was uploading its bundle aborted the connection's
teardown signal. sftp-upload's abort handler destroyed the local read stream with the signal's
reason, but once that read had ended, 'finished' had already removed its listeners, so the
stream emitted an unhandled 'error': [main_uncaught_exception] AbortError: This operation was
aborted. Electron's error dialog then blocked the main thread and the app never exited.

The read stream now always has a no-op error listener; the transfer's outcome still comes from
'finished'. Both the bare upload and the connection-level teardown abort are covered.
@OrcaWin
OrcaWin merged commit 19e18ce into OrcaWin/node-rt-phase3 Oct 6, 2026
55 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant