fix: remove activePtyPath short-circuit that blocked pty respawn#29
Merged
jmaxdev merged 1 commit intoTrixtyAI:mainfrom Apr 19, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes a dev-only React Strict Mode race where the Terminal PTY session could fail to spawn on first open (issue #28) by removing an effect-level short-circuit that prevented setupPty() from running after a Strict Mode remount.
Changes:
- Removed
activePtyPathref used to track the “last spawned” path. - Removed the early-return guard that skipped PTY setup when
targetPathmatched the ref.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
9a5e6b6 to
aa9762d
Compare
jmaxdev
approved these changes
Apr 19, 2026
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.
Changes
Removes the
activePtyPath.currentshort-circuit inTerminal.tsx. Under React Strict Mode (default in dev), the ref was set at the top of the PTY effect before any async work ran. If the Strict Mode synthetic unmount fired beforespawn_ptycompleted, the remount sawactivePtyPath.current === targetPathand skippedsetupPtyentirely, leaving the backend PTY unspawned and the terminal blank.The optimization was trying to avoid redundant respawns when deps fire with the same path, but:
Object.is), so the additional guard rarely helps.kill_pty + spawn_ptyis cheap — dropping the old state and spawning a fresh shell at the same path is fine for the cases that would slip through.Removed the
activePtyPathref and the two lines that read/wrote it. Everything else (listener lifecycle,fit()before spawn, passingrows/colstospawn_pty) is unchanged.Issues