[object Object]

← back to Norma

instagram-agent: add loopback co-listener so 127.0.0.1:9810 answers (TK-12012)

987ab62213c4dd0f9afb90ef53fcb365dab8bde1 · 2026-09-22 10:48:26 -0700 · steve

BIND_HOST=100.82.17.107 pinned the single primary bind to the Tailscale IP,
which drops the 127.0.0.1 bind and broke every local consumer (dw-marketing-reels
nightly publish, dw-follow-counts) with connection-refused since 09-21. Add a
guarded second loopback-only listener on the same Express app. Never 0.0.0.0.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CRkDtx31oCvHHaMfJf9CzT

Files touched

Diff

commit 987ab62213c4dd0f9afb90ef53fcb365dab8bde1
Author: steve <steve@designerwallcoverings.com>
Date:   Tue Sep 22 10:48:26 2026 -0700

    instagram-agent: add loopback co-listener so 127.0.0.1:9810 answers (TK-12012)
    
    BIND_HOST=100.82.17.107 pinned the single primary bind to the Tailscale IP,
    which drops the 127.0.0.1 bind and broke every local consumer (dw-marketing-reels
    nightly publish, dw-follow-counts) with connection-refused since 09-21. Add a
    guarded second loopback-only listener on the same Express app. Never 0.0.0.0.
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_01CRkDtx31oCvHHaMfJf9CzT
---
 agents/instagram-agent/server.js | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/agents/instagram-agent/server.js b/agents/instagram-agent/server.js
index de16c20..5c0723f 100644
--- a/agents/instagram-agent/server.js
+++ b/agents/instagram-agent/server.js
@@ -225,3 +225,19 @@ require('./calendar').registerCalendarRoutes(app);
 require('./account-notes').registerNotesRoutes(app);
 
 start();
+
+// ──────────────────────────────────────
+// Loopback co-listener (TK-12012). BIND_HOST=100.82.17.107 pins the PRIMARY
+// bind (in agent-base start()) to the Tailscale IP for remote fleet ops, but a
+// single-IP bind DROPS 127.0.0.1 — so every LOCAL consumer (dw-marketing-reels
+// nightly IG publish, dw-follow-counts) hitting http://127.0.0.1:9810 got
+// connection-refused since 09-21. Add a SECOND loopback-only listener serving
+// the SAME Express `app` so local callers reach it again. Only when BIND_HOST
+// is set to a non-loopback IP (guards against double-binding loopback →
+// EADDRINUSE). NEVER 0.0.0.0 — Basic Auth is the only perimeter. Reversible:
+// delete this block.
+if ((process.env.BIND_HOST || '127.0.0.1') !== '127.0.0.1') {
+  app.listen(PORT, '127.0.0.1', () => {
+    console.log(`[${new Date().toISOString()}] [${AGENT_NAME}] loopback co-listener on 127.0.0.1:${PORT}`);
+  });
+}

← 1665ba4 auto-data-snapshot: 2026-09-22T10:38:29 (1 data files) — age  ·  back to Norma  ·  IG post path: durable jewelry-counter exclusion gate (TK-120 8f1455a →