fix(tools/tmux): unique per-invocation paste buffer; track auto-submit-drafts.sh #697
Reference in New Issue
Block a user
Delete Branch "enhance/tmux-send-buffer-race"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Upstreams the 2026-07-09 live hot-fix on web1 into the framework SSOT, plus brings the one genuinely untracked tmux tool under source control.
send-message.sh— unique per-invocation paste buffer. The script used a fixed tmux buffer name (__mosaic_send) shared by every concurrent sender on a tmux server. Concurrent invocations raced:load-bufferoverwrote a peer's payload, andpaste-buffer -ddeleted the buffer underneath a peer — cross-delivering or dropping messages. This bit the fleet during the 2026-07-09 simultaneous restart (standing briefs swapped between agent sessions; one agent received another's role brief). Buffer name is now__mosaic_send_$$_$(date +%s%N). Also adds explicitdelete-buffercleanup when both paste attempts fail (named buffers are exempt from tmuxbuffer-limiteviction, so orphans would accumulate forever) — found in review.auto-submit-drafts.sh— now tracked. Coordinator draft-flush watchdog; until now existed only as a loose file in the deployed~/.config/mosaic/tools/tmux/with no source-control home. Verbatim import.test-send-message-socket.sh— concurrency regression lock. 5 parallel sends to 5 distinct panes on an isolated-Lsocket; asserts every pane got exactly its own payload (no drop, no cross-delivery). Verified to fail 3/3 runs against the pre-fix script and pass post-fix.README.md— file list updated (auto-submit-drafts.sh,agent-send.test.sh).Why now
The fix currently exists only in the live deployed copy on web1. The next framework redeploy (already queued for the
agent-send --classgo-live) would overwrite it with the still-racy upstream version and silently reintroduce the cross-delivery bug. This PR makes the SSOT carry the fix before that happens.Verification
bash -n+ shellcheck clean on changed scripts (sole warning SC2034attemptis pre-existing, untouched code).agent-send.test.sh: 11/11 pass.test-send-message-socket.sh(incl. new concurrency lock): pass; pre-fix script fails it 3/3.Notes for merge/deploy
-Lsocket /EFFECTIVE_TARGETstructure — no behavior change vs. main other than the buffer naming + failure-path cleanup.🤖 Generated with Claude Code