harness(cr): wait for the background render instead of racing it
deploy / build (push) Canceled after 0s
deploy / test (push) Canceled after 1m12s

The first run of this scenario reported "no podcast_episodes row — the
render sweep never reached this mission" while the pipeline was working.
It was not: the render is a sweep every two minutes followed by a
text-to-speech call that takes minutes on a full dialogue, and the
assertion fired the instant the mission completed. That asserts the
worker is FAST, not that it works.

It now waits up to CR_EPISODE_TIMEOUT (default 900s) for a verdict and
reports how long it waited when none arrives, so a timeout reads as a
timeout rather than as a product defect.

Everything else in that run passed, including the one this scenario was
written for: analysis.md is on main (6717 bytes), where the same path
returned 404 before the merge fix.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WZb5A2kfVfjpdwSochkuHz
This commit is contained in:
Omar Sobh
2026-09-22 13:37:24 -05:00
co-authored by Claude Opus 5
parent 9d427900a5
commit 785a7e7b0e
+13 -2
View File
@@ -1588,12 +1588,23 @@ print("ok")' >/dev/null 2>&1 \
if [ "${CLAWMATES_SKIP_AUDIO:-0}" = "1" ]; then if [ "${CLAWMATES_SKIP_AUDIO:-0}" = "1" ]; then
pass "cr: (audio assertion skipped by CLAWMATES_SKIP_AUDIO)" pass "cr: (audio assertion skipped by CLAWMATES_SKIP_AUDIO)"
else else
local ep # The render is a BACKGROUND sweep (every 2 minutes) followed by a
# text-to-speech call that takes minutes on a full dialogue. Checking the
# instant the mission completes asserts that the worker is fast, not that
# it works — the first run of this scenario failed exactly that way while
# the pipeline was fine. Wait for a verdict instead, and say so if none
# arrives rather than reporting the timeout as a product defect.
local ep waited
ep=""; waited=0
while [ "$waited" -lt "${CR_EPISODE_TIMEOUT:-900}" ]; do
ep=$(ssh "$HOST" "docker exec clawmates_postgres_1 psql -U postgres -d clawmates -tAc \ ep=$(ssh "$HOST" "docker exec clawmates_postgres_1 psql -U postgres -d clawmates -tAc \
\"select coalesce(rendered_by,'-') || ' ' || coalesce(duration_secs,0)::text \ \"select coalesce(rendered_by,'-') || ' ' || coalesce(duration_secs,0)::text \
from podcast_episodes where mission_id='$mission';\"" | head -1 | tr -d '\r') from podcast_episodes where mission_id='$mission';\"" | head -1 | tr -d '\r')
[ -n "$ep" ] && break
sleep 30; waited=$((waited + 30))
done
case "$ep" in case "$ep" in
'') fail "cr: no podcast_episodes row — the render sweep never reached this mission" ;; '') fail "cr: no episode after ${waited}s — the render sweep never reached this mission" ;;
unrenderable:no-turns*) fail "cr: the script parsed to zero spoken turns — the writer's format and parse_script disagree" ;; unrenderable:no-turns*) fail "cr: the script parsed to zero spoken turns — the writer's format and parse_script disagree" ;;
unrenderable*) fail "cr: the episode is a tombstone (unrenderable) — the script was not found in the checkout OR the vault" ;; unrenderable*) fail "cr: the episode is a tombstone (unrenderable) — the script was not found in the checkout OR the vault" ;;
*' 0') fail "cr: an episode was recorded with zero duration: $ep" ;; *' 0') fail "cr: an episode was recorded with zero duration: $ep" ;;