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() {