From 0dbef59a57f10e2765592792b92960f10471b4d4 Mon Sep 17 00:00:00 2001 From: sudacode Date: Sat, 28 Mar 2026 15:14:36 -0700 Subject: [PATCH] fix(verification): improve real-runtime lease trap handling - Add dedicated termination handler with proper exit codes for INT/TERM - Register traps only when lease is actually acquired instead of globally - Ensure clean lease release on all signal paths --- .../scripts/verify_subminer_change.sh | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/plugins/subminer-workflow/skills/subminer-change-verification/scripts/verify_subminer_change.sh b/plugins/subminer-workflow/skills/subminer-change-verification/scripts/verify_subminer_change.sh index db637977..4e473e6f 100755 --- a/plugins/subminer-workflow/skills/subminer-change-verification/scripts/verify_subminer_change.sh +++ b/plugins/subminer-workflow/skills/subminer-change-verification/scripts/verify_subminer_change.sh @@ -239,6 +239,19 @@ release_real_runtime_lease() { fi } +handle_real_runtime_lease_termination() { + local signal=${1:-EXIT} + release_real_runtime_lease + case "$signal" in + INT) + exit 130 + ;; + TERM) + exit 143 + ;; + esac +} + compute_final_status() { if [[ "$FAILED" == "1" ]]; then FINAL_STATUS="failed" @@ -390,8 +403,6 @@ REAL_RUNTIME_LEASE_DIR="" REAL_RUNTIME_LEASE_ERROR="" PATH_SELECTION_MODE="auto" -trap 'release_real_runtime_lease' EXIT - while [[ $# -gt 0 ]]; do case "$1" in --lane) @@ -502,6 +513,9 @@ for lane in "${SELECTED_LANES[@]}"; do record_blocked_step "$lane" "real-runtime-lease" "$REAL_RUNTIME_LEASE_ERROR" continue fi + trap 'handle_real_runtime_lease_termination EXIT' EXIT + trap 'handle_real_runtime_lease_termination INT' INT + trap 'handle_real_runtime_lease_termination TERM' TERM helper=$(find_real_runtime_helper || true) if [[ -z "${helper:-}" ]]; then record_blocked_step "$lane" "real-runtime-helper" "no real-runtime helper script available in $SCRIPT_DIR"