From a50b236c8c4f12d9950e0014f031dc0298e42b2b Mon Sep 17 00:00:00 2001 From: Alexander Whitestone Date: Fri, 17 Apr 2026 05:22:03 +0000 Subject: [PATCH] fix: reset_stale_states delegates to standalone script (closes #650) --- scripts/nightly-pipeline-scheduler.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/nightly-pipeline-scheduler.sh b/scripts/nightly-pipeline-scheduler.sh index d1b546d8..07895392 100644 --- a/scripts/nightly-pipeline-scheduler.sh +++ b/scripts/nightly-pipeline-scheduler.sh @@ -169,10 +169,16 @@ else: reset_stale_states() { - python3 -c " + # Delegate to standalone script (fixes #650: inline Python $STATE_FILE escaping bug) + local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + if [[ -f "$script_dir/reset_pipeline_state.py" ]]; then + python3 "$script_dir/reset_pipeline_state.py" --state-file "$STATE_FILE" + else + # Fallback: inline reset with proper variable expansion + python3 -c " import json, os from datetime import datetime, timezone, timedelta -path = '\$STATE_FILE' +path = '$STATE_FILE' if not os.path.exists(path): exit(0) with open(path) as f: @@ -200,6 +206,7 @@ if stale: json.dump(d, f, indent=2) print('Reset stale pipelines: ' + ', '.join(stale)) " 2>/dev/null + fi } check_dependency() {