Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

fix(speech): remote send-keys joins with && — no Enter unless the text landed (review)

enes1ee165bf6131
diff --git a/src/core/remote-ssh/control-master.test.ts b/src/core/remote-ssh/control-master.test.ts
index a557d5d74..2728c80aa 100644
--- a/src/core/remote-ssh/control-master.test.ts
+++ b/src/core/remote-ssh/control-master.test.ts
@@ -92,10 +92,10 @@ describe('remoteTmuxSendKeysArgs', () => {
`tmux -L ${RMT_TMUX_SOCKET} send-keys -t nt-x -l -- 'hello'`
])
})
- it('appends a second send-keys Enter, joined by ;, when enter is true', () => {
+ it('appends a second send-keys Enter, joined by &&, when enter is true', () => {
const args = remoteTmuxSendKeysArgs(conn, '/s.sock', 'nt-x', 'hello', true)
expect(args[args.length - 1]).toBe(
- `tmux -L ${RMT_TMUX_SOCKET} send-keys -t nt-x -l -- 'hello'; tmux -L ${RMT_TMUX_SOCKET} send-keys -t nt-x Enter`
+ `tmux -L ${RMT_TMUX_SOCKET} send-keys -t nt-x -l -- 'hello' && tmux -L ${RMT_TMUX_SOCKET} send-keys -t nt-x Enter`
)
})
it('single-quote-escapes a single quote in the text (the \'\\\'\' idiom)', () => {
diff --git a/src/core/remote-ssh/control-master.ts b/src/core/remote-ssh/control-master.ts
index 746f198aa..465d24c64 100644
--- a/src/core/remote-ssh/control-master.ts
+++ b/src/core/remote-ssh/control-master.ts
@@ -82,7 +82,10 @@ export function remoteTmuxHasSessionArgs(conn: SshConnection, controlPath: strin
* the remote host without a second network round trip: `-l --` sends the text literally (`-l`)
* and stops option parsing first (`--`, so text starting with `-` is never read as another
* send-keys flag); `text` is single-quoted (`posixQuote`) so it survives the remote shell as one
- * token verbatim, multiline included.
+ * token verbatim, multiline included. Joined with `&&`, not `;` — this mirrors the local path's
+ * ordering guarantee (`PtyManager.sendText`): Enter only fires if the text send actually
+ * succeeded, so a failed text send can never leave a lone Enter to submit whatever was already
+ * composed in a live agent prompt.
*/
export function remoteTmuxSendKeysArgs(
conn: SshConnection,
@@ -92,7 +95,7 @@ export function remoteTmuxSendKeysArgs(
enter: boolean
): string[] {
let cmd = `tmux -L ${RMT_TMUX_SOCKET} send-keys -t ${sessionId} -l -- ${posixQuote(text)}`
- if (enter) cmd += `; tmux -L ${RMT_TMUX_SOCKET} send-keys -t ${sessionId} Enter`
+ if (enter) cmd += ` && tmux -L ${RMT_TMUX_SOCKET} send-keys -t ${sessionId} Enter`
return childArgs(conn, controlPath, cmd)
}
/**