fix(windows): make persistent agent sessions use the session host - #916
Merged
eneskirca merged 2 commits intoSep 24, 2026
Merged
Conversation
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.
Summary
Windows already has a packaged session-host backend, but the main process could select an unrelated
tmux.exefromPATHbefore reaching it. On a Windows machine with psmux/MSYS2/Cygwin available, that backend produced the failures seen in practice: agent launch text was corrupted, helper consoles appeared, and sessions could not be restored reliably.This PR makes the Windows session host the authoritative local persistence backend and fixes the two launch integration issues that blocked usable agent sessions.
What changed
findTmux()now returns no local tmux binary on Windows. The existing session-host branch owns the PTY and provides attach, capture, send, and restart behavior. Unix systems retain their existing tmux discovery order.Path, while the Codex launcher path was built fromenv.PATHonly. The Codex launcher now prepends its directory toenv.PATH ?? env.Path ?? '', socodex,agy,opencode, and their subprocesses remain discoverable.User-visible behavior
On Windows with persistence enabled:
codex --ask-for-approval on-requestin the session host.opencodein the session host.agyin the session host.cmd, PowerShell, node, git, and PTY helper windows that appeared with that backend.Validation
Automated
npm exec -- vitest run src/core/windows-session-persistence.test.ts src/renderer/terminal/launch-command.test.tsnpm run typecheckgit diff --checkWindows functional verification
Using the packaged Windows build with persistence enabled:
opencode.exe.agy.exe.Root cause
The persistence session-host implementation was present, but Windows discovery preferred any
tmux.exefound onPATH. A Windows tmux-compatible executable is not interchangeable with the Unix tmux control contract used by NodeTerm. That mismatch caused incorrect input routing and visible child consoles. Separately, Windows environment casing dropped the inherited PATH, and the fresh session launch path unnecessarily queried pane ownership before delivering the initial command.Scope
This PR changes only local Windows session selection and launch integration. Unix tmux behavior, SSH/remote sessions, and the existing session-host protocol are unchanged.