framework tools/tmux: B1 — already-exact targets no longer bypass discovery; rc 4 in EXIT CODES section
ci/woodpecker/pr/ci Pipeline failed
ci/woodpecker/pr/ci Pipeline failed
DST_TARGET computed BEFORE socket discovery and used for the probes (probing '==name' for already-exact input was a false negative that fell back to the default socket; codex blocker). Exit 4 moved into the canonical EXIT CODES header (codex should-fix).
This commit is contained in:
@@ -66,8 +66,10 @@
|
|||||||
# group 1 = src label group 2 = dst host:session
|
# group 1 = src label group 2 = dst host:session
|
||||||
# group 3 = class (absent => actionable) group 4 = message body
|
# group 3 = class (absent => actionable) group 4 = message body
|
||||||
#
|
#
|
||||||
# EXIT CODES (passed through from send-message.sh)
|
# EXIT CODES (passed through from send-message.sh, except 4)
|
||||||
# 0 delivered/queued · 1 target not found · 2 still draft · 3 usage error
|
# 0 delivered/queued · 1 target not found · 2 still draft · 3 usage error
|
||||||
|
# 4 agent-send refusal: local target session exists on multiple socket
|
||||||
|
# servers and no -L / MOSAIC_TMUX_SOCKET disambiguated it (B1)
|
||||||
set -uo pipefail
|
set -uo pipefail
|
||||||
|
|
||||||
SELF_DIR=$(cd -- "$(dirname -- "$0")" && pwd)
|
SELF_DIR=$(cd -- "$(dirname -- "$0")" && pwd)
|
||||||
@@ -158,6 +160,18 @@ B64=$(printf '%s' "$FULL" | base64 -w0)
|
|||||||
|
|
||||||
vflag=""; [ "$VERBOSE" = 1 ] && vflag="-v"
|
vflag=""; [ "$VERBOSE" = 1 ] && vflag="-v"
|
||||||
|
|
||||||
|
# Exact session matching for the sender target (codex PR #1466): without
|
||||||
|
# '=', tmux target syntax accepts an unambiguous PREFIX, so a delivery
|
||||||
|
# aimed at session X can land in X-old. Compound targets (session:win.pane)
|
||||||
|
# and already-exact ('=...') forms pass through untouched. Computed BEFORE
|
||||||
|
# socket discovery so the discovery probes use the same target semantics
|
||||||
|
# (probing '==name' for an already-exact input was a false-negative hit).
|
||||||
|
DST_TARGET="$DST_SESSION"
|
||||||
|
case "$DST_SESSION" in
|
||||||
|
=*|*:*) ;;
|
||||||
|
*) DST_TARGET="=$DST_SESSION" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
# Socket default resolution (B1, 2026-08-29). Precedence: explicit -L >
|
# Socket default resolution (B1, 2026-08-29). Precedence: explicit -L >
|
||||||
# launcher-exported MOSAIC_TMUX_SOCKET > unique socket hit > refusal on
|
# launcher-exported MOSAIC_TMUX_SOCKET > unique socket hit > refusal on
|
||||||
# ambiguity > tmux default socket. The ambiguity refusal fires ONLY when
|
# ambiguity > tmux default socket. The ambiguity refusal fires ONLY when
|
||||||
@@ -181,7 +195,7 @@ if [ -z "$SOCKET_NAME" ] && [ -z "$SSH_TARGET" ]; then
|
|||||||
# '=' forces exact session-name matching: tmux target syntax otherwise
|
# '=' forces exact session-name matching: tmux target syntax otherwise
|
||||||
# accepts an unambiguous PREFIX, so a session named X-old on a socket
|
# accepts an unambiguous PREFIX, so a session named X-old on a socket
|
||||||
# would count as a false hit for target X (codex PR #1466).
|
# would count as a false hit for target X (codex PR #1466).
|
||||||
tmux -L "$sname" has-session -t "=$DST_SESSION" 2>/dev/null && hits="$hits$sname"$'\n'
|
tmux -L "$sname" has-session -t "$DST_TARGET" 2>/dev/null && hits="$hits$sname"$'\n'
|
||||||
done
|
done
|
||||||
hit_count=$(printf '%s' "$hits" | grep -c . || true)
|
hit_count=$(printf '%s' "$hits" | grep -c . || true)
|
||||||
if [ "$hit_count" -gt 1 ]; then
|
if [ "$hit_count" -gt 1 ]; then
|
||||||
@@ -199,16 +213,6 @@ if [ -n "$SOCKET_NAME" ]; then
|
|||||||
socket_args=(-L "$SOCKET_NAME")
|
socket_args=(-L "$SOCKET_NAME")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Exact session matching for the sender target too (codex PR #1466): without
|
|
||||||
# '=', tmux target syntax accepts an unambiguous PREFIX, so a delivery aimed
|
|
||||||
# at session X can land in X-old. Compound targets (session:win.pane) and
|
|
||||||
# already-exact ('=...') forms pass through untouched.
|
|
||||||
DST_TARGET="$DST_SESSION"
|
|
||||||
case "$DST_SESSION" in
|
|
||||||
=*|*:*) ;;
|
|
||||||
*) DST_TARGET="=$DST_SESSION" ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -z "$SSH_TARGET" ]; then
|
if [ -z "$SSH_TARGET" ]; then
|
||||||
# Local pane: call the canonical sender directly.
|
# Local pane: call the canonical sender directly.
|
||||||
exec "$SENDER" "${socket_args[@]}" -t "$DST_TARGET" -b "$B64" -r "$RETRIES" $vflag
|
exec "$SENDER" "${socket_args[@]}" -t "$DST_TARGET" -b "$B64" -r "$RETRIES" $vflag
|
||||||
|
|||||||
Reference in New Issue
Block a user