Skip to content

fix: cli stuff on windwos #2697

Draft
janburzinski wants to merge 12 commits into
mainfrom
emdash/windwos-optimizations-tfh7p
Draft

fix: cli stuff on windwos #2697
janburzinski wants to merge 12 commits into
mainfrom
emdash/windwos-optimizations-tfh7p

Conversation

@janburzinski

Copy link
Copy Markdown
Collaborator

Description

Checklist
  • I kept this PR small and focused
  • I ran a self-review before opening this PR
  • I ran the relevant local checks or explained why not
  • I updated docs when behavior or setup changed
  • I added or updated tests when behavior changed, or explained why not
  • I only added comments where the logic is not obvious
  • I used Conventional Commits for commit
    messages and, when possible, the PR title

@janburzinski

Copy link
Copy Markdown
Collaborator Author

@greptileai

@greptile-apps

greptile-apps Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR updates Windows PTY behavior for local and remote terminal sessions. The main changes are:

  • Adds ConPTY-aware xterm mouse mode handling.
  • Adds binary input forwarding for mouse reports.
  • Adds a Windows console input injector for local PTYs.
  • Propagates SSH state into terminal and lifecycle PTY setup.
  • Disables renderer identifier minification for xterm compatibility.

Confidence Score: 4/5

These fixes should be updated before merging.

  • Remote conversation PTYs can still be classified as local on Windows.
  • Local Windows mouse reports can still be lost when helper injection fails.
  • The terminal and lifecycle SSH plumbing looks mostly correct.

apps/emdash-desktop/src/renderer/features/tasks/conversations/conversation-manager.ts; apps/emdash-desktop/src/main/core/pty/local-pty.ts

Important Files Changed

Filename Overview
apps/emdash-desktop/src/main/core/pty/local-pty.ts Adds queued Windows mouse injection, but failed injection can still leave local mouse reports undelivered.
apps/emdash-desktop/src/main/core/pty/windows-console-input.ts Adds the PowerShell helper used to write SGR mouse text into the Windows console input queue.
apps/emdash-desktop/src/renderer/features/tasks/conversations/conversation-manager.ts Adds conversation remote detection, but it can snapshot SSH sessions as local before mount state is ready.
apps/emdash-desktop/src/renderer/features/tasks/terminals/terminal-manager.ts Updates terminal sessions to evaluate SSH state lazily when selecting the Windows PTY backend.
apps/emdash-desktop/src/renderer/features/tasks/stores/lifecycle-scripts.ts Passes provisioned SSH state into lifecycle script PTY sessions.
apps/emdash-desktop/src/renderer/lib/pty/pty-session.ts Adds lazy remote-state support before selecting the local Windows ConPTY backend.
apps/emdash-desktop/src/renderer/lib/pty/pty.ts Adds local ConPTY backend configuration and synthetic mouse mode mirroring for xterm.
apps/emdash-desktop/src/renderer/lib/pty/use-pty.ts Routes xterm binary input through the PTY RPC layer.
Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 2
apps/emdash-desktop/src/renderer/features/tasks/conversations/conversation-manager.ts:281
**Conversation backend snapshots** This still captures `isRemote` as a boolean when the conversation PTY session is created. Conversation stores can be acquired before the SSH project is mounted, so `getProjectSshConnectionId()` returns `undefined`; later provisioning reuses the existing conversation store without updating that session. On Windows, that remote conversation can still connect as a local ConPTY session and enable local-only mouse handling for an SSH PTY.

### Issue 2 of 2
apps/emdash-desktop/src/main/core/pty/local-pty.ts:96
**Fallback still drops mouse** When the PowerShell injector times out, fails to spawn, or cannot attach, this path writes the original SGR mouse bytes to the Windows PTY. For local ConPTY sessions those bytes are not the console input events the app is trying to inject, so clicks or wheel reports can still disappear whenever helper injection fails. The fallback needs to treat failed injection as undelivered input instead of assuming raw PTY passthrough delivers the mouse event.

Reviews (2): Last reviewed commit: "fix(pty): preserve lifecycle script ssh ..." | Re-trigger Greptile

Comment thread apps/emdash-desktop/src/main/core/pty/local-pty.ts Outdated
Comment thread apps/emdash-desktop/src/renderer/features/tasks/terminals/terminal-manager.ts Outdated
Comment thread apps/emdash-desktop/src/renderer/features/tasks/stores/lifecycle-scripts.ts Outdated
@janburzinski

Copy link
Copy Markdown
Collaborator Author

@greptileai

Comment thread apps/emdash-desktop/src/main/core/pty/local-pty.ts Outdated
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