fix: Action session name missing PROJECT_NAME prefix (#432)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
openhands 2026-03-21 17:05:09 +00:00
parent 89a9a822de
commit 4a9f610c73
3 changed files with 7 additions and 6 deletions

View file

@ -6,7 +6,7 @@
# Lifecycle: # Lifecycle:
# 1. Fetch issue body (action formula) + existing comments # 1. Fetch issue body (action formula) + existing comments
# 2. Create isolated git worktree: /tmp/action-{issue}-{timestamp} # 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 # 4. Inject initial prompt: formula + comments + phase protocol instructions
# 5. Monitor phase file via monitor_phase_loop (shared with dev-agent) # 5. Monitor phase file via monitor_phase_loop (shared with dev-agent)
# Path A (git output): Claude pushes → handler creates PR → CI poll → review # 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. # Key principle: The runtime creates and destroys. The formula preserves.
# The formula must push results before signaling done — the worktree is nuked after. # 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 # Log: action/action-poll-{project}.log
set -euo pipefail set -euo pipefail
@ -32,7 +32,7 @@ source "$(dirname "$0")/../lib/agent-session.sh"
source "$(dirname "$0")/../lib/formula-session.sh" source "$(dirname "$0")/../lib/formula-session.sh"
# shellcheck source=../dev/phase-handler.sh # shellcheck source=../dev/phase-handler.sh
source "$(dirname "$0")/../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" LOCKFILE="/tmp/action-agent-${ISSUE}.lock"
LOGFILE="${FACTORY_ROOT}/action/action-poll-${PROJECT_NAME:-default}.log" LOGFILE="${FACTORY_ROOT}/action/action-poll-${PROJECT_NAME:-default}.log"
THREAD_FILE="/tmp/action-thread-${ISSUE}" THREAD_FILE="/tmp/action-thread-${ISSUE}"

View file

@ -3,7 +3,7 @@
# #
# An issue is ready for action if: # An issue is ready for action if:
# - It is open and labeled 'action' # - 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: # Usage:
# cron every 10min # cron every 10min
@ -52,7 +52,7 @@ log "found ${COUNT} open action issue(s)"
# poll picks up remaining issues. # poll picks up remaining issues.
for i in $(seq 0 $((COUNT - 1))); do for i in $(seq 0 $((COUNT - 1))); do
ISSUE_NUM=$(printf '%s' "$ACTION_ISSUES" | jq -r ".[$i].number") 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 if tmux has-session -t "$SESSION" 2>/dev/null; then
log "issue #${ISSUE_NUM}: session ${SESSION} already active, skipping" log "issue #${ISSUE_NUM}: session ${SESSION} already active, skipping"

View file

@ -250,8 +250,9 @@ Please answer this question about your review. Explain your reasoning."
action) action)
# Route reply into the action tmux session using context_tag (issue number) # 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_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 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 if tmux has-session -t "$ACTION_SESSION" 2>/dev/null; then
ACTION_INJECT_MSG="Human reply from ${SENDER} in Matrix: ACTION_INJECT_MSG="Human reply from ${SENDER} in Matrix: