[object Object]

← back to Wallco Ai

Add seam-joint-heal-loop: autonomous yolo-runner over the 9 roots, DTD continue/pause decider, one-shot per root (no INSERT-only bloat), 07:00 backstop

cbb6d9efa819d78506eea3d3100adf34398e0a2c · 2026-06-12 09:16:45 -0700 · Steve Abrams

Files touched

Diff

commit cbb6d9efa819d78506eea3d3100adf34398e0a2c
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Fri Jun 12 09:16:45 2026 -0700

    Add seam-joint-heal-loop: autonomous yolo-runner over the 9 roots, DTD continue/pause decider, one-shot per root (no INSERT-only bloat), 07:00 backstop
---
 scripts/seam-joint-heal-loop.sh | 99 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 99 insertions(+)

diff --git a/scripts/seam-joint-heal-loop.sh b/scripts/seam-joint-heal-loop.sh
new file mode 100755
index 0000000..9bf4fd2
--- /dev/null
+++ b/scripts/seam-joint-heal-loop.sh
@@ -0,0 +1,99 @@
+#!/usr/bin/env bash
+# seam-joint-heal-loop.sh — autonomous yolo-runner for the wallco joint-heal build.
+# Steve (2026-06-12, leaving): "run yolo-runner agent with dtd agent helping, keep
+# refining, building, looping." Drives scripts/seam-joint-heal-pipeline.py across the
+# 9 Wave-1 roots, with the DTD panel as the CONTINUE/PAUSE decider between waves.
+#
+# WHY each root runs AT MOST ONCE: the heal is DETERMINISTIC (PIL edge/mid heal +
+# clean-edge-upscale, no ComfyUI). Re-running a done root re-inserts byte-identical
+# variants — and all_designs is INSERT-ONLY (no UPDATE/DELETE), so that is permanent
+# bloat. So we track processed roots in a state file and never re-run them. The loop
+# therefore BUILDS the full clean grid (sacred new-id, is_published=FALSE, 150 DPI)
+# and stops — it does not fake-loop all night piling up dupes.
+#
+# Stops on: all 9 roots processed · /tmp/seam-joint-heal.STOP · 07:00 PT backstop ·
+# DTD votes PAUSE · a wave that makes no progress.
+#
+# Nothing publishes. Roots are sacred. Local only — no Kamatera, no deploy.
+set -uo pipefail
+cd "$(dirname "$0")/.."
+
+ROOTS=(2656 2766 3391 53999 54002 54092 54110 54112 54290)
+TARGET="${TARGET:-2}"                 # >= this many clean variants = root "done"
+MAXV="${MAXV:-6}"                     # heal configs tried per root
+BATCH="${BATCH:-3}"                   # roots per wave before a DTD checkpoint
+STOP_FLAG="/tmp/seam-joint-heal.STOP"
+STATE="/tmp/seam-joint-heal-loop.processed"   # root ids already attempted (one-shot guard)
+LOG="${LOG:-/tmp/seam-joint-heal-loop.log}"
+DTD="$HOME/.claude/skills/dtd/scripts/panel.sh"
+DBURL="$(grep -m1 '^DATABASE_URL=' .env | cut -d= -f2-)"
+# 07:00 next day backstop (BSD date on macOS); fallback = now + 10h
+STOP_EPOCH="$(date -v+1d -v7H -v0M -v0S +%s 2>/dev/null || echo $(( $(date +%s) + 36000 )))"
+
+ts(){ date "+%Y-%m-%dT%H:%M:%S%z"; }
+logl(){ printf '[%s] %s\n' "$(ts)" "$*" >> "$LOG"; }
+cnt(){ psql "$DBURL" -tA -c "SELECT count(*) FROM all_designs WHERE generator='seam-joint-healed' AND parent_design_id=$1;" 2>/dev/null | tr -d '[:space:]'; }
+processed(){ [ -f "$STATE" ] && grep -qx "$1" "$STATE"; }
+mark_processed(){ echo "$1" >> "$STATE"; }
+
+# DTD continue/pause decider. Echoes CONTINUE or PAUSE (tally → stderr/log).
+dtd_decide(){ # $1=wave $2=done $3=total
+  local q dir cont=0 pause=0 v f
+  q="Autonomous wallco JOINT-HEAL loop, wave $1: ${2}/${3} of the 9 Wave-1 roots now have >=${TARGET} clean 150-DPI seam-joint-healed variants (sacred new ids, is_published=FALSE — NOTHING publishes; Steve curates in the morning). Each remaining root is a one-shot deterministic heal. Should the autonomous runner CONTINUE to the next wave or PAUSE for Steve to review? Answer one word. VERDICT: CONTINUE or PAUSE."
+  dir="$(bash "$DTD" "$q" 2>/dev/null | grep -oE '/tmp/dtd-[0-9a-z-]+' | head -1)"
+  for f in codex qwen; do
+    v="$(grep -ioE 'VERDICT:[[:space:]]*(CONTINUE|PAUSE)' "$dir/$f.txt" 2>/dev/null | grep -ioE 'CONTINUE|PAUSE' | tail -1 | tr 'a-z' 'A-Z')"
+    [ "$v" = "CONTINUE" ] && cont=$((cont+1))
+    [ "$v" = "PAUSE" ] && pause=$((pause+1))
+  done
+  # rule vote: while real un-bloating work remains, default CONTINUE
+  cont=$((cont+1))
+  logl "wave $1 DTD votes — codex/qwen + rule → CONTINUE=$cont PAUSE=$pause"
+  [ "$cont" -gt "$pause" ] && echo CONTINUE || echo PAUSE
+}
+
+logl "=== seam-joint-heal-loop START — target=$TARGET maxv=$MAXV batch=$BATCH | backstop $(date -r "$STOP_EPOCH" 2>/dev/null) | kill: touch $STOP_FLAG ==="
+wave=0
+while :; do
+  [ -f "$STOP_FLAG" ] && { logl "STOP flag present — exit"; break; }
+  [ "$(date +%s)" -ge "$STOP_EPOCH" ] && { logl "07:00 backstop reached — exit"; break; }
+
+  wave=$((wave+1)); in_wave=0; worked=0
+  for r in "${ROOTS[@]}"; do
+    n="$(cnt "$r")"; n="${n:-0}"
+    if [ "$n" -ge "$TARGET" ]; then continue; fi
+    processed "$r" && continue          # one-shot: deterministic, never re-run
+    logl "wave $wave: root $r has $n/<$TARGET clean — running pipeline (max-variants=$MAXV)"
+    python3 scripts/seam-joint-heal-pipeline.py --root "$r" --max-variants "$MAXV" >> "$LOG" 2>&1
+    mark_processed "$r"; worked=1; in_wave=$((in_wave+1))
+    n2="$(cnt "$r")"; logl "wave $wave: root $r now has ${n2:-0} clean variants"
+    [ -f "$STOP_FLAG" ] && break
+    [ "$in_wave" -ge "$BATCH" ] && break
+  done
+
+  # tally progress
+  done=0
+  for r in "${ROOTS[@]}"; do n="$(cnt "$r")"; [ "${n:-0}" -ge "$TARGET" ] && done=$((done+1)); done
+  logl "wave $wave complete: $done/${#ROOTS[@]} roots at target (>=$TARGET clean)"
+
+  if [ "$done" -ge "${#ROOTS[@]}" ]; then logl "ALL ${#ROOTS[@]} roots cleaned — BUILD COMPLETE"; break; fi
+  # every root either at target or already attempted (one-shot) → nothing left to do
+  remaining=0
+  for r in "${ROOTS[@]}"; do
+    n="$(cnt "$r")"; { [ "${n:-0}" -lt "$TARGET" ] && ! processed "$r"; } && remaining=$((remaining+1))
+  done
+  if [ "$remaining" -eq 0 ]; then
+    logl "no un-attempted roots remain (hard roots may have <$TARGET) — DONE building, exit"; break
+  fi
+  [ "$worked" -eq 0 ] && { logl "wave made no progress — exit"; break; }
+
+  V="$(dtd_decide "$wave" "$done" "${#ROOTS[@]}")"
+  logl "wave $wave → $V"
+  [ "$V" = "PAUSE" ] && { logl "DTD PAUSE — exit for Steve review"; break; }
+  sleep 20
+done
+
+# final tally
+fin=0
+for r in "${ROOTS[@]}"; do n="$(cnt "$r")"; [ "${n:-0}" -ge "$TARGET" ] && fin=$((fin+1)); done
+logl "=== FINAL: waves=$wave roots_at_target=$fin/${#ROOTS[@]} | curator: http://127.0.0.1:9905/admin/variant-curator ==="

← 0c5c224 seam-joint-heal pipeline + variant-curator shows seam-joint-  ·  back to Wallco Ai  ·  Fix variants montage 0/90: count PASS rows from both i2i + o d99cb67 →