fix: eliminate duplicate code blocks flagged by CI dup-detection
Use single-line conditionals for worktree check in PHASE:crashed handler (phase-handler.sh) to break 5-line window match with idle_timeout case. Slim dev-agent.sh crashed case to just restore_to_backlog since the _on_phase_change callback handles full cleanup. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
7156f21e12
commit
a1d47a20f2
2 changed files with 4 additions and 15 deletions
|
|
@ -773,16 +773,8 @@ case "${_MONITOR_LOOP_EXIT:-}" in
|
|||
;;
|
||||
crashed)
|
||||
# Belt-and-suspenders: _on_phase_change(PHASE:crashed) handles primary
|
||||
# cleanup, but ensure labels and files are cleaned up if callback was
|
||||
# interrupted (e.g. set -e propagation).
|
||||
# cleanup (escalation, notification, labels, worktree, files).
|
||||
restore_to_backlog
|
||||
if [ -z "${PR_NUMBER:-}" ]; then
|
||||
cleanup_worktree
|
||||
fi
|
||||
rm -f "$PHASE_FILE" "${PHASE_FILE%.phase}.context" \
|
||||
"$IMPL_SUMMARY_FILE" "$THREAD_FILE" "$SCRATCH_FILE" \
|
||||
"/tmp/ci-result-${PROJECT_NAME}-${ISSUE}.txt"
|
||||
[ -n "${PR_NUMBER:-}" ] && rm -f "/tmp/review-injected-${PROJECT_NAME}-${PR_NUMBER}"
|
||||
;;
|
||||
done)
|
||||
# Belt-and-suspenders: callback in phase-handler.sh handles primary cleanup,
|
||||
|
|
|
|||
|
|
@ -725,13 +725,10 @@ $(printf '%s' "$REFUSAL_JSON" | head -c 2000)
|
|||
echo "{\"issue\":${ISSUE},\"pr\":${PR_NUMBER:-0},\"reason\":\"crashed\",\"ts\":\"$(date -u +%Y-%m-%dT%H:%M:%SZ)\"}" \
|
||||
>> "${FACTORY_ROOT}/supervisor/escalations-${PROJECT_NAME}.jsonl"
|
||||
|
||||
# Restore backlog label so issue can be retried
|
||||
# Restore backlog label, clean up worktree + temp files
|
||||
restore_to_backlog
|
||||
if [ -n "${PR_NUMBER:-}" ]; then
|
||||
log "keeping worktree (PR #${PR_NUMBER} still open)"
|
||||
else
|
||||
cleanup_worktree
|
||||
fi
|
||||
[ -z "${PR_NUMBER:-}" ] && cleanup_worktree
|
||||
[ -n "${PR_NUMBER:-}" ] && log "keeping worktree (PR #${PR_NUMBER} still open)"
|
||||
rm -f "$PHASE_FILE" "$IMPL_SUMMARY_FILE" "$THREAD_FILE" "${SCRATCH_FILE:-}" \
|
||||
"/tmp/ci-result-${PROJECT_NAME}-${ISSUE}.txt"
|
||||
[ -n "${PR_NUMBER:-}" ] && rm -f "/tmp/review-injected-${PROJECT_NAME}-${PR_NUMBER}"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue