diff --git a/scripts/release-portal-runtime-prod.sh b/scripts/release-portal-runtime-prod.sh index 9cd65df..38ea829 100755 --- a/scripts/release-portal-runtime-prod.sh +++ b/scripts/release-portal-runtime-prod.sh @@ -633,7 +633,19 @@ block_new_agent_runs_for_release() { read_agent_run_status_json() { local worker_script="$1" - node "${worker_script}" --status 2>/dev/null | sed -n '/^{/,$p' || true + node "${worker_script}" --status 2>/dev/null | node --input-type=module -e ' +let s = ""; +process.stdin.on("data", (chunk) => { s += chunk; }); +process.stdin.on("end", () => { + let best = null; + for (const match of s.matchAll(/\{[\s\S]*?\}/g)) { + try { + const obj = JSON.parse(match[0]); + if (obj && typeof obj === "object" && obj.queue) best = JSON.stringify(obj); + } catch {} + } + if (best) process.stdout.write(best); +});' || true } drain_active_agent_runs() {