@m13v/s4l 1.7.4-rc.30 → 1.7.4-rc.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -599,15 +599,28 @@ export function ensureRuntimeProvisioned() {
599
599
  // live without a reinstall). Best-effort; never blocks startup.
600
600
  export async function ensureHarnessPatched() {
601
601
  try {
602
- const adminPy = path.join(HARNESS_DIR, "src", "browser_harness", "admin.py");
603
- if (!fs.existsSync(adminPy))
602
+ // Version marker of the CURRENT vendored patch: a symbol that exists only
603
+ // in its newest revision (v2 added the daemon.py websocket-proxy
604
+ // neutralization after v1's cdp_urlopen alone proved insufficient — the
605
+ // WS dial still routed through the macOS system proxy and died with
606
+ // "proxy rejected connection: HTTP 503"). Bump this string whenever the
607
+ // patch gains a new hunk, or upgraded installs will silently keep the
608
+ // previous revision.
609
+ const daemonPy = path.join(HARNESS_DIR, "src", "browser_harness", "daemon.py");
610
+ if (!fs.existsSync(daemonPy))
604
611
  return { ok: false, detail: "harness not installed yet" };
605
- if (fs.readFileSync(adminPy, "utf-8").includes("cdp_urlopen")) {
612
+ if (fs.readFileSync(daemonPy, "utf-8").includes("s4l_no_proxy_ws")) {
606
613
  return { ok: true, detail: "already patched" };
607
614
  }
608
615
  const harnessPatch = path.join(MATERIALIZED_REPO, "scripts", "patches", "browser-harness-loopback-cdp-proxy.patch");
609
616
  if (!fs.existsSync(harnessPatch))
610
617
  return { ok: false, detail: "patch file missing from package" };
618
+ // Discard any PRIOR vendored-patch revision (e.g. v1) so the cumulative
619
+ // patch applies onto pristine pinned sources. Only src/ is touched; the
620
+ // checkout is a managed artifact, never a place for local edits.
621
+ await sh("git", ["-C", HARNESS_DIR, "checkout", "--", "src/browser_harness"], {
622
+ timeoutMs: 30000,
623
+ });
611
624
  const chk = await sh("git", ["-C", HARNESS_DIR, "apply", "--check", harnessPatch], {
612
625
  timeoutMs: 30000,
613
626
  });
@@ -1,4 +1,4 @@
1
1
  {
2
- "version": "1.7.4-rc.30",
3
- "installedAt": "2026-07-13T22:13:17.873Z"
2
+ "version": "1.7.4-rc.31",
3
+ "installedAt": "2026-07-13T22:20:47.112Z"
4
4
  }
package/mcp/manifest.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "dxt_version": "0.1",
3
3
  "name": "social-autoposter",
4
4
  "display_name": "S4L",
5
- "version": "1.7.4-rc.30",
5
+ "version": "1.7.4-rc.31",
6
6
  "description": "Draft, review, approve, and autopilot X/Twitter posts.",
7
7
  "long_description": "## **⚠️ The disclaimer above is generic Claude boilerplate.** Anthropic shows the same warning on every plugin regardless of what it does; any plugin has the same level of access as any app you download from the internet.\n\nS4L is an open source product developed by Mediar.ai Incorporated, a VC-backed San Francisco-based startup.\n\nTo get started:\n\n1\\. Copy this prompt: **Set me up on S4L plugin end to end**\n\n2\\. Quit with CMD+Q, reopen Claude, paste into a new chat.\n\nWhat happens next:\n\n* About every 5 minutes S4L scans X for posts that match your topics and drafts replies in your voice.\n* Drafts show up as review cards, usually the first within a few minutes. Nothing is posted automatically; you approve each one.\n* Posting autopilot stays off until you explicitly turn it on.",
8
8
  "author": {
package/mcp/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m13v/s4l-mcp",
3
- "version": "1.7.4-rc.30",
3
+ "version": "1.7.4-rc.31",
4
4
  "private": true,
5
5
  "description": "Desktop MCP client for social-autoposter (X/Twitter rail): manual draft/review/approve loop, autopilot control, and stats. Thin wrapper over the existing pipeline scripts.",
6
6
  "license": "MIT",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m13v/s4l",
3
- "version": "1.7.4-rc.30",
3
+ "version": "1.7.4-rc.31",
4
4
  "description": "Automated social posting pipeline for Reddit, X/Twitter, LinkedIn, and Moltbook. Install as a Claude Code agent skill.",
5
5
  "bin": {
6
6
  "social-autoposter": "bin/cli.js",
@@ -1,23 +1,3 @@
1
- From a97b7cdae960813f13af39ef99ce878426008dcc Mon Sep 17 00:00:00 2001
2
- From: m13v <i@m13v.com>
3
- Date: Mon, 13 Jul 2026 08:48:50 -0700
4
- Subject: [PATCH] Never route loopback CDP requests through a proxy
5
-
6
- urllib's default opener honors proxy env vars and macOS system proxy
7
- settings (scutil --proxy). On a machine with a system-wide proxy (e.g. a
8
- local gost/ISP forwarder), every 127.0.0.1 CDP probe is sent to the proxy
9
- and returns 403 Forbidden, so Chrome looks unreachable while curl (env
10
- proxies only) and Playwright (own websocket stack) work fine. Route all
11
- loopback CDP HTTP calls through a proxy-free opener; non-loopback CDP
12
- URLs keep default proxy behavior.
13
-
14
- Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
15
- ---
16
- src/browser_harness/admin.py | 24 +++++++++++++++++++++++-
17
- src/browser_harness/daemon.py | 7 ++++---
18
- src/browser_harness/run.py | 3 ++-
19
- 3 files changed, 29 insertions(+), 5 deletions(-)
20
-
21
1
  diff --git a/src/browser_harness/admin.py b/src/browser_harness/admin.py
22
2
  index c72a8fb..64addee 100644
23
3
  --- a/src/browser_harness/admin.py
@@ -62,18 +42,33 @@ index c72a8fb..64addee 100644
62
42
 
63
43
  def _has_local_gui():
64
44
  diff --git a/src/browser_harness/daemon.py b/src/browser_harness/daemon.py
65
- index 0f0f255..ceb08b9 100644
45
+ index 0f0f255..de51934 100644
66
46
  --- a/src/browser_harness/daemon.py
67
47
  +++ b/src/browser_harness/daemon.py
68
- @@ -5,6 +5,7 @@ from collections import deque
48
+ @@ -5,8 +5,22 @@ from collections import deque
69
49
  from pathlib import Path
70
50
 
71
51
  from . import _ipc as ipc
72
52
  +from .admin import cdp_urlopen
73
53
  from cdp_use.client import CDPClient
74
54
 
55
+ +# s4l_no_proxy_ws: the daemon's CDP traffic is loopback; never let ANY client
56
+ +# in this process route it through a proxy. websockets>=14 autodetects proxies
57
+ +# at dial time via urllib.request.proxy_bypass()/getproxies() (which on macOS
58
+ +# include SYSTEM proxy settings from scutil --proxy), so a box-wide forwarder
59
+ +# turns the CDP WS dial into a proxied CONNECT that fails ("proxy rejected
60
+ +# connection: HTTP 503") — same failure class as the urllib 403 that
61
+ +# cdp_urlopen fixes for the HTTP lookup. Neutralize resolution process-wide:
62
+ +# the daemon's only non-loopback traffic (browser-use cloud API) works direct.
63
+ +# Both lookups happen at call time via module attributes, so this holds
64
+ +# regardless of import order.
65
+ +urllib.request.getproxies = lambda: {} # type: ignore[assignment]
66
+ +urllib.request.proxy_bypass = lambda host: 1 # type: ignore[assignment]
67
+ +
75
68
 
76
- @@ -113,7 +114,7 @@ def get_ws_url():
69
+ def _load_env():
70
+ repo_root = Path(__file__).resolve().parents[2]
71
+ @@ -113,7 +127,7 @@ def get_ws_url():
77
72
  base_url = url.rstrip("/")
78
73
  while time.time() < deadline:
79
74
  try:
@@ -82,7 +77,7 @@ index 0f0f255..ceb08b9 100644
82
77
  except urllib.error.HTTPError as e:
83
78
  last_err = e
84
79
  if e.code == 404 and (ws := _ws_from_devtools_active_port(url)):
85
- @@ -139,7 +140,7 @@ def get_ws_url():
80
+ @@ -139,7 +153,7 @@ def get_ws_url():
86
81
  deadline = time.time() + 30
87
82
  while time.time() < deadline:
88
83
  try:
@@ -91,7 +86,7 @@ index 0f0f255..ceb08b9 100644
91
86
  except urllib.error.HTTPError as e:
92
87
  # Chrome 147+ disables /json/* HTTP discovery on the default user-data-dir;
93
88
  # the ws path Chrome wrote to DevToolsActivePort still works.
94
- @@ -153,7 +154,7 @@ def get_ws_url():
89
+ @@ -153,7 +167,7 @@ def get_ws_url():
95
90
  )
96
91
  for probe_port in (9222, 9223):
97
92
  try:
@@ -121,6 +116,3 @@ index 8ab1f0f..cbd3835 100644
121
116
  return True
122
117
  except OSError: pass
123
118
  return False
124
- --
125
- 2.43.0
126
-
@@ -34,5 +34,5 @@ RUN_START=$(date +%s)
34
34
  EXIT_CODE=$?
35
35
  RUN_ELAPSED=$(( $(date +%s) - RUN_START ))
36
36
 
37
- echo "[$(date +%H:%M:%S)] === done in ${RUN_ELAPSED}s (exit=${EXIT_CODE}) ==="
37
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] === done in ${RUN_ELAPSED}s (exit=${EXIT_CODE}) ==="
38
38
  exit "$EXIT_CODE"
@@ -35,7 +35,7 @@ mkdir -p "$LOG_DIR"
35
35
  PYTHON_BIN="${PYTHON_BIN:-/opt/homebrew/bin/python3.11}"
36
36
  [ -x "$PYTHON_BIN" ] || PYTHON_BIN="/usr/bin/python3"
37
37
 
38
- log() { echo "[$(date +%H:%M:%S)] $*" >> "$LOG_DIR/web-chat.log"; }
38
+ log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*" >> "$LOG_DIR/web-chat.log"; }
39
39
 
40
40
  # Step 1: query Postgres for unread threads.
41
41
  CHATS=$("$PYTHON_BIN" "$SCRIPTS_DIR/check_unread_web_chats.py" 2>>"$LOG_DIR/web-chat.log")
@@ -154,7 +154,7 @@ cleanup_harness_tabs() {
154
154
  if ! $_probe 2>/dev/null; then
155
155
  sleep 1
156
156
  if ! $_probe 2>/dev/null; then
157
- echo "[$(date +%H:%M:%S)] cleanup_harness_tabs: SKIPPED (linkedin-harness CDP /json/version unreachable after 10s+retry)" >&2
157
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] cleanup_harness_tabs: SKIPPED (linkedin-harness CDP /json/version unreachable after 10s+retry)" >&2
158
158
  return 0
159
159
  fi
160
160
  fi
@@ -221,7 +221,7 @@ _acquire_linkedin_pipeline_lock() {
221
221
  echo "$$" > "$_LI_PIPELINE_LOCK_DIR/pid"
222
222
  echo "$_who" > "$_LI_PIPELINE_LOCK_DIR/holder"
223
223
  export _LI_PIPELINE_LOCK_HELD=1
224
- echo "[$(date +%H:%M:%S)] linkedin-pipeline lock ACQUIRED by $_who (pid $$)" >&2
224
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] linkedin-pipeline lock ACQUIRED by $_who (pid $$)" >&2
225
225
  return 0
226
226
  fi
227
227
  local _h_pid _h_who
@@ -236,11 +236,11 @@ _acquire_linkedin_pipeline_lock() {
236
236
  return 0
237
237
  fi
238
238
  if [ -z "$_h_pid" ] || ! kill -0 "$_h_pid" 2>/dev/null; then
239
- echo "[$(date +%H:%M:%S)] linkedin-pipeline lock: reclaiming stale lock (dead holder ${_h_who} pid ${_h_pid:-unknown})" >&2
239
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] linkedin-pipeline lock: reclaiming stale lock (dead holder ${_h_who} pid ${_h_pid:-unknown})" >&2
240
240
  rm -rf "$_LI_PIPELINE_LOCK_DIR"
241
241
  continue
242
242
  fi
243
- echo "[$(date +%H:%M:%S)] linkedin-pipeline lock: held by ${_h_who} (pid ${_h_pid}); ${_who} skipping this fire (rc=78) to avoid two drivers on the 9556 Chrome" >&2
243
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] linkedin-pipeline lock: held by ${_h_who} (pid ${_h_pid}); ${_who} skipping this fire (rc=78) to avoid two drivers on the 9556 Chrome" >&2
244
244
  return 78
245
245
  done
246
246
  }
@@ -271,10 +271,10 @@ ensure_linkedin_browser_for_backend() {
271
271
  if [ "${LINKEDIN_CDP_URL:-$_BH_LINKEDIN_DEFAULT_URL}" != "$_BH_LINKEDIN_DEFAULT_URL" ]; then
272
272
  local _ext_url="${LINKEDIN_CDP_URL}"
273
273
  if curl -sf --max-time 2 -o /dev/null "${_ext_url}/json/version" 2>/dev/null; then
274
- echo "[$(date +%H:%M:%S)] Using externally-managed Chrome at ${_ext_url} (skipping harness launch + tab cleanup)" >&2
274
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] Using externally-managed Chrome at ${_ext_url} (skipping harness launch + tab cleanup)" >&2
275
275
  return 0
276
276
  fi
277
- echo "[$(date +%H:%M:%S)] ERROR: LINKEDIN_CDP_URL=${_ext_url} not reachable. External Chrome must be managed by host." >&2
277
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] ERROR: LINKEDIN_CDP_URL=${_ext_url} not reachable. External Chrome must be managed by host." >&2
278
278
  return 1
279
279
  fi
280
280
  # Cross-pipeline whole-run lock: only one LinkedIn browser pipeline drives
@@ -288,14 +288,14 @@ ensure_linkedin_browser_for_backend() {
288
288
  _acquire_linkedin_pipeline_lock || return $?
289
289
  # Probe + launch harness Chrome on port 9556 if needed.
290
290
  if ! curl -sf --max-time 2 -o /dev/null http://127.0.0.1:9556/json/version 2>/dev/null; then
291
- echo "[$(date +%H:%M:%S)] LinkedIn harness Chrome down on port 9556, launching..." >&2
291
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] LinkedIn harness Chrome down on port 9556, launching..." >&2
292
292
  # Dated relaunch stamp for central observability (see twitter-backend.sh).
293
293
  echo "$(date -u +%Y-%m-%dT%H:%M:%SZ) port=9556" \
294
294
  >> "$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/logs/chrome-relaunch-events.log" 2>/dev/null || true
295
295
  local _chrome_bin
296
296
  _chrome_bin=$(_resolve_chrome_bin)
297
297
  if [ -z "$_chrome_bin" ]; then
298
- echo "[$(date +%H:%M:%S)] ERROR: no Chrome/Chromium binary found. Set BH_CHROME_BIN." >&2
298
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] ERROR: no Chrome/Chromium binary found. Set BH_CHROME_BIN." >&2
299
299
  return 1
