fix(tmux): preserve sender identity across sockets
All checks were successful
ci/woodpecker/pr/ci Pipeline was successful

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 <noreply@openai.com>
This commit is contained in:
Hermes Agent
2026-07-16 17:30:42 -05:00
parent 3be443c96d
commit 4b50cc93d1
3 changed files with 93 additions and 7 deletions

View File

@@ -122,12 +122,11 @@ fi
# Source label: this agent's host:session (auto-detected, overridable).
if [ -z "$SRC_LABEL" ]; then
tmux_cmd=(tmux)
if [ -n "$SOCKET_NAME" ]; then
tmux_cmd+=(-L "$SOCKET_NAME")
fi
src_host=$(hostname -s 2>/dev/null || echo "?")
src_sess=$("${tmux_cmd[@]}" display-message -p '#S' 2>/dev/null || echo "?")
src_sess=${MOSAIC_AGENT_NAME:-}
if [ -z "$src_sess" ]; then
src_sess=$(tmux display-message -p '#S' 2>/dev/null || echo "?")
fi
SRC_LABEL="${src_host}:${src_sess}"
fi