[object Object]

← back to Norma Platform

IG redo: make driver idempotent/resumable (skip already-reposted keys from redo-results)

70e6d0792df7ee72b441d3886c0f0f4e09c8df2b · 2026-08-14 10:35:43 -0700 · Steve

Files touched

Diff

commit 70e6d0792df7ee72b441d3886c0f0f4e09c8df2b
Author: Steve <steve@designerwallcoverings.com>
Date:   Fri Aug 14 10:35:43 2026 -0700

    IG redo: make driver idempotent/resumable (skip already-reposted keys from redo-results)
---
 agents/instagram-agent/redo-last5.js | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/agents/instagram-agent/redo-last5.js b/agents/instagram-agent/redo-last5.js
index 5e91a1f..5d7bf67 100644
--- a/agents/instagram-agent/redo-last5.js
+++ b/agents/instagram-agent/redo-last5.js
@@ -29,9 +29,18 @@ const args = process.argv.slice(2);
 const GO = args.includes('--go');
 const only = (() => { const i = args.indexOf('--only'); return i >= 0 ? args[i + 1] : null; })();
 
+// Already-reposted keys (idempotent + crash-resumable) — skip anything already in redo-results.
+const done = new Set();
+if (fs.existsSync(OUT)) {
+  for (const l of fs.readFileSync(OUT, 'utf8').trim().split('\n').filter(Boolean)) {
+    try { const r = JSON.parse(l); done.add(`${r.handle}|${r.product_handle}`); } catch { /* skip */ }
+  }
+}
+
 const rows = fs.readFileSync(SRC, 'utf8').trim().split('\n')
   .map((l) => JSON.parse(l))
-  .filter((r) => (only ? r.handle === only : true));
+  .filter((r) => (only ? r.handle === only : true))
+  .filter((r) => !done.has(`${r.handle}|${r.product_handle}`)); // never double-post
 
 const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
 

← 6e37304 IG redo: caption polish (quote-strip colors, broaden SKU suf  ·  back to Norma Platform  ·  IG redo: openclaw deletion driver for originals (probe-first f92f6e2 →