Merge pull request 'fix: Coordinate review injection between review-poll.sh and dev-agent.sh to prevent double-injection (#90)' (#137) from fix/issue-90 into main

This commit is contained in:
johba 2026-03-18 10:13:54 +01:00
commit d71a1e2f8c
2 changed files with 13 additions and 0 deletions

View file

@ -1239,6 +1239,8 @@ Instructions:
# Do NOT update LAST_PHASE_MTIME here — leave it stale so the outer # Do NOT update LAST_PHASE_MTIME here — leave it stale so the outer
# loop detects the change on its next tick and dispatches the new phase. # loop detects the change on its next tick and dispatches the new phase.
REVIEW_FOUND=true # Prevent timeout injection REVIEW_FOUND=true # Prevent timeout injection
# Clean up review-poll sentinel if it exists (session already advanced)
rm -f "/tmp/review-injected-${PROJECT_NAME}-${PR_NUMBER}"
break break
fi fi
@ -1273,6 +1275,15 @@ Instructions:
[ -n "$VERDICT" ] && log "verdict from formal review: $VERDICT" [ -n "$VERDICT" ] && log "verdict from formal review: $VERDICT"
fi fi
# Skip injection if review-poll.sh already injected (sentinel present)
REVIEW_SENTINEL="/tmp/review-injected-${PROJECT_NAME}-${PR_NUMBER}"
if [ -n "$VERDICT" ] && [ -f "$REVIEW_SENTINEL" ]; then
log "review already injected by review-poll (sentinel exists) — skipping"
rm -f "$REVIEW_SENTINEL"
REVIEW_FOUND=true
break
fi
if [ "$VERDICT" = "APPROVE" ]; then if [ "$VERDICT" = "APPROVE" ]; then
REVIEW_FOUND=true REVIEW_FOUND=true
inject_into_session "Approved! PR #${PR_NUMBER} has been approved by the reviewer. inject_into_session "Approved! PR #${PR_NUMBER} has been approved by the reviewer.

View file

@ -156,6 +156,8 @@ Instructions:
tmux delete-buffer -b "review-inject-${pr_num}" 2>/dev/null || true tmux delete-buffer -b "review-inject-${pr_num}" 2>/dev/null || true
rm -f "${inject_tmp}" rm -f "${inject_tmp}"
log " #${pr_num} review (${verdict}) injected into session ${session}" log " #${pr_num} review (${verdict}) injected into session ${session}"
# Write sentinel so dev-agent.sh awaiting_review loop skips its own injection
touch "/tmp/review-injected-${PROJECT_NAME}-${pr_num}"
} }
while IFS= read -r line; do while IFS= read -r line; do