[object Object]

← back to Ticket System

ticket-runner: capture rc before date cmdsub — failures no longer logged as 'exit 0' (TK-10689)

fefe129c5816bca450c37f219a40bd804ffc7983 · 2026-09-17 16:06:46 -0700 · Steve Abrams

The else-branch echo interpolated $(date -u …) BEFORE expanding $? in the same
double-quoted string; the command substitution reset $?, so every failed
run-ticket.sh launch logged 'FAILED … (exit 0)', masking the real exit code
(the 2026-09-14 osascript -2741 batch of 656 failures all logged exit 0, which
obfuscated that diagnosis). Capture rc into a variable first; verified old vs
new form side-by-side (exit 0 vs exit 2).

Files touched

Diff

commit fefe129c5816bca450c37f219a40bd804ffc7983
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Thu Sep 17 16:06:46 2026 -0700

    ticket-runner: capture rc before date cmdsub — failures no longer logged as 'exit 0' (TK-10689)
    
    The else-branch echo interpolated $(date -u …) BEFORE expanding $? in the same
    double-quoted string; the command substitution reset $?, so every failed
    run-ticket.sh launch logged 'FAILED … (exit 0)', masking the real exit code
    (the 2026-09-14 osascript -2741 batch of 656 failures all logged exit 0, which
    obfuscated that diagnosis). Capture rc into a variable first; verified old vs
    new form side-by-side (exit 0 vs exit 2).
---
 ticket-runner.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/ticket-runner.sh b/ticket-runner.sh
index a61ba1bb..b273feb3 100644
--- a/ticket-runner.sh
+++ b/ticket-runner.sh
@@ -59,7 +59,11 @@ while IFS= read -r line; do
   if bash "$RUN_SH" "$id" "$cwd" "$profile" >>"$DONELOG" 2>&1; then
     echo "$(date -u +%FT%TZ) launched $id ($profile) cwd=$cwd" >> "$DONELOG"
   else
-    echo "$(date -u +%FT%TZ) FAILED $id (exit $?) — see run-ticket.sh output above" >> "$DONELOG"
+    # TK-10689: capture rc FIRST — "$(date …)" in the old single echo ran as a command
+    # substitution before "$?" expanded, resetting it to 0 and logging every failure as
+    # "(exit 0)" (masks real exit codes, e.g. the 09-14 osascript -2741 batch logged exit 0).
+    rc=$?
+    echo "$(date -u +%FT%TZ) FAILED $id (exit $rc) — see run-ticket.sh output above" >> "$DONELOG"
   fi
   echo "$n" > "$OFFSET"   # advance AFTER this line is handled (at-most-once)
   sleep 1.5              # stagger so iTerm doesn't drop windows (mirrors board's old 1.3s)

← bfd12ca1 auto-data-snapshot: 2026-09-17T11:32:24 (1 data files) — dat  ·  back to Ticket System  ·  auto-data-snapshot: 2026-09-17T17:25:36 (9 data files) — evi 018f10f5 →