300
300
  fi
301
301
  # On Linux + no display, run headless. On root, add --no-sandbox.
@@ -323,7 +323,7 @@ ensure_linkedin_browser_for_backend() {
323
323
  local _stale_pids
324
324
  _stale_pids=$(pgrep -f -- "--user-data-dir=$_prof_dir " 2>/dev/null || true)
325
325
  if [ -n "$_stale_pids" ] && ! curl -sf --max-time 2 -o /dev/null http://127.0.0.1:9556/json/version 2>/dev/null; then
326
- echo "[$(date +%H:%M:%S)] CDP down but Chrome still holds $_prof_dir (pids: $(echo $_stale_pids | tr '\n' ' ')); reaping stale profile owner before relaunch" >&2
326
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] CDP down but Chrome still holds $_prof_dir (pids: $(echo $_stale_pids | tr '\n' ' ')); reaping stale profile owner before relaunch" >&2
327
327
  kill $_stale_pids 2>/dev/null || true
328
328
  sleep 2
329
329
  _stale_pids=$(pgrep -f -- "--user-data-dir=$_prof_dir " 2>/dev/null || true)
@@ -357,10 +357,10 @@ os.execv(sys.argv[1], sys.argv[1:])' \
357
357
  sleep 1
358
358
  done
359
359
  if ! curl -sf --max-time 2 -o /dev/null http://127.0.0.1:9556/json/version 2>/dev/null; then
