From f6c9256fbc06278535d5aaf750cc0289c8c9c8f0 Mon Sep 17 00:00:00 2001 From: john Date: Thu, 10 Sep 2026 20:20:06 +0800 Subject: [PATCH] fix(release): parse agent-run status JSON when worker emits multiple blocks Release drain was timing out because --status now prints a preamble JSON blob without queue; pick the object that contains queue instead of sed from the first brace. Co-authored-by: Cursor --- scripts/release-portal-runtime-prod.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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() {