Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

fix(tmux): use Enter key name instead of C-m for prompt submission#295

Merged
jsell-rh merged 1 commit intojsell-rh:mainfrom
ciaranRoche:fix/tmux-send-keys-enter-key
Mar 25, 2026
Merged

fix(tmux): use Enter key name instead of C-m for prompt submission#295
jsell-rh merged 1 commit intojsell-rh:mainfrom
ciaranRoche:fix/tmux-send-keys-enter-key

Conversation

@ciaranRoche
Copy link
Copy Markdown

Summary

  • Replace C-m with Enter in tmuxSendKeys and tmuxPasteInput to fix agent input submission on tmux 3.5a + Claude Code v2.1.83

Root Cause

tmux send-keys supports two ways to send the Enter key:

  • C-m — sends raw byte 0x0D (carriage return)
  • Enter — sends the Enter key using whatever encoding the application has negotiated

Claude Code v2.1.83 enables extended key encoding (CSI u mode) in the terminal. In this mode, tmux 3.5a sends Enter using the extended escape sequence, but C-m is still sent as raw 0x0D. Claude Code's TUI only accepts the extended form for prompt submission when pasted text is in the input buffer.

Symptoms

When OpenDispatch sent text to an agent via tmuxSendKeys or tmuxPasteInput:

  1. The text appeared in Claude Code's input area as [Pasted text #1]
  2. The subsequent C-m did not submit the input
  3. Agents sat indefinitely with unsubmitted text in their prompt
  4. Nudges and restarts compounded the problem by appending more unsubmitted text

Notably, tmuxApprove and tmuxAlwaysAllow already used "Enter" (not "C-m"), which is why approval flows were unaffected.

How to verify

On a system with tmux 3.5a and Claude Code v2.1.83+:

# 1. Start a Claude Code session in tmux
tmux new-session -d -s test-verify
tmux send-keys -t test-verify "claude" Enter
# Wait for Claude to start...

# 2. Send text + Enter (should submit)
tmux send-keys -t test-verify "hello world" Enter

# 3. Confirm — old C-m approach would leave text stuck as [Pasted text #1]:
# tmux send-keys -t test-verify "hello world"
# tmux send-keys -t test-verify "C-m"   # ← does NOT submit

Compatibility

Enter is a standard tmux key name documented since tmux 1.x, listed alongside Up, Down, Space, Escape, etc. It works correctly across all tmux versions in both legacy and extended key modes.

Test plan

  • All coordinator tests pass (go test -race ./internal/coordinator/)
  • Manually verified Enter submits pasted text on tmux 3.5a + Claude Code v2.1.83
  • Manually verified C-m does NOT submit pasted text (confirming the bug)
  • Verify on tmux 3.3/3.4 if available (expected: Enter works identically)

🤖 Generated with Claude Code

tmux 3.5a with Claude Code v2.1.83 no longer accepts raw C-m (0x0D)
as Enter when the application has enabled extended key encoding (CSI u
mode). The tmux send-keys key name "Enter" works in both legacy and
extended modes across all tmux versions.

This affected tmuxSendKeys and tmuxPasteInput — agents would receive
text in their input buffer (shown as "[Pasted text jsell-rh#1]") but the
subsequent C-m never submitted it, leaving agents stuck indefinitely.
Notably, tmuxApprove and tmuxAlwaysAllow already used "Enter", which
is why approval flows were unaffected.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Owner

@jsell-rh jsell-rh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solid, well-documented fix. The root-cause analysis is accurate — tmux 3.5a + CSI u extended key encoding broke the raw C-m (0x0D) path while Enter routes through the proper escape sequence negotiated by the application. The observation that tmuxApprove already used "Enter" and was unaffected is a nice consistency cross-check.

Two things I want to call out as especially good:

  • The compatibility note is correct: Enter has been a valid tmux key name since 1.x, so this is a safe change across the entire version matrix.
  • The test plan is honest — the tmux 3.3/3.4 box is left unchecked rather than rubber-stamped. That's the right call.

Merging.

@jsell-rh jsell-rh enabled auto-merge (squash) March 25, 2026 18:39
@jsell-rh jsell-rh merged commit 0272c2e into jsell-rh:main Mar 25, 2026
3 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants