From c29cf7dcdc2ee9ed89901457c0991cb3dec2737b Mon Sep 17 00:00:00 2001 From: Levi Neely <141506390+lneely@users.noreply.github.com> Date: Sun, 17 May 2026 13:22:00 +0200 Subject: [PATCH] u/cascade: track per-worker failures, annotate status, exit non-zero --- scripts/u/cascade | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/scripts/u/cascade b/scripts/u/cascade index cde8849..6e61b72 100755 --- a/scripts/u/cascade +++ b/scripts/u/cascade @@ -79,7 +79,7 @@ for i in $(seq 0 $((count - 1))); do "$B" -name "$sid" -backend "$WB" -model "$WM" -keep \ "You are a worker agent. Execute the following task exactly. Output only the result. -$instruction" > "${tmpdir}/${sid}.out" 2>&1 +$instruction" > "${tmpdir}/${sid}.out" 2>&1 && touch "${tmpdir}/${sid}.ok" ) & pids+=($!) done @@ -87,12 +87,19 @@ done # Step 3: Wait for all workers. for pid in "${pids[@]}"; do wait "$pid" || true; done -# Step 4: Gather results. +# Step 4: Gather results with status annotations. results="" +failures=0 for sid in "${workers[@]}"; do + if [ -f "${tmpdir}/${sid}.ok" ]; then + status="done" + else + status="failed" + failures=$((failures + 1)) + fi out=$(cat "${tmpdir}/${sid}.out" 2>/dev/null || echo "(no output)") results="${results} ---- ${sid} --- +--- ${sid} [STATUS: ${status}] --- ${out} " done @@ -100,13 +107,15 @@ done # Step 5: Synthesize or just print results. if [ "$synthesize" -eq 0 ]; then printf '%s\n' "$results" + [ "$failures" -gt 0 ] && exit 1 else "$B" -backend "$PB" -model "$PM" \ - "Synthesize these worker results into a final, coherent answer to the original task. + "Synthesize these worker results into a final, coherent answer to the original task. Note: workers marked [STATUS: failed] did not complete successfully — account for this in your synthesis. ORIGINAL TASK: $task WORKER RESULTS: $results" + [ "$failures" -gt 0 ] && exit 1 fi