fix(@scripts/session-tools): 🐛 add delay for paste submission

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Natalie 2026-06-02 15:20:29 -07:00
parent e5403bf72a
commit 90a78ea8ed

View file

@ -829,6 +829,15 @@ cmd_list() {
# a leading `/` is just text — easy to accidentally turn a slash
# command into prose.
#
# Multi-line / long payloads arrive as a bracketed paste: Claude's TUI buffers
# them as a "[Pasted text]" block that needs an explicit submit. A trailing
# Enter sent immediately after the literal text is swallowed into the paste
# (treated as a newline, not a submit), so the turn silently never submits —
# the input just accumulates across sends. A short pause before Enter lets the
# paste settle so the Enter registers as a submit. Single-line sends (e.g. the
# orchestrator cold-start kick) were unaffected, which is why this only bit
# long turns like the rounds prompt.
#
# Concurrent sends to the same pane can still race the input buffer. Callers
# that need ordering should serialize externally (flock on a per-pane lock).
cmd_send() {
@ -926,7 +935,7 @@ EOF
if is_local "$_host"; then
if tmux send-keys -t "$_sess" C-a C-k 2>/dev/null \
&& tmux send-keys -t "$_sess" -l -- "$_text" 2>/dev/null \
&& tmux send-keys -t "$_sess" Enter 2>/dev/null; then
&& { sleep 0.5; tmux send-keys -t "$_sess" Enter 2>/dev/null; }; then
:
else
_failed=$((_failed + 1))
@ -935,7 +944,7 @@ EOF
else
_q_sess=$(sh_quote "$_sess")
if ssh -o BatchMode=yes -o ConnectTimeout=3 "$_host" \
"tmux send-keys -t $_q_sess C-a C-k && tmux send-keys -t $_q_sess -l -- $_quoted_text && tmux send-keys -t $_q_sess Enter" \
"tmux send-keys -t $_q_sess C-a C-k && tmux send-keys -t $_q_sess -l -- $_quoted_text && sleep 0.5 && tmux send-keys -t $_q_sess Enter" \
</dev/null >/dev/null 2>&1; then
:
else