Skip to content

Fix terminal PTY interruptions during remounts#138

Open
brooksc wants to merge 1 commit into
johannesjo:mainfrom
brooksc:terminal-hmr-lifecycle
Open

Fix terminal PTY interruptions during remounts#138
brooksc wants to merge 1 commit into
johannesjo:mainfrom
brooksc:terminal-hmr-lifecycle

Conversation

@brooksc
Copy link
Copy Markdown
Contributor

@brooksc brooksc commented May 24, 2026

Problem

Task AI terminals currently terminate their backend PTY when the TerminalView component cleans up. In dev/HMR or other renderer remounts, that kills an active Codex session, then the renderer respawns it with resume args. Codex sees that as an interrupted conversation and waits for manual continuation.

Fix

Task AI terminals now preserve their PTY across component cleanup and reattach to the existing process on remount. Intentional replacement remains explicit: restart and agent switch set attachExisting=false, so those actions still replace the running process. Standalone close/cleanup paths continue to own termination.

Verification

  • git diff --check
  • npm run check
  • npm test
  • Push hook reran npm run check and npm test
  • Confirmed this branch is rebased on latest johannesjo/main
  • Confirmed the PR contains one commit touching only:
    • electron/ipc/pty.test.ts
    • electron/mcp/coordinator.ts
    • src/components/TaskAITerminal.tsx
    • src/components/TerminalView.tsx
    • src/store/agents.test.ts
    • src/store/agents.ts

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