Skip to content

fix: use generation tracking to prevent killing new PTYs on reload - #74

Merged
AmethystLiang merged 1 commit into
mainfrom
fix/pty-generation-tracking
Mar 24, 2026
Merged

AmethystLiang merged 1 commit into
mainfrom
fix/pty-generation-tracking

Conversation

@AmethystLiang

Copy link
Copy Markdown
Contributor

Summary

  • Introduces a load generation counter to tag each PTY process with the page load it was spawned during
  • On did-finish-load, only kills PTYs from previous generations, preserving ones created during the current page load
  • Adds try/catch around proc.kill() calls to handle already-dead processes gracefully
  • Fixes race condition where blank terminals appeared after renderer reload

Test plan

  • Open multiple terminal panes, trigger a renderer reload, verify terminals from previous session are cleaned up
  • Spawn terminals quickly during page load, verify they survive the did-finish-load event
  • Kill individual terminals via UI, verify generation map is cleaned up

🤖 Generated with Claude Code

…reload

The did-finish-load handler was killing all PTY processes, including ones
spawned during the current page load. This caused blank terminals when a
race between renderer reload and PTY creation occurred. Now each PTY is
tagged with a load generation counter, and only PTYs from previous
generations are killed on reload.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@AmethystLiang
AmethystLiang merged commit 810934a into main Mar 24, 2026
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…reload (stablyai#74)

The did-finish-load handler was killing all PTY processes, including ones
spawned during the current page load. This caused blank terminals when a
race between renderer reload and PTY creation occurred. Now each PTY is
tagged with a load generation counter, and only PTYs from previous
generations are killed on reload.

Co-authored-by: Claude Opus 4.6 <[email protected]>
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