360
- echo "[$(date +%H:%M:%S)] ERROR: LinkedIn harness Chrome failed to start within 12s" >&2
360
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] ERROR: LinkedIn harness Chrome failed to start within 12s" >&2
361
361
  return 1
362
362
  fi
363
- echo "[$(date +%H:%M:%S)] LinkedIn harness Chrome up on port 9556" >&2
363
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] LinkedIn harness Chrome up on port 9556" >&2
364
364
  fi
365
365
  # Always close leftover tabs from prior runs. Safe under acquire_lock
366
366
  # "linkedin-browser" serialization.
@@ -395,7 +395,7 @@ _linkedin_session_detect_gate() {
395
395
  "$_py" "$HOME/social-autoposter/scripts/linkedin_killswitch.py" detect-gate \
396
396
  --cdp-url "${LINKEDIN_CDP_URL:-$_BH_LINKEDIN_DEFAULT_URL}" >&2 || _rc=$?
397
397
  if [ "$_rc" = "2" ]; then
398
- echo "[$(date +%H:%M:%S)] detect-gate tripped the LinkedIn killswitch; aborting this fire" >&2
398
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] detect-gate tripped the LinkedIn killswitch; aborting this fire" >&2
399
399
  return 1
400
400
  fi
401
401
  return 0
