[object Object]

← back to Norma Platform

daily-cadence: velocity tripwire (stop batch on 'restricted') + intra-batch pacing

1ec2435eddcd7f4743985b60773b869ca0c36f40 · 2026-08-11 13:04:03 -0700 · Steve Abrams

Files touched

Diff

commit 1ec2435eddcd7f4743985b60773b869ca0c36f40
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Tue Aug 11 13:04:03 2026 -0700

    daily-cadence: velocity tripwire (stop batch on 'restricted') + intra-batch pacing
---
 agents/instagram-agent/daily-cadence.js | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/agents/instagram-agent/daily-cadence.js b/agents/instagram-agent/daily-cadence.js
index b1248d6..e90d090 100644
--- a/agents/instagram-agent/daily-cadence.js
+++ b/agents/instagram-agent/daily-cadence.js
@@ -91,13 +91,21 @@ async function findProduct(keyword) {
   }
 
   console.log(`Daily cadence ${today} — ${postedToday.size}/${eligible.length} done, posting next ${batch.length}${DRY ? ' (DRY)' : ''}:`);
-  for (const b of batch) {
-    console.log(`  @${b.account} ← ${b.title}  [${b.product}]`);
-    if (!DRY) {
-      try {
-        cp.execFileSync(process.execPath, [path.join(HERE, 'post-to.js'), b.account, '--product', b.product, '--confirm'], { stdio: 'ignore' });
-      } catch (e) { console.log(`    ✗ post failed: ${e.message}`); }
+  const sleep = (ms) => cp.execFileSync('sleep', [String(ms / 1000)]);
+  for (let i = 0; i < batch.length; i++) {
+    const b = batch[i];
+    if (DRY) { console.log(`  @${b.account} ← ${b.title}  [${b.product}]`); continue; }
+    let out = '';
+    try { out = cp.execFileSync(process.execPath, [path.join(HERE, 'post-to.js'), b.account, '--product', b.product, '--confirm'], { encoding: 'utf8' }); }
+    catch (e) { out = String(e.stdout || '') + String(e.message || ''); }
+    if (/user access is restricted/i.test(out)) {
+      // VELOCITY TRIPWIRE — a restricted account means the token/IP may be flagging.
+      console.log(`  ✗ @${b.account} — RESTRICTED. STOPPING batch (velocity tripwire).`);
+      console.log('TRIPWIRE: pausing daily cadence — surface to Steve before more posting.');
+      break;
     }
+    console.log(/posted/i.test(out) ? `  ✓ @${b.account} ← ${b.title}` : `  ⚠ @${b.account} — ${out.trim().split('\n').pop()}`);
+    if (i < batch.length - 1) sleep(3000); // pace within batch
   }
   if (needsCody.length) console.log(`Deferred to Cody (settlement-sensitive, gated visual pass): ${needsCody.join(', ')}`);
   console.log(`Remaining after this batch: ${remaining.length - batch.length}`);

← 18ad401 IG daily cadence: 1 post/day per account, 6 days/week (rest  ·  back to Norma Platform  ·  daily-cadence: posting-hours guard (Mon-Sat 08:00-20:00) + d f700cdd →