Describe the bug
When opening the terminal (Ctrl+J) with a folder already open, the terminal renders blank — no prompt, no output — and the shell is never spawned at the folder path. Opening the same folder again (or any path change) makes it work.
Root cause is a race between the activePtyPath.current short-circuit in apps/desktop/src/components/Terminal.tsx and React's Strict Mode double-invocation of effects in dev:
- Mount: effect runs.
activePtyPath.current = targetPath is set at the top of the effect, before any async work.
- Strict Mode synthetic unmount: cleanup runs,
isCanceled = true.
- Inside the in-flight
setupPty, the if (isCanceled) check fires right after await listen() — the function returns without calling spawn_pty.
- Strict Mode remount: effect runs again.
activePtyPath.current is still the targetPath from step 1, so activePtyPath.current === targetPath is true and the effect early-returns before setupPty is even called.
Result: the PTY is never spawned on first open. Opening a different folder (or the same one again, if the state update creates a new ref) flips activePtyPath.current !== targetPath and unblocks the effect.
Debug trace confirming this (temporary logging inserted):
[TermDebug] setupPty start | targetPath= C:\Proyectos\... rootPath= C:\Proyectos\... terminalPath= null
[TermDebug] calling kill_pty
[TermDebug] registering pty-output listener
[TermDebug] listener ready
[TermDebug] cancelled before spawn, unlistening
No further setupPty start log follows — the remount effect is silently skipped by the activePtyPath check.
Steps to Reproduce
pnpm desktop.
File → Open Folder → pick any folder.
Ctrl+J to open the bottom terminal panel.
- The panel is empty — no prompt, no cursor output.
- Reopen the same folder (or a different one) → terminal now works at the new path.
Trixty Version
v1.0.8 (main @ 50923f8)
OS
Windows
Fix yourself?
Yes
Describe the bug
When opening the terminal (
Ctrl+J) with a folder already open, the terminal renders blank — no prompt, no output — and the shell is never spawned at the folder path. Opening the same folder again (or any path change) makes it work.Root cause is a race between the
activePtyPath.currentshort-circuit inapps/desktop/src/components/Terminal.tsxand React's Strict Mode double-invocation of effects in dev:activePtyPath.current = targetPathis set at the top of the effect, before any async work.isCanceled = true.setupPty, theif (isCanceled)check fires right afterawait listen()— the function returns without callingspawn_pty.activePtyPath.currentis still the targetPath from step 1, soactivePtyPath.current === targetPathis true and the effect early-returns beforesetupPtyis even called.Result: the PTY is never spawned on first open. Opening a different folder (or the same one again, if the state update creates a new ref) flips
activePtyPath.current !== targetPathand unblocks the effect.Debug trace confirming this (temporary logging inserted):
No further
setupPtystart log follows — the remount effect is silently skipped by theactivePtyPathcheck.Steps to Reproduce
pnpm desktop.File → Open Folder→ pick any folder.Ctrl+Jto open the bottom terminal panel.Trixty Version
v1.0.8 (main @ 50923f8)
OS
Windows
Fix yourself?
Yes