From 4a9f610c73ac91d832d4bba982acb7671ff286c1 Mon Sep 17 00:00:00 2001 From: openhands Date: Sat, 21 Mar 2026 17:05:09 +0000 Subject: [PATCH] fix: Action session name missing PROJECT_NAME prefix (#432) Co-Authored-By: Claude Opus 4.6 (1M context) --- action/action-agent.sh | 6 +++--- action/action-poll.sh | 4 ++-- lib/matrix_listener.sh | 3 ++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/action/action-agent.sh b/action/action-agent.sh index a98ce0e..68ee8a9 100755 --- a/action/action-agent.sh +++ b/action/action-agent.sh @@ -6,7 +6,7 @@ # Lifecycle: # 1. Fetch issue body (action formula) + existing comments # 2. Create isolated git worktree: /tmp/action-{issue}-{timestamp} -# 3. Create tmux session: action-{issue_num} with interactive claude in worktree +# 3. Create tmux session: action-{project}-{issue_num} with interactive claude in worktree # 4. Inject initial prompt: formula + comments + phase protocol instructions # 5. Monitor phase file via monitor_phase_loop (shared with dev-agent) # Path A (git output): Claude pushes → handler creates PR → CI poll → review @@ -18,7 +18,7 @@ # Key principle: The runtime creates and destroys. The formula preserves. # The formula must push results before signaling done — the worktree is nuked after. # -# Session: action-{issue_num} (tmux) +# Session: action-{project}-{issue_num} (tmux) # Log: action/action-poll-{project}.log set -euo pipefail @@ -32,7 +32,7 @@ source "$(dirname "$0")/../lib/agent-session.sh" source "$(dirname "$0")/../lib/formula-session.sh" # shellcheck source=../dev/phase-handler.sh source "$(dirname "$0")/../dev/phase-handler.sh" -SESSION_NAME="action-${ISSUE}" +SESSION_NAME="action-${PROJECT_NAME}-${ISSUE}" LOCKFILE="/tmp/action-agent-${ISSUE}.lock" LOGFILE="${FACTORY_ROOT}/action/action-poll-${PROJECT_NAME:-default}.log" THREAD_FILE="/tmp/action-thread-${ISSUE}" diff --git a/action/action-poll.sh b/action/action-poll.sh index fafd737..d164977 100755 --- a/action/action-poll.sh +++ b/action/action-poll.sh @@ -3,7 +3,7 @@ # # An issue is ready for action if: # - It is open and labeled 'action' -# - No tmux session named action-{issue_num} is already active +# - No tmux session named action-{project}-{issue_num} is already active # # Usage: # cron every 10min @@ -52,7 +52,7 @@ log "found ${COUNT} open action issue(s)" # poll picks up remaining issues. for i in $(seq 0 $((COUNT - 1))); do ISSUE_NUM=$(printf '%s' "$ACTION_ISSUES" | jq -r ".[$i].number") - SESSION="action-${ISSUE_NUM}" + SESSION="action-${PROJECT_NAME}-${ISSUE_NUM}" if tmux has-session -t "$SESSION" 2>/dev/null; then log "issue #${ISSUE_NUM}: session ${SESSION} already active, skipping" diff --git a/lib/matrix_listener.sh b/lib/matrix_listener.sh index efcf2fa..ef6d0b5 100755 --- a/lib/matrix_listener.sh +++ b/lib/matrix_listener.sh @@ -250,8 +250,9 @@ Please answer this question about your review. Explain your reasoning." action) # Route reply into the action tmux session using context_tag (issue number) ACTION_ISSUE=$(awk -F'\t' -v id="$THREAD_ROOT" '$1 == id {print $4}' "$THREAD_MAP" 2>/dev/null || true) + ACTION_PROJECT=$(awk -F'\t' -v id="$THREAD_ROOT" '$1 == id {print $5}' "$THREAD_MAP" 2>/dev/null || true) if [ -n "$ACTION_ISSUE" ]; then - ACTION_SESSION="action-${ACTION_ISSUE}" + ACTION_SESSION="action-${ACTION_PROJECT}-${ACTION_ISSUE}" if tmux has-session -t "$ACTION_SESSION" 2>/dev/null; then ACTION_INJECT_MSG="Human reply from ${SENDER} in Matrix: