The sender self-lookup reused the destination tmux socket arguments. For cross-socket sends, tmux -L "$SOCKET_NAME" display-message -p '#S' therefore asked the destination server for its session and stamped a holder/garbage identity into the preamble. Because that lookup succeeded, the ? fallback never ran and flipped replies routed to a non-participant.
Fix
Prefer MOSAIC_AGENT_NAME, exported into every agent pane, as the authoritative sender session name.
When that variable is absent, query tmux display-message -p '#S' on the sender's local/default socket with no destination -L argument, preserving || echo "?" for genuinely unknown senders.
Leave destination dispatch and its correct -L "$SOCKET_NAME" behavior unchanged.
## Root cause
The sender self-lookup reused the destination tmux socket arguments. For cross-socket sends, `tmux -L "$SOCKET_NAME" display-message -p '#S'` therefore asked the destination server for its session and stamped a holder/garbage identity into the preamble. Because that lookup succeeded, the `?` fallback never ran and flipped replies routed to a non-participant.
## Fix
- Prefer `MOSAIC_AGENT_NAME`, exported into every agent pane, as the authoritative sender session name.
- When that variable is absent, query `tmux display-message -p '#S'` on the sender's local/default socket with no destination `-L` argument, preserving `|| echo "?"` for genuinely unknown senders.
- Leave destination dispatch and its correct `-L "$SOCKET_NAME"` behavior unchanged.
## TDD evidence
RED against the unpatched tool:
- `bash packages/mosaic/framework/tools/tmux/agent-send.test.sh`
- `PASS=12 FAIL=3`
- Failures showed both env and fallback cases incorrectly selecting `destination-holder`.
GREEN after the fix:
- focused regression suite: `PASS=15 FAIL=0`
- `pnpm typecheck`: 42/42 tasks
- `pnpm lint`: 23/23 tasks
- `pnpm format:check`: passed
- shell syntax check: passed
Author-only lane: independent review and merge are intentionally left to the assigned reviewer and MS Team Lead.
Fixes #808
Prefer the pane's MOSAIC_AGENT_NAME and query only the local tmux server when falling back, so destination socket holders cannot corrupt reply routing. Add red-first regression coverage for env, local-session, and unknown sender paths.
Co-Authored-By: OpenAI GPT <[email protected]>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Root cause
The sender self-lookup reused the destination tmux socket arguments. For cross-socket sends,
tmux -L "$SOCKET_NAME" display-message -p '#S'therefore asked the destination server for its session and stamped a holder/garbage identity into the preamble. Because that lookup succeeded, the?fallback never ran and flipped replies routed to a non-participant.Fix
MOSAIC_AGENT_NAME, exported into every agent pane, as the authoritative sender session name.tmux display-message -p '#S'on the sender's local/default socket with no destination-Largument, preserving|| echo "?"for genuinely unknown senders.-L "$SOCKET_NAME"behavior unchanged.TDD evidence
RED against the unpatched tool:
bash packages/mosaic/framework/tools/tmux/agent-send.test.shPASS=12 FAIL=3destination-holder.GREEN after the fix:
PASS=15 FAIL=0pnpm typecheck: 42/42 taskspnpm lint: 23/23 taskspnpm format:check: passedAuthor-only lane: independent review and merge are intentionally left to the assigned reviewer and MS Team Lead.
Fixes #808