@@ -123,7 +123,7 @@ cleanup_harness_tabs() {
123
123
  if ! $_probe 2>/dev/null; then
124
124
  sleep 1
125
125
  if ! $_probe 2>/dev/null; then
126
- echo "[$(date +%H:%M:%S)] cleanup_harness_tabs: SKIPPED (reddit-harness CDP /json/version unreachable after 10s+retry)" >&2
126
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] cleanup_harness_tabs: SKIPPED (reddit-harness CDP /json/version unreachable after 10s+retry)" >&2
127
127
  return 0
128
128
  fi
129
129
  fi
@@ -156,19 +156,19 @@ ensure_reddit_browser_for_backend() {
156
156
  if [ "${REDDIT_CDP_URL:-$_BH_REDDIT_DEFAULT_URL}" != "$_BH_REDDIT_DEFAULT_URL" ]; then
157
157
  local _ext_url="${REDDIT_CDP_URL}"
158
158
  if curl -sf --max-time 2 -o /dev/null "${_ext_url}/json/version" 2>/dev/null; then
159
- echo "[$(date +%H:%M:%S)] Using externally-managed Chrome at ${_ext_url} (skipping harness launch + tab cleanup)" >&2
159
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] Using externally-managed Chrome at ${_ext_url} (skipping harness launch + tab cleanup)" >&2
160
160
  return 0
