Skip to content

Fix daemon Windows ConPTY double kill - #4340

Merged
Jinwoo-H merged 1 commit into
mainfrom
Jinwoo-H/fix-daemon-windows-conpty-double-kill
Jun 1, 2026
Merged

Jinwoo-H merged 1 commit into
mainfrom
Jinwoo-H/fix-daemon-windows-conpty-double-kill

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • prevent daemon PTY teardown from calling node-pty destroy() on Windows after this handle already issued node-pty kill()
  • preserve Windows destroy() cleanup for natural-exit/direct process-kill paths where node-pty kill was not already used
  • add daemon subprocess regression coverage for Windows kill/dispose and forceKill fallback

Root cause

#3359 covered local-provider and hidden PTY cleanup, but daemon-backed PTYs still had a path where SubprocessHandle.kill() or the forceKill() fallback used node-pty proc.kill(), and later dispose() called proc.destroy(). In node-pty's Windows implementation, WindowsTerminal.destroy() calls kill() internally, so that sequence can close the ConPTY agent twice.

Verification

  • pnpm exec vitest run --config config/vitest.config.ts src/main/daemon/pty-subprocess.test.ts (54/54 passed)
  • pnpm run typecheck:node
  • Native Electron-as-Node repro harness with real node-pty/ConPTY:
    • old teardown kill(); destroy() over 50 iterations: ConPTY agent kill count was always 2
    • patched teardown over 50 iterations: ConPTY agent kill count was always 1
  • Patched Orca dev app via CDP:
    • spawned and killed 20 real daemon-backed cmd.exe PTYs through window.api.pty
    • window.api.pty.listSessions() returned zero live sessions afterward
    • no matching WER/Application Error events were recorded during the app-level run

Related to #4023.

@Jinwoo-H
Jinwoo-H merged commit 83dcac0 into main Jun 1, 2026
2 checks passed
@Jinwoo-H
Jinwoo-H deleted the Jinwoo-H/fix-daemon-windows-conpty-double-kill branch June 1, 2026 00:52
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
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