Compare commits

...

1 commit

Author SHA1 Message Date
Agent
d077b1455f fix: fix: entrypoint-reproduce.sh ignores DISINTO_FORMULA env var — always runs reproduce formula (#356)
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline was successful
2026-04-07 18:13:13 +00:00

View file

@ -23,7 +23,17 @@
set -euo pipefail set -euo pipefail
DISINTO_DIR="${DISINTO_DIR:-/home/agent/disinto}" DISINTO_DIR="${DISINTO_DIR:-/home/agent/disinto}"
REPRODUCE_FORMULA="${DISINTO_DIR}/formulas/reproduce.toml"
# Select formula based on DISINTO_FORMULA env var (set by dispatcher)
case "${DISINTO_FORMULA:-reproduce}" in
triage)
ACTIVE_FORMULA="${DISINTO_DIR}/formulas/triage.toml"
;;
*)
ACTIVE_FORMULA="${DISINTO_DIR}/formulas/reproduce.toml"
;;
esac
REPRODUCE_TIMEOUT="${REPRODUCE_TIMEOUT_MINUTES:-15}" REPRODUCE_TIMEOUT="${REPRODUCE_TIMEOUT_MINUTES:-15}"
LOGFILE="/home/agent/data/logs/reproduce.log" LOGFILE="/home/agent/data/logs/reproduce.log"
SCREENSHOT_DIR="/home/agent/data/screenshots" SCREENSHOT_DIR="/home/agent/data/screenshots"
@ -75,7 +85,11 @@ export PROJECT_NAME
PROJECT_REPO_ROOT="/home/agent/repos/${PROJECT_NAME}" PROJECT_REPO_ROOT="/home/agent/repos/${PROJECT_NAME}"
if [ "${DISINTO_FORMULA:-reproduce}" = "triage" ]; then
log "Starting triage-agent for issue #${ISSUE_NUMBER} (project: ${PROJECT_NAME})"
else
log "Starting reproduce-agent for issue #${ISSUE_NUMBER} (project: ${PROJECT_NAME})" log "Starting reproduce-agent for issue #${ISSUE_NUMBER} (project: ${PROJECT_NAME})"
fi
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Verify claude CLI is available (mounted from host) # Verify claude CLI is available (mounted from host)
@ -99,20 +113,20 @@ LOCK_HOLDER="reproduce-agent-${ISSUE_NUMBER}"
FORMULA_STACK_SCRIPT="" FORMULA_STACK_SCRIPT=""
FORMULA_TIMEOUT_MINUTES="${REPRODUCE_TIMEOUT}" FORMULA_TIMEOUT_MINUTES="${REPRODUCE_TIMEOUT}"
if [ -f "$REPRODUCE_FORMULA" ]; then if [ -f "$ACTIVE_FORMULA" ]; then
FORMULA_STACK_SCRIPT=$(python3 -c " FORMULA_STACK_SCRIPT=$(python3 -c "
import sys, tomllib import sys, tomllib
with open(sys.argv[1], 'rb') as f: with open(sys.argv[1], 'rb') as f:
d = tomllib.load(f) d = tomllib.load(f)
print(d.get('stack_script', '')) print(d.get('stack_script', ''))
" "$REPRODUCE_FORMULA" 2>/dev/null || echo "") " "$ACTIVE_FORMULA" 2>/dev/null || echo "")
_tm=$(python3 -c " _tm=$(python3 -c "
import sys, tomllib import sys, tomllib
with open(sys.argv[1], 'rb') as f: with open(sys.argv[1], 'rb') as f:
d = tomllib.load(f) d = tomllib.load(f)
print(d.get('timeout_minutes', '${REPRODUCE_TIMEOUT}')) print(d.get('timeout_minutes', '${REPRODUCE_TIMEOUT}'))
" "$REPRODUCE_FORMULA" 2>/dev/null || echo "${REPRODUCE_TIMEOUT}") " "$ACTIVE_FORMULA" 2>/dev/null || echo "${REPRODUCE_TIMEOUT}")
FORMULA_TIMEOUT_MINUTES="$_tm" FORMULA_TIMEOUT_MINUTES="$_tm"
fi fi
@ -255,7 +269,11 @@ PROMPT
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Run Claude with Playwright MCP # Run Claude with Playwright MCP
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
if [ "${DISINTO_FORMULA:-reproduce}" = "triage" ]; then
log "Starting triage-agent session (timeout: ${FORMULA_TIMEOUT_MINUTES}m)..."
else
log "Starting Claude reproduction session (timeout: ${FORMULA_TIMEOUT_MINUTES}m)..." log "Starting Claude reproduction session (timeout: ${FORMULA_TIMEOUT_MINUTES}m)..."
fi
CLAUDE_EXIT=0 CLAUDE_EXIT=0
timeout "$(( FORMULA_TIMEOUT_MINUTES * 60 ))" \ timeout "$(( FORMULA_TIMEOUT_MINUTES * 60 ))" \
@ -295,9 +313,13 @@ log "Outcome: ${OUTCOME}"
FINDINGS="" FINDINGS=""
if [ -f "/tmp/reproduce-findings-${ISSUE_NUMBER}.md" ]; then if [ -f "/tmp/reproduce-findings-${ISSUE_NUMBER}.md" ]; then
FINDINGS=$(cat "/tmp/reproduce-findings-${ISSUE_NUMBER}.md") FINDINGS=$(cat "/tmp/reproduce-findings-${ISSUE_NUMBER}.md")
else
if [ "${DISINTO_FORMULA:-reproduce}" = "triage" ]; then
FINDINGS="Triage-agent completed but did not write a findings report. Claude output:\n\`\`\`\n$(tail -100 "/tmp/reproduce-claude-output-${ISSUE_NUMBER}.txt" 2>/dev/null || echo '(no output)')\n\`\`\`"
else else
FINDINGS="Reproduce-agent completed but did not write a findings report. Claude output:\n\`\`\`\n$(tail -100 "/tmp/reproduce-claude-output-${ISSUE_NUMBER}.txt" 2>/dev/null || echo '(no output)')\n\`\`\`" FINDINGS="Reproduce-agent completed but did not write a findings report. Claude output:\n\`\`\`\n$(tail -100 "/tmp/reproduce-claude-output-${ISSUE_NUMBER}.txt" 2>/dev/null || echo '(no output)')\n\`\`\`"
fi fi
fi
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Collect screenshot paths for comment # Collect screenshot paths for comment
@ -381,6 +403,13 @@ _post_comment() {
BUG_REPORT_ID=$(_label_id "bug-report" "#e4e669") BUG_REPORT_ID=$(_label_id "bug-report" "#e4e669")
_remove_label "$ISSUE_NUMBER" "$BUG_REPORT_ID" _remove_label "$ISSUE_NUMBER" "$BUG_REPORT_ID"
# Determine agent name for comments
if [ "${DISINTO_FORMULA:-reproduce}" = "triage" ]; then
AGENT_NAME="Triage-agent"
else
AGENT_NAME="Reproduce-agent"
fi
# Determine outcome and apply appropriate labels # Determine outcome and apply appropriate labels
LABEL_NAME="" LABEL_NAME=""
LABEL_COLOR="" LABEL_COLOR=""
@ -396,13 +425,13 @@ case "$OUTCOME" in
# Obvious cause → add reproduced status label, create backlog issue for dev-agent # Obvious cause → add reproduced status label, create backlog issue for dev-agent
LABEL_NAME="reproduced" LABEL_NAME="reproduced"
LABEL_COLOR="#0075ca" LABEL_COLOR="#0075ca"
COMMENT_HEADER="## Reproduce-agent: **Reproduced with obvious cause** :white_check_mark: :zap:" COMMENT_HEADER="## ${AGENT_NAME}: **Reproduced with obvious cause** :white_check_mark: :zap:"
CREATE_BACKLOG_ISSUE=true CREATE_BACKLOG_ISSUE=true
else else
# Cause unclear → in-triage → Triage-agent # Cause unclear → in-triage → Triage-agent
LABEL_NAME="in-triage" LABEL_NAME="in-triage"
LABEL_COLOR="#d93f0b" LABEL_COLOR="#d93f0b"
COMMENT_HEADER="## Reproduce-agent: **Reproduced, cause unclear** :white_check_mark: :mag:" COMMENT_HEADER="## ${AGENT_NAME}: **Reproduced, cause unclear** :white_check_mark: :mag:"
fi fi
;; ;;
@ -410,14 +439,14 @@ case "$OUTCOME" in
# Cannot reproduce → rejected → Human review # Cannot reproduce → rejected → Human review
LABEL_NAME="rejected" LABEL_NAME="rejected"
LABEL_COLOR="#e4e669" LABEL_COLOR="#e4e669"
COMMENT_HEADER="## Reproduce-agent: **Cannot reproduce** :x:" COMMENT_HEADER="## ${AGENT_NAME}: **Cannot reproduce** :x:"
;; ;;
needs-triage) needs-triage)
# Inconclusive (timeout, env issues) → blocked → Gardener/human # Inconclusive (timeout, env issues) → blocked → Gardener/human
LABEL_NAME="blocked" LABEL_NAME="blocked"
LABEL_COLOR="#e11d48" LABEL_COLOR="#e11d48"
COMMENT_HEADER="## Reproduce-agent: **Inconclusive, blocked** :construction:" COMMENT_HEADER="## ${AGENT_NAME}: **Inconclusive, blocked** :construction:"
;; ;;
esac esac
@ -460,9 +489,9 @@ COMMENT_BODY="${COMMENT_HEADER}
${FINDINGS}${SCREENSHOT_LIST} ${FINDINGS}${SCREENSHOT_LIST}
--- ---
*Reproduce-agent run at $(date -u '+%Y-%m-%d %H:%M:%S UTC') — project: ${PROJECT_NAME}*" *${AGENT_NAME} run at $(date -u '+%Y-%m-%d %H:%M:%S UTC') — project: ${PROJECT_NAME}*"
_post_comment "$ISSUE_NUMBER" "$COMMENT_BODY" _post_comment "$ISSUE_NUMBER" "$COMMENT_BODY"
log "Posted findings to issue #${ISSUE_NUMBER}" log "Posted findings to issue #${ISSUE_NUMBER}"
log "Reproduce-agent done. Outcome: ${OUTCOME}" log "${AGENT_NAME} done. Outcome: ${OUTCOME}"