-
Notifications
You must be signed in to change notification settings - Fork 201
Description
Problem
When pty:startDirect opens a remote SSH session, init keystrokes (cd, export, provider launch) are written to the PTY immediately after startSshPty() returns. This races with the SSH login banner/MOTD output, which can interleave with and corrupt the injected commands.
This affects both pty:start and pty:startDirect remote paths.
Current behavior
Commands typed into the PTY can get garbled when the MOTD is still being printed, especially with multiple lines of init commands.
Suggested fix
Detect the shell prompt in PTY output before injecting keystrokes, rather than writing immediately. Prompt detection patterns could be derived from the existing activityClassifier.ts idle patterns (e.g. $, %, >).
A fixed-delay workaround (e.g. setTimeout(1500)) is fragile — too short for slow connections, unnecessarily slow for fast ones.