161
161
  fi
162
- echo "[$(date +%H:%M:%S)] ERROR: REDDIT_CDP_URL=${_ext_url} not reachable. External Chrome must be managed by host." >&2
162
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] ERROR: REDDIT_CDP_URL=${_ext_url} not reachable. External Chrome must be managed by host." >&2
163
163
  return 1
164
164
  fi
165
165
  # Probe + launch harness Chrome on port 9557 if needed.
166
166
  if ! curl -sf --max-time 2 -o /dev/null http://127.0.0.1:9557/json/version 2>/dev/null; then
167
- echo "[$(date +%H:%M:%S)] Reddit harness Chrome down on port 9557, launching..." >&2
167
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] Reddit harness Chrome down on port 9557, launching..." >&2
168
168
  local _chrome_bin
169
169
  _chrome_bin=$(_resolve_chrome_bin)
170
170
  if [ -z "$_chrome_bin" ]; then
171
- echo "[$(date +%H:%M:%S)] ERROR: no Chrome/Chromium binary found. Set BH_CHROME_BIN." >&2
171
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] ERROR: no Chrome/Chromium binary found. Set BH_CHROME_BIN." >&2
172
172
  return 1
173
173
  fi
174
174
  # On Linux + no display, run headless. On root, add --no-sandbox.
@@ -196,7 +196,7 @@ ensure_reddit_browser_for_backend() {
196
196
  local _stale_pids
197
197
  _stale_pids=$(pgrep -f -- "--user-data-dir=$_prof_dir " 2>/dev/null || true)
198
198
  if [ -n "$_stale_pids" ] && ! curl -sf --max-time 2 -o /dev/null http://127.0.0.1:9557/json/version 2>/dev/null; then
199
- echo "[$(date +%H:%M:%S)] CDP down but Chrome still holds $_prof_dir (pids: $(echo $_stale_pids | tr '\n' ' ')); reaping stale profile owner before relaunch" >&2
199
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] CDP down but Chrome still holds $_prof_dir (pids: $(echo $_stale_pids | tr '\n' ' ')); reaping stale profile owner before relaunch" >&2
200
200
  kill $_stale_pids 2>/dev/null || true
201
201
  sleep 2
202
202
  _stale_pids=$(pgrep -f -- "--user-data-dir=$_prof_dir " 2>/dev/null || true)
@@ -216,10 +216,10 @@ ensure_reddit_browser_for_backend() {
216
216
  sleep 1
217
217
  done
218
218
  if ! curl -sf --max-time 2 -o /dev/null http://127.0.0.1:9557/json/version 2>/dev/null; then
219
- echo "[$(date +%H:%M:%S)] ERROR: Reddit harness Chrome failed to start within 12s" >&2
219
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] ERROR: Reddit harness Chrome failed to start within 12s" >&2
220
220
  return 1
221
221
  fi
222
- echo "[$(date +%H:%M:%S)] Reddit harness Chrome up on port 9557" >&2
222
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] Reddit harness Chrome up on port 9557" >&2
223
223
  fi
224
224
  # Always close leftover tabs from prior runs. Safe under acquire_lock
225
225
  # "reddit-browser" serialization.
@@ -138,7 +138,7 @@ cleanup_harness_tabs() {
138
138
  if ! $_probe 2>/dev/null; then
139
139
  sleep 1
140
140
  if ! $_probe 2>/dev/null; then
141
- echo "[$(date +%H:%M:%S)] cleanup_harness_tabs: SKIPPED (harness CDP /json/version unreachable after 10s+retry)" >&2
141
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] cleanup_harness_tabs: SKIPPED (harness CDP /json/version unreachable after 10s+retry)" >&2
142
142
  return 0
143
143
  fi
144
144
  fi
@@ -202,13 +202,13 @@ ensure_twitter_browser_for_backend() {
202
202
  # 180s per downstream attach against a wedged browser.
203
203
  local _ext_verdict
204
204
  if ! _ext_verdict=$(_bh_cdp_ready "$_ext_url"); then
205
- echo "[$(date +%H:%M:%S)] ERROR: external Chrome at ${_ext_url} is WEDGED (/json/version answers but the CDP handshake never completes). Host must restart it (AppMaker /opt/startup.sh, etc)." >&2
205
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] ERROR: external Chrome at ${_ext_url} is WEDGED (/json/version answers but the CDP handshake never completes). Host must restart it (AppMaker /opt/startup.sh, etc)." >&2
206
206
  echo "twitter_cdp_wedge: detected url=${_ext_url} action=none-external" >&2
207
207
  _bh_record_cdp_health external_wedged "$_ext_verdict"
208
208
  return 1
209
209
  fi
210
210
  _bh_record_cdp_health ok-external "$_ext_verdict"
211
- echo "[$(date +%H:%M:%S)] Using externally-managed Chrome at ${_ext_url} (skipping harness launch + tab cleanup)" >&2
211
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] Using externally-managed Chrome at ${_ext_url} (skipping harness launch + tab cleanup)" >&2
212
212
  # Restore the Twitter login if the sandbox was substituted. AppMaker
213
213
  # Hobby-tier sandboxes have a 1h TTL; on substitution /root is reseeded
214
214
  # from /etc/skel-root and the harness profile (cookies) is wiped. This
@@ -217,7 +217,7 @@ ensure_twitter_browser_for_backend() {
217
217
  python3 "$_BH_REPO_DIR/scripts/restore_twitter_session.py" 2>&1 | sed 's/^/[restore] /' >&2 || true
218
218
  return 0
219
219
  fi
220
- echo "[$(date +%H:%M:%S)] ERROR: TWITTER_CDP_URL=${_ext_url} not reachable. External Chrome must be managed by host (AppMaker /opt/startup.sh, etc)." >&2
220
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] ERROR: TWITTER_CDP_URL=${_ext_url} not reachable. External Chrome must be managed by host (AppMaker /opt/startup.sh, etc)." >&2
221
221
  return 1
222
222
  fi
223
223
  # Probe + launch harness Chrome on port 9555 if needed. Two-stage probe:
@@ -229,12 +229,12 @@ ensure_twitter_browser_for_backend() {
229
229
  local _bh_prof_dir="$HOME/.claude/browser-profiles/browser-harness"
230
230
  if ! curl -sf --max-time 2 -o /dev/null http://127.0.0.1:9555/json/version 2>/dev/null; then
231
231
  _need_launch=1; _launch_reason="http_down"
232
- echo "[$(date +%H:%M:%S)] Harness Chrome down on port 9555, launching..." >&2
232
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] Harness Chrome down on port 9555, launching..." >&2
233
233
  else
234
234
  local _ready_verdict
235
235
  if ! _ready_verdict=$(_bh_cdp_ready "$_BH_DEFAULT_URL"); then
236
236
  _need_launch=1; _launch_reason="cdp_wedge"
237
- echo "[$(date +%H:%M:%S)] Harness Chrome WEDGED on port 9555 (/json/version answers but the CDP handshake never completes: ${_ready_verdict:-no verdict}); killing and relaunching..." >&2
237
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] Harness Chrome WEDGED on port 9555 (/json/version answers but the CDP handshake never completes: ${_ready_verdict:-no verdict}); killing and relaunching..." >&2
238
238
  # Machine-greppable marker (same stderr-marker convention as
239
239
  # twitter_access_gate; bin/server.js parses these).
240
240
  echo "twitter_cdp_wedge: detected url=$_BH_DEFAULT_URL action=restart" >&2
@@ -260,7 +260,7 @@ ensure_twitter_browser_for_backend() {
260
260
  local _chrome_bin
261
261
  _chrome_bin=$(_resolve_chrome_bin)
262
262
  if [ -z "$_chrome_bin" ]; then
263
- echo "[$(date +%H:%M:%S)] ERROR: no Chrome/Chromium binary found. Set BH_CHROME_BIN." >&2
263
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] ERROR: no Chrome/Chromium binary found. Set BH_CHROME_BIN." >&2
264
264
  return 1
265
265
  fi
266
266
  # On Linux + no display, run headless. On root, add --no-sandbox.
@@ -302,7 +302,7 @@ ensure_twitter_browser_for_backend() {
302
302
  local _stale_pids
303
303
  _stale_pids=$(pgrep -f -- "--user-data-dir=$_prof_dir " 2>/dev/null || true)
304
304
  if [ -n "$_stale_pids" ] && ! curl -sf --max-time 2 -o /dev/null http://127.0.0.1:9555/json/version 2>/dev/null; then
305
- echo "[$(date +%H:%M:%S)] CDP down but Chrome still holds $_prof_dir (pids: $(echo $_stale_pids | tr '\n' ' ')); reaping stale profile owner before relaunch" >&2
305
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] CDP down but Chrome still holds $_prof_dir (pids: $(echo $_stale_pids | tr '\n' ' ')); reaping stale profile owner before relaunch" >&2
306
306
  kill $_stale_pids 2>/dev/null || true
307
307
  sleep 2
308
308
  _stale_pids=$(pgrep -f -- "--user-data-dir=$_prof_dir " 2>/dev/null || true)
@@ -335,7 +335,7 @@ os.execv(sys.argv[1], sys.argv[1:])' \
335
335
  sleep 1
336
336
  done
337
337
  if ! curl -sf --max-time 2 -o /dev/null http://127.0.0.1:9555/json/version 2>/dev/null; then
338
- echo "[$(date +%H:%M:%S)] ERROR: harness Chrome failed to start within 12s" >&2
338
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] ERROR: harness Chrome failed to start within 12s" >&2
339
339
  _bh_record_cdp_health launch_failed null
340
340
  return 1
341
341
  fi
@@ -344,13 +344,13 @@ os.execv(sys.argv[1], sys.argv[1:])' \
344
344
  # the cycle loudly, not feed 180s hangs downstream.
345
345
  local _post_verdict
346
346
  if ! _post_verdict=$(_bh_cdp_ready "$_BH_DEFAULT_URL"); then
347
- echo "[$(date +%H:%M:%S)] ERROR: harness Chrome answers HTTP after relaunch but the CDP handshake is STILL failing: ${_post_verdict:-no verdict}" >&2
347
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] ERROR: harness Chrome answers HTTP after relaunch but the CDP handshake is STILL failing: ${_post_verdict:-no verdict}" >&2
348
348
  echo "twitter_cdp_wedge: detected url=$_BH_DEFAULT_URL action=relaunch_failed" >&2
349
349
  _bh_record_cdp_health relaunch_failed "$_post_verdict"
350
350
  return 1
351
351
  fi
352
352
  _bh_record_cdp_health relaunched "$_post_verdict"
353
- echo "[$(date +%H:%M:%S)] Harness Chrome up on port 9555" >&2
353
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] Harness Chrome up on port 9555" >&2
354
354
  else
355
355
  _bh_record_cdp_health ok "${_ready_verdict:-null}"
356
356
  fi
@@ -392,7 +392,7 @@ defer_if_foreign_for_backend() {
392
392
  _sa_harness_log() {
393
393
  # Use the caller's log() FUNCTION when present; `declare -F` matches only a
394
394
  # shell function, never the macOS /usr/bin/log binary (command -v would).
395
- if declare -F log >/dev/null 2>&1; then log "$*"; else echo "[$(date +%H:%M:%S)] $*" >&2; fi
395
+ if declare -F log >/dev/null 2>&1; then log "$*"; else echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*" >&2; fi
396
396
  }
397
397
  _sa_resolve_uv() {
398
398
  local c
@@ -25,7 +25,7 @@ BATCH_ID="lipres-$(date +%Y%m%d_%H%M%S)-$$"
25
25
  export SA_CYCLE_ID="$BATCH_ID"
26
26
  export S4L_PIPELINE_NAME="linkedin-presence"
27
27
 
28
- log() { echo "[$(date +%H:%M:%S)] $*" | tee -a "$LOG_FILE"; }
28
+ log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*" | tee -a "$LOG_FILE"; }
29
29
 
30
30
  DRY_RUN="${LINKEDIN_PRESENCE_DRY_RUN:-0}"
31
31
 
@@ -19,7 +19,7 @@ LOG_DIR="$REPO_DIR/skill/logs"
19
19
  mkdir -p "$LOG_DIR"
20
20
  LOG_FILE="$LOG_DIR/refresh-instagram-tokens-$(date +%Y-%m-%d_%H%M%S).log"
21
21
 
22
- log() { echo "[$(date +%H:%M:%S)] $*" | tee -a "$LOG_FILE"; }
22
+ log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*" | tee -a "$LOG_FILE"; }
23
23
  log "=== refresh-instagram-tokens fire: $(date) ==="
24
24
 
25
25
  RUN_START=$(date +%s)
@@ -16,7 +16,7 @@ set -uo pipefail
16
16
  LOG_DIR="$HOME/social-autoposter/skill/logs"
17
17
  mkdir -p "$LOG_DIR"
18
18
  LOG_FILE="$LOG_DIR/refresh-twitter-following-$(date +%Y-%m-%d_%H%M%S).log"
19
- log() { echo "[$(date +%H:%M:%S)] $*" | tee -a "$LOG_FILE"; }
19
+ log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*" | tee -a "$LOG_FILE"; }
20
20
 
21
21
  REPO_DIR="$HOME/social-autoposter"
22
22
 
@@ -36,7 +36,7 @@ if [ -f "$REPO_DIR/.env" ]; then
36
36
  set +a
37
37
  fi
38
38
 
39
- log() { echo "[$(date +%H:%M:%S)] $*" | tee -a "$LOG_FILE"; }
39
+ log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*" | tee -a "$LOG_FILE"; }
40
40
 
41
41
  log "starting daily human-style synthesizer"
42
42
 
@@ -36,7 +36,7 @@ if [ -f "$REPO_DIR/.env" ]; then
36
36
  set +a
37
37
  fi
38
38
 
39
- log() { echo "[$(date +%H:%M:%S)] $*" | tee -a "$LOG_FILE"; }
39
+ log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*" | tee -a "$LOG_FILE"; }
40
40
 
41
41
  # Run accounting for dashboard Job History (Post Threads · Instagram).
42
42
  # Each exit site updates POSTED_CT / SKIPPED_CT / FAILED_CT; the EXIT trap
@@ -40,7 +40,7 @@ mkdir -p "$LOG_DIR"
40
40
  # State: ~/.claude/social-autoposter/linkedin.killswitch
41
41
  # Clear: python3 ~/social-autoposter/scripts/linkedin_killswitch.py clear
42
42
  if [ -f "$HOME/.claude/social-autoposter/linkedin.killswitch" ]; then
43
- echo "[$(date +%H:%M:%S)] LINKEDIN_KILLSWITCH active. Skipping run-linkedin." \
43
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] LINKEDIN_KILLSWITCH active. Skipping run-linkedin." \
44
44
  >> "$LOG_DIR/launchd-linkedin-stderr.log"
45
45
  exit 0
46
46
  fi
@@ -45,7 +45,7 @@ SOCIAL_ID=""
45
45
  REPLY_TO=""
46
46
  DO_POST=0
47
47
 
48
- log() { echo "[$(date +%H:%M:%S)] $*" | tee -a "$LOG_FILE"; }
48
+ log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*" | tee -a "$LOG_FILE"; }
49
49
 
50
50
  while [ $# -gt 0 ]; do
51
51
  case "$1" in
@@ -16,7 +16,7 @@ LOG_DIR="$REPO_DIR/skill/logs"
16
16
  mkdir -p "$LOG_DIR"
17
17
  LOG_FILE="$LOG_DIR/scan-instagram-replies-$(date +%Y-%m-%d_%H%M%S).log"
18
18
 
19
- log() { echo "[$(date +%H:%M:%S)] $*" | tee -a "$LOG_FILE"; }
19
+ log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*" | tee -a "$LOG_FILE"; }
20
20
  log "=== scan-instagram-replies fire: $(date) ==="
21
21
 
22
22
  RUN_START=$(date +%s)
@@ -37,7 +37,7 @@ LOG_FILE="$LOG_DIR/sentry-digest-$TS.log"
37
37
  SCAN_FILE="$LOG_DIR/sentry-digest-scan-$TS.json"
38
38
  OUTCOME_FILE="$LOG_DIR/outcome-sentry-digest-$TS.json"
39
39
 
40
- log() { echo "[$(date +%H:%M:%S)] $*" | tee -a "$LOG_FILE"; }
40
+ log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*" | tee -a "$LOG_FILE"; }
41
41
 
42
42
  cd "$REPO_DIR"
43
43
 
@@ -15,7 +15,7 @@ LOG_DIR="$REPO_DIR/skill/logs"
15
15
  mkdir -p "$LOG_DIR"
16
16
  LOG_FILE="$LOG_DIR/stats-instagram-$(date +%Y-%m-%d_%H%M%S).log"
17
17
 
18
- log() { echo "[$(date +%H:%M:%S)] $*" | tee -a "$LOG_FILE"; }
18
+ log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*" | tee -a "$LOG_FILE"; }
19
19
  log "=== stats-instagram fire: $(date) ==="
20
20
 
21
21
  RUN_START=$(date +%s)
@@ -36,5 +36,5 @@ RUN_START=$(date +%s)
36
36
  EXIT_CODE=$?
37
37
  RUN_ELAPSED=$(( $(date +%s) - RUN_START ))
38
38
 
39
- echo "[$(date +%H:%M:%S)] === done in ${RUN_ELAPSED}s (exit=${EXIT_CODE}) ==="
39
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] === done in ${RUN_ELAPSED}s (exit=${EXIT_CODE}) ==="
40
40
  exit "$EXIT_CODE"