fix(release): parse agent-run status JSON when worker emits multiple blocks
Memind CI / Test, build, and release guards (push) Has been cancelled

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 <cursoragent@cursor.com>
This commit is contained in:
john
2026-09-10 20:20:06 +08:00
parent 3e6b0c262a
commit f6c9256fbc
+13 -1
View File
@@ -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() {