[object Object]

← back to Dw Marketing Reels

TK-10395: fix retry/timeout race (client 90s->240s) + wire publish-result gate into nightly cron (contrarian finds)

7ad29bf5dc5f1213b812569ffdf04ab257f74463 · 2026-08-10 08:29:25 -0700 · cre-agent

Files touched

Diff

commit 7ad29bf5dc5f1213b812569ffdf04ab257f74463
Author: cre-agent <steve@designerwallcoverings.com>
Date:   Mon Aug 10 08:29:25 2026 -0700

    TK-10395: fix retry/timeout race (client 90s->240s) + wire publish-result gate into nightly cron (contrarian finds)
---
 scripts/cron-run.sh        | 6 ++++++
 scripts/publish-social.mjs | 5 ++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/scripts/cron-run.sh b/scripts/cron-run.sh
index 9366efe..21d4836 100755
--- a/scripts/cron-run.sh
+++ b/scripts/cron-run.sh
@@ -24,3 +24,9 @@ if ssh -o BatchMode=yes -o ConnectTimeout=6 "$PUSH_HOST" "test -d $PUSH_PATH" 2>
   rsync -az data/ "$PUSH_HOST:$PUSH_PATH/data/"
   echo "pushed reels+data -> $PUSH_HOST:$PUSH_PATH"
 fi
+
+# TK-10395 publish-result gate (LAST so it never blocks the push): the publisher exits 0 even
+# when the IG post fails, which is how the 2207076 failure went silently green. This makes the
+# nightly job report a non-zero exit (visible in launchd + reels-cron.log) when an ARMED IG post
+# did not actually land — incl. a 2207076 that survived the retry. Read-only, no network.
+node scripts/check-publish-status.mjs || { echo "IG PUBLISH CHECK FAILED — armed reel did not land (see reels.json publish.instagram)"; exit 1; }
diff --git a/scripts/publish-social.mjs b/scripts/publish-social.mjs
index f8c28a3..a8714a8 100644
--- a/scripts/publish-social.mjs
+++ b/scripts/publish-social.mjs
@@ -72,7 +72,10 @@ async function postInstagram(reel) {
       // Norma's reel skill contract (skills/reel.js): video_url + caption. `mediaUrl` was a
       // silent field-name mismatch — the live path would have 500'd on first arm (contrarian find).
       body: JSON.stringify({ video_url: mediaUrl, caption: reel.caption, account: acc.id, source: 'dw-marketing-reels' }),
-    }), 90000);  // IG reel publish is async (container→poll→publish, ~30-60s); the 12s default timed out MID-POST on the first live fire (2026-07-27, post still landed).
+    }), 240000);  // IG reel publish is async (container→poll→publish). TK-10395: Norma now retries a
+    // transient 2207076 up to 3× (each container ERRORs in ~28s + 5s/10s backoff ≈ 99s realistic).
+    // 90s would time out MID-RETRY → 'posted-unverified' → dup-guard skips → silent no-post. 240s lets
+    // the retry finish so we get a real 'posted'/'error'. (Was 90s; 12s default timed out on first fire 2026-07-27.)
     const txt = await res.text().catch(() => '');
     let body = {}; try { body = JSON.parse(txt); } catch {}
     if (!res.ok) {

← d52056c TK-10395: add read-only publish-status monitor (catches 2207  ·  back to Dw Marketing Reels  ·  TK-10395: wire push-alert (CNCP card + George email to steve da29f0a →