@m13v/s4l 1.7.4-rc.31 → 1.7.4-rc.32
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.
- package/mcp/dist/index.js +4 -2
- package/mcp/dist/version.json +2 -2
- package/mcp/manifest.json +1 -1
- package/mcp/menubar/s4l_menubar.py +33 -31
- package/mcp/package.json +1 -1
- package/package.json +1 -1
- package/scripts/autopilot_stall_watch.py +6 -9
- package/scripts/schedule_state.py +23 -0
- package/skill/audit-dm-staleness.sh +1 -1
- package/skill/audit-linkedin.sh +1 -1
- package/skill/audit-reddit-resurrect.sh +1 -1
- package/skill/audit.sh +5 -5
- package/skill/dm-outreach-linkedin.sh +4 -4
- package/skill/dm-outreach-reddit.sh +1 -1
- package/skill/dm-outreach-twitter.sh +1 -1
- package/skill/engage-dm-replies.sh +2 -2
- package/skill/engage-linkedin.sh +2 -2
- package/skill/engage-moltbook.sh +1 -1
- package/skill/engage-twitter.sh +4 -4
- package/skill/github-engage.sh +1 -1
- package/skill/link-edit-github.sh +1 -1
- package/skill/link-edit-moltbook.sh +1 -1
- package/skill/link-edit-reddit.sh +1 -1
- package/skill/lock.sh +6 -6
- package/skill/precompute-stats.sh +1 -1
- package/skill/run-instagram-render.sh +1 -1
- package/skill/run-linkedin.sh +1 -1
- package/skill/run-reddit-search.sh +2 -2
- package/skill/run-reddit-threads.sh +1 -1
- package/skill/run-twitter-cycle.sh +1 -1
- package/skill/stats-linkedin.sh +2 -2
- package/skill/stats.sh +1 -1
package/mcp/dist/index.js
CHANGED
|
@@ -2988,8 +2988,10 @@ function queueDir() {
|
|
|
2988
2988
|
// routine is draining the queue — the worker would claim within a minute if it
|
|
2989
2989
|
// were firing. This is the liveness signal that survives a Claude account switch
|
|
2990
2990
|
// (which orphans the routines while their global SKILL.md files stay put, so the
|
|
2991
|
-
// SKILL.md-presence check in autopilotLoaded() reads a FALSE green). Mirrors
|
|
2992
|
-
//
|
|
2991
|
+
// SKILL.md-presence check in autopilotLoaded() reads a FALSE green). Mirrors
|
|
2992
|
+
// HEALTHY_DRAIN_MAX_SECONDS in scripts/schedule_state.py, the single source of
|
|
2993
|
+
// truth every Python stall detector derives from; this TS constant can't import
|
|
2994
|
+
// it, so keep it in sync by hand when retuning there.
|
|
2993
2995
|
const AUTOPILOT_STALL_MS = 1_200_000;
|
|
2994
2996
|
// True when no scheduled-task routine is draining the draft queue. Two signals,
|
|
2995
2997
|
// OR'd (keep in lockstep with mcp/menubar/s4l_menubar.py::_autopilot_stalled and
|
package/mcp/dist/version.json
CHANGED
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.
|
|
5
|
+
"version": "1.7.4-rc.32",
|
|
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": {
|
|
@@ -398,32 +398,33 @@ DIAGNOSE_PROMPT_TEMPLATE = (
|
|
|
398
398
|
"<that file>` so the report reaches the S4L developers. Keep replies short."
|
|
399
399
|
)
|
|
400
400
|
|
|
401
|
-
#
|
|
402
|
-
#
|
|
403
|
-
#
|
|
404
|
-
#
|
|
405
|
-
#
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
#
|
|
409
|
-
#
|
|
410
|
-
#
|
|
411
|
-
#
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
#
|
|
415
|
-
#
|
|
416
|
-
#
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
401
|
+
# Stall thresholds live in the single source of truth, scripts/schedule_state.py
|
|
402
|
+
# (HEALTHY_DRAIN_MAX_SECONDS and the names derived from it) — retune there, not
|
|
403
|
+
# here. Same module that owns FIRING_WINDOW; _schedule_state already delegates to
|
|
404
|
+
# it. The three names cover three distinct failure modes:
|
|
405
|
+
# AUTOPILOT_STALL_SECONDS pending job unclaimed → no routine draining
|
|
406
|
+
# (fix: Re-arm). Idle queue has no pending job,
|
|
407
|
+
# so a quiet pipeline never trips it.
|
|
408
|
+
# AUTOPILOT_RUNNING_STALL_SECONDS job claimed but wedged in running/ → worker
|
|
409
|
+
# died mid-run (fix: Diagnose).
|
|
410
|
+
# DRAFT_STUCK_SECONDS the producer's "draft Nm" label alive this
|
|
411
|
+
# long → end-to-end clock; the only timer that
|
|
412
|
+
# spans claim→die→requeue churn loops, which
|
|
413
|
+
# reset the two per-state timers on every
|
|
414
|
+
# transition while nothing ever completes.
|
|
415
|
+
# The import is best-effort because the S4L_REPO_DIR sys.path insertion near the
|
|
416
|
+
# top of this file is best-effort; the fallback literal mirrors
|
|
417
|
+
# HEALTHY_DRAIN_MAX_SECONDS.
|
|
418
|
+
try:
|
|
419
|
+
from schedule_state import ( # noqa: E402
|
|
420
|
+
STALL_SECONDS as AUTOPILOT_STALL_SECONDS,
|
|
421
|
+
RUNNING_STALL_SECONDS as AUTOPILOT_RUNNING_STALL_SECONDS,
|
|
422
|
+
DRAFT_STUCK_SECONDS,
|
|
423
|
+
)
|
|
424
|
+
except Exception:
|
|
425
|
+
AUTOPILOT_STALL_SECONDS = 1200
|
|
426
|
+
AUTOPILOT_RUNNING_STALL_SECONDS = 1200
|
|
427
|
+
DRAFT_STUCK_SECONDS = 1200
|
|
427
428
|
|
|
428
429
|
# A poll can read a transient "not stuck" moment (e.g. the activity file
|
|
429
430
|
# between one dying worker attempt and the next claim on the same aged job)
|
|
@@ -2445,11 +2446,12 @@ class S4LMenuBar(rumps.App):
|
|
|
2445
2446
|
self._stall_reason_info = ("", "")
|
|
2446
2447
|
# Draft worker stuck/killed: the producer narrates "drafting replies (Nm)"
|
|
2447
2448
|
# the whole time it blocks waiting for a worker to return a result, with NO
|
|
2448
|
-
# idea the worker died. A healthy drain
|
|
2449
|
-
# has been "drafting" past
|
|
2450
|
-
# killed mid-run (or never
|
|
2451
|
-
#
|
|
2452
|
-
#
|
|
2449
|
+
# idea the worker died. A healthy drain can run 8-10 min end to end (slot
|
|
2450
|
+
# wait + the drafting turn); once that label has been "drafting" past
|
|
2451
|
+
# DRAFT_STUCK_SECONDS the worker keeps getting killed mid-run (or never
|
|
2452
|
+
# claims) and nothing is draining — flip to ⚠ instead of leaving the
|
|
2453
|
+
# reassuring "drafting (25m)" spinner up. Skip when a more specific cause
|
|
2454
|
+
# (rate limit) already owns the reason.
|
|
2453
2455
|
#
|
|
2454
2456
|
# Gated on schedule_state in ("ok", "stalled"), NOT missing/disabled: when
|
|
2455
2457
|
# the schedule is missing/disabled (e.g. orphaned by an account switch),
|
package/mcp/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m13v/s4l-mcp",
|
|
3
|
-
"version": "1.7.4-rc.
|
|
3
|
+
"version": "1.7.4-rc.32",
|
|
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
|
@@ -14,7 +14,8 @@ autopilot" item). This watcher is the part the user can't see: a fleet-side aler
|
|
|
14
14
|
so a sustained stall pages us even when nobody is looking at the menu bar.
|
|
15
15
|
|
|
16
16
|
Design mirrors the stall signal in mcp/menubar/s4l_menubar.py (_autopilot_stalled)
|
|
17
|
-
and mcp/src/index.ts (autopilotStalled)
|
|
17
|
+
and mcp/src/index.ts (autopilotStalled); the thresholds are shared via
|
|
18
|
+
schedule_state.py (index.ts mirrors by hand):
|
|
18
19
|
stalled = the autopilot is configured (a complete worker set's SKILL.md
|
|
19
20
|
files present — see WORKER_TASK_SETS)
|
|
20
21
|
AND a draft job has sat unclaimed in pending/ past STALL_SECONDS.
|
|
@@ -46,14 +47,10 @@ import identity # noqa: E402 (lives next to this file in scripts/)
|
|
|
46
47
|
|
|
47
48
|
s4l_env.mirror()
|
|
48
49
|
|
|
49
|
-
#
|
|
50
|
-
STALL_SECONDS =
|
|
51
|
-
#
|
|
52
|
-
|
|
53
|
-
# or crashed. Must be generous enough to clear the longest real drafting turn so a
|
|
54
|
-
# healthy run never trips it. Keep in sync with AUTOPILOT_RUNNING_STALL_SECONDS
|
|
55
|
-
# (menubar). See _oldest_running_age.
|
|
56
|
-
RUNNING_STALL_SECONDS = 1200
|
|
50
|
+
# Stall thresholds live in schedule_state.py (HEALTHY_DRAIN_MAX_SECONDS and the
|
|
51
|
+
# names derived from it) — retune there, not here. STALL_SECONDS = pending job
|
|
52
|
+
# unclaimed; RUNNING_STALL_SECONDS = claimed but wedged (see _oldest_running_age).
|
|
53
|
+
from schedule_state import STALL_SECONDS, RUNNING_STALL_SECONDS # noqa: E402
|
|
57
54
|
# Require the stall to persist this many consecutive checks before paging, so a
|
|
58
55
|
# transient slow claim (e.g. right after a Claude restart) doesn't false-alarm.
|
|
59
56
|
# At StartInterval 120 that is ~6 min of continuous stall.
|
|
@@ -94,6 +94,29 @@ def _registry_worker_recs(by_id):
|
|
|
94
94
|
# false "not scheduled".
|
|
95
95
|
FIRING_WINDOW = 420
|
|
96
96
|
|
|
97
|
+
# --- Stall thresholds (single source of truth) --------------------------------
|
|
98
|
+
# The longest a fully healthy drain can take end to end: a draft job can wait
|
|
99
|
+
# minutes for a worker slot (per-minute scheduler cadence, workers busy on other
|
|
100
|
+
# jobs) and the drafting turn itself runs multiple minutes. Observed healthy
|
|
101
|
+
# episodes reach 8-10 min (2026-07-13); alarm at 20 min for margin. Every stall
|
|
102
|
+
# detector derives from this ONE number so they can't drift apart again (99e695bf
|
|
103
|
+
# retuned the two per-state timers to 1200s but left the end-to-end DRAFT_STUCK
|
|
104
|
+
# check at 300s, which then false-alarmed on healthy 8-minute drains). The Node
|
|
105
|
+
# server can't import this module — mcp/src/index.ts::AUTOPILOT_STALL_MS must be
|
|
106
|
+
# kept in sync by hand.
|
|
107
|
+
HEALTHY_DRAIN_MAX_SECONDS = 1200
|
|
108
|
+
|
|
109
|
+
# A pending draft job unclaimed this long: no routine is draining the queue
|
|
110
|
+
# (an idle queue has no pending job at all, so a quiet pipeline never trips it).
|
|
111
|
+
STALL_SECONDS = HEALTHY_DRAIN_MAX_SECONDS
|
|
112
|
+
# A job claimed but still sitting in running/ this long: the worker picked it up
|
|
113
|
+
# and then wedged mid-run (the claude -p drafting child died / never spawned).
|
|
114
|
+
RUNNING_STALL_SECONDS = HEALTHY_DRAIN_MAX_SECONDS
|
|
115
|
+
# The producer's "drafting Nm" label alive this long: the end-to-end clock. This
|
|
116
|
+
# is the only timer that spans claim→die→requeue churn loops, which reset the two
|
|
117
|
+
# per-state timers above on every transition while nothing ever completes.
|
|
118
|
+
DRAFT_STUCK_SECONDS = HEALTHY_DRAIN_MAX_SECONDS
|
|
119
|
+
|
|
97
120
|
# Grace for a JUST-scheduled task that hasn't fired yet. When the user runs
|
|
98
121
|
# "Set up draft schedule", create_scheduled_task registers both worker tasks
|
|
99
122
|
# (cron "* * * * *", enabled) but lastRunAt is null until the host fires them the
|
|
@@ -14,7 +14,7 @@ LOG_DIR="$REPO_DIR/skill/logs"
|
|
|
14
14
|
mkdir -p "$LOG_DIR"
|
|
15
15
|
LOG_FILE="$LOG_DIR/audit-dm-staleness-$(date +%Y-%m-%d_%H%M%S).log"
|
|
16
16
|
|
|
17
|
-
log() { echo "[$(date +%H:%M:%
|
|
17
|
+
log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*" | tee -a "$LOG_FILE"; }
|
|
18
18
|
|
|
19
19
|
# HTTP-only lane (2026-06-01): both staleness UPDATEs run server-side via the
|
|
20
20
|
# s4l.ai API (POST /api/v1/dms/staleness-sweep). No DATABASE_URL, no psql.
|
package/skill/audit-linkedin.sh
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
# State: ~/.claude/social-autoposter/linkedin.killswitch
|
|
7
7
|
# Clear: python3 ~/social-autoposter/scripts/linkedin_killswitch.py clear
|
|
8
8
|
if [ -f "$HOME/.claude/social-autoposter/linkedin.killswitch" ]; then
|
|
9
|
-
echo "[$(date +%H:%M:%
|
|
9
|
+
echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] LINKEDIN_KILLSWITCH active. Aborting LinkedIn pipeline."
|
|
10
10
|
echo " Re-auth LinkedIn in harness Chrome, then: python3 ~/social-autoposter/scripts/linkedin_killswitch.py clear"
|
|
11
11
|
exit 0
|
|
12
12
|
fi
|
|
@@ -38,7 +38,7 @@ AUDIT_HELPER="$REPO_DIR/scripts/audit_helper.py"
|
|
|
38
38
|
mkdir -p "$LOG_DIR"
|
|
39
39
|
LOG_FILE="$LOG_DIR/audit-reddit-resurrect-$(date +%Y-%m-%d_%H%M%S).log"
|
|
40
40
|
|
|
41
|
-
log() { echo "[$(date +%H:%M:%
|
|
41
|
+
log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*" >> "$LOG_FILE"; echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*"; }
|
|
42
42
|
|
|
43
43
|
RUN_START=$(date +%s)
|
|
44
44
|
log "=== Reddit resurrect audit: $(date) ==="
|
package/skill/audit.sh
CHANGED
|
@@ -62,10 +62,10 @@ case "${PLATFORM:-all}" in
|
|
|
62
62
|
_LI_BOOT_RC=0
|
|
63
63
|
( source "$(dirname "$0")/lib/linkedin-backend.sh"; ensure_linkedin_browser_for_backend ) || _LI_BOOT_RC=$?
|
|
64
64
|
if [ "$_LI_BOOT_RC" -eq 78 ]; then
|
|
65
|
-
echo "[$(date +%H:%M:%
|
|
65
|
+
echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] linkedin-pipeline lock: peer pipeline is driving the 9556 Chrome; skipping this fire"
|
|
66
66
|
exit 0
|
|
67
67
|
elif [ "$_LI_BOOT_RC" -ne 0 ]; then
|
|
68
|
-
echo "[$(date +%H:%M:%
|
|
68
|
+
echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] ERROR: linkedin browser bootstrap failed (rc=$_LI_BOOT_RC)"
|
|
69
69
|
exit "$_LI_BOOT_RC"
|
|
70
70
|
fi
|
|
71
71
|
;;
|
|
@@ -84,10 +84,10 @@ case "${PLATFORM:-all}" in
|
|
|
84
84
|
_LI_BOOT_RC=0
|
|
85
85
|
( source "$(dirname "$0")/lib/linkedin-backend.sh"; ensure_linkedin_browser_for_backend ) || _LI_BOOT_RC=$?
|
|
86
86
|
if [ "$_LI_BOOT_RC" -eq 78 ]; then
|
|
87
|
-
echo "[$(date +%H:%M:%
|
|
87
|
+
echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] linkedin-pipeline lock: peer pipeline is driving the 9556 Chrome; skipping this fire (all-platform audit)"
|
|
88
88
|
exit 0
|
|
89
89
|
elif [ "$_LI_BOOT_RC" -ne 0 ]; then
|
|
90
|
-
echo "[$(date +%H:%M:%
|
|
90
|
+
echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] ERROR: linkedin browser bootstrap failed (rc=$_LI_BOOT_RC)"
|
|
91
91
|
exit "$_LI_BOOT_RC"
|
|
92
92
|
fi
|
|
93
93
|
python3 "$REPO_DIR_FOR_LOCK/scripts/reddit_browser_lock.py" acquire --timeout 3600 --ttl 90 2>&1 || \
|
|
@@ -113,7 +113,7 @@ mkdir -p "$LOG_DIR"
|
|
|
113
113
|
LOG_TAG="${PLATFORM:-all}"
|
|
114
114
|
LOG_FILE="$LOG_DIR/audit-${LOG_TAG}-$(date +%Y-%m-%d_%H%M%S).log"
|
|
115
115
|
|
|
116
|
-
log() { echo "[$(date +%H:%M:%
|
|
116
|
+
log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*" >> "$LOG_FILE"; echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*"; }
|
|
117
117
|
|
|
118
118
|
RUN_START=$(date +%s)
|
|
119
119
|
log "=== Audit Pipeline Run (${LOG_TAG}): $(date) ==="
|
|
@@ -12,7 +12,7 @@ set -euo pipefail
|
|
|
12
12
|
# State: ~/.claude/social-autoposter/linkedin.killswitch
|
|
13
13
|
# Clear: python3 ~/social-autoposter/scripts/linkedin_killswitch.py clear
|
|
14
14
|
if [ -f "$HOME/.claude/social-autoposter/linkedin.killswitch" ]; then
|
|
15
|
-
echo "[$(date +%H:%M:%
|
|
15
|
+
echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] LINKEDIN_KILLSWITCH active. Aborting LinkedIn pipeline."
|
|
16
16
|
echo " Re-auth LinkedIn in harness Chrome, then: python3 ~/social-autoposter/scripts/linkedin_killswitch.py clear"
|
|
17
17
|
exit 0
|
|
18
18
|
fi
|
|
@@ -37,10 +37,10 @@ acquire_lock "linkedin-browser" 3600
|
|
|
37
37
|
_LI_BOOT_RC=0
|
|
38
38
|
ensure_linkedin_browser_for_backend || _LI_BOOT_RC=$?
|
|
39
39
|
if [ "$_LI_BOOT_RC" -eq 78 ]; then
|
|
40
|
-
echo "[$(date +%H:%M:%
|
|
40
|
+
echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] linkedin-pipeline lock: peer pipeline is driving the 9556 Chrome; skipping this fire"
|
|
41
41
|
exit 0
|
|
42
42
|
elif [ "$_LI_BOOT_RC" -ne 0 ]; then
|
|
43
|
-
echo "[$(date +%H:%M:%
|
|
43
|
+
echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] ERROR: linkedin browser bootstrap failed (rc=$_LI_BOOT_RC)"
|
|
44
44
|
exit "$_LI_BOOT_RC"
|
|
45
45
|
fi
|
|
46
46
|
acquire_lock "dm-outreach-linkedin" 2700
|
|
@@ -56,7 +56,7 @@ LOG_DIR="$REPO_DIR/skill/logs"
|
|
|
56
56
|
mkdir -p "$LOG_DIR"
|
|
57
57
|
LOG_FILE="$LOG_DIR/dm-outreach-linkedin-$(date +%Y-%m-%d_%H%M%S).log"
|
|
58
58
|
|
|
59
|
-
log() { echo "[$(date +%H:%M:%
|
|
59
|
+
log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*" | tee -a "$LOG_FILE"; }
|
|
60
60
|
|
|
61
61
|
RUN_START=$(date +%s)
|
|
62
62
|
log "=== LinkedIn DM Outreach Run: $(date) ==="
|
|
@@ -50,7 +50,7 @@ LOG_DIR="$REPO_DIR/skill/logs"
|
|
|
50
50
|
mkdir -p "$LOG_DIR"
|
|
51
51
|
LOG_FILE="$LOG_DIR/dm-outreach-reddit-$(date +%Y-%m-%d_%H%M%S).log"
|
|
52
52
|
|
|
53
|
-
log() { echo "[$(date +%H:%M:%
|
|
53
|
+
log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*" | tee -a "$LOG_FILE"; }
|
|
54
54
|
|
|
55
55
|
RUN_START=$(date +%s)
|
|
56
56
|
log "=== Reddit DM Outreach Run: $(date) ==="
|
|
@@ -44,7 +44,7 @@ SKILL_FILE="$REPO_DIR/SKILL.md"
|
|
|
44
44
|
# dm-outreach-linkedin.sh (migrated 2026-05-12).
|
|
45
45
|
# (LOG_DIR/LOG_FILE bootstrapped at top of script.)
|
|
46
46
|
|
|
47
|
-
log() { echo "[$(date +%H:%M:%
|
|
47
|
+
log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*" | tee -a "$LOG_FILE"; }
|
|
48
48
|
|
|
49
49
|
RUN_START=$(date +%s)
|
|
50
50
|
log "=== Twitter DM Outreach Run: $(date) ==="
|
|
@@ -35,7 +35,7 @@ fi
|
|
|
35
35
|
# State: ~/.claude/social-autoposter/linkedin.killswitch
|
|
36
36
|
# Clear: python3 ~/social-autoposter/scripts/linkedin_killswitch.py clear
|
|
37
37
|
if [ "$PLATFORM" = "linkedin" ] && [ -f "$HOME/.claude/social-autoposter/linkedin.killswitch" ]; then
|
|
38
|
-
echo "[$(date +%H:%M:%
|
|
38
|
+
echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] LINKEDIN_KILLSWITCH active. Aborting LinkedIn DM-replies pipeline."
|
|
39
39
|
echo " Re-auth LinkedIn in harness Chrome, then: python3 ~/social-autoposter/scripts/linkedin_killswitch.py clear"
|
|
40
40
|
exit 0
|
|
41
41
|
fi
|
|
@@ -116,7 +116,7 @@ LOG_SUFFIX=""
|
|
|
116
116
|
[ -n "$PLATFORM" ] && LOG_SUFFIX="-$PLATFORM"
|
|
117
117
|
LOG_FILE="$LOG_DIR/engage-dm-replies${LOG_SUFFIX}-$(date +%Y-%m-%d_%H%M%S).log"
|
|
118
118
|
|
|
119
|
-
log() { echo "[$(date +%H:%M:%
|
|
119
|
+
log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*" | tee -a "$LOG_FILE"; }
|
|
120
120
|
|
|
121
121
|
RUN_START=$(date +%s)
|
|
122
122
|
log "=== DM Reply Engagement Run: $(date) (platform: ${PLATFORM:-all}) ==="
|
package/skill/engage-linkedin.sh
CHANGED
|
@@ -17,7 +17,7 @@ set -euo pipefail
|
|
|
17
17
|
# State: ~/.claude/social-autoposter/linkedin.killswitch
|
|
18
18
|
# Clear: python3 ~/social-autoposter/scripts/linkedin_killswitch.py clear
|
|
19
19
|
if [ -f "$HOME/.claude/social-autoposter/linkedin.killswitch" ]; then
|
|
20
|
-
echo "[$(date +%H:%M:%
|
|
20
|
+
echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] LINKEDIN_KILLSWITCH active. Aborting LinkedIn pipeline."
|
|
21
21
|
echo " Re-auth LinkedIn in harness Chrome, then: python3 ~/social-autoposter/scripts/linkedin_killswitch.py clear"
|
|
22
22
|
exit 0
|
|
23
23
|
fi
|
|
@@ -84,7 +84,7 @@ LOG_FILE="$LOG_DIR/engage-linkedin-$(date +%Y-%m-%d_%H%M%S).log"
|
|
|
84
84
|
BATCH_ID="enli-$(date +%Y%m%d_%H%M%S)-$$"
|
|
85
85
|
export SA_CYCLE_ID="$BATCH_ID"
|
|
86
86
|
|
|
87
|
-
log() { echo "[$(date +%H:%M:%
|
|
87
|
+
log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*" | tee -a "$LOG_FILE"; }
|
|
88
88
|
|
|
89
89
|
RUN_START=$(date +%s)
|
|
90
90
|
log "=== LinkedIn Engagement Run: $(date) ==="
|
package/skill/engage-moltbook.sh
CHANGED
|
@@ -23,7 +23,7 @@ LOG_DIR="$REPO_DIR/skill/logs"
|
|
|
23
23
|
mkdir -p "$LOG_DIR"
|
|
24
24
|
LOG_FILE="$LOG_DIR/engage-moltbook-$(date +%Y-%m-%d_%H%M%S).log"
|
|
25
25
|
|
|
26
|
-
log() { echo "[$(date +%H:%M:%
|
|
26
|
+
log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*" | tee -a "$LOG_FILE"; }
|
|
27
27
|
|
|
28
28
|
RUN_START=$(date +%s)
|
|
29
29
|
log "=== MoltBook Engage Run: $(date) ==="
|
package/skill/engage-twitter.sh
CHANGED
|
@@ -25,12 +25,12 @@ source "$(dirname "$0")/lock.sh"
|
|
|
25
25
|
# Sets MCP_CONFIG_FILE, BROWSER_INSTRUCTIONS, exports TWITTER_CDP_URL=9555.
|
|
26
26
|
source "$(dirname "$0")/lib/twitter-backend.sh"
|
|
27
27
|
|
|
28
|
-
echo "[$(date +%H:%M:%
|
|
28
|
+
echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] Acquiring twitter-browser lock (pid=$$)..." | tee -a "$LOG_FILE"
|
|
29
29
|
acquire_lock "twitter-browser" 3600 2>>"$LOG_FILE"
|
|
30
|
-
echo "[$(date +%H:%M:%
|
|
30
|
+
echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] twitter-browser lock held (pid=$$)" | tee -a "$LOG_FILE"
|
|
31
31
|
# Probe + launch harness Chrome on port 9555 if needed, then sweep leftover tabs.
|
|
32
32
|
ensure_twitter_browser_for_backend 2>&1 | tee -a "$LOG_FILE"
|
|
33
|
-
echo "[$(date +%H:%M:%
|
|
33
|
+
echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] Acquiring twitter (pipeline) lock (pid=$$)..." | tee -a "$LOG_FILE"
|
|
34
34
|
acquire_lock "twitter" 3600 2>>"$LOG_FILE"
|
|
35
35
|
|
|
36
36
|
# Load secrets
|
|
@@ -47,7 +47,7 @@ BATCH_SIZE=500
|
|
|
47
47
|
ENGAGE_TWITTER_HELPER="$REPO_DIR/scripts/engage_twitter_helper.py"
|
|
48
48
|
# (LOG_DIR/LOG_FILE bootstrapped at top of script.)
|
|
49
49
|
|
|
50
|
-
log() { echo "[$(date +%H:%M:%
|
|
50
|
+
log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*" | tee -a "$LOG_FILE"; }
|
|
51
51
|
|
|
52
52
|
RUN_START=$(date +%s)
|
|
53
53
|
log "=== Twitter Engagement Run: $(date) ==="
|
package/skill/github-engage.sh
CHANGED
|
@@ -20,7 +20,7 @@ LOG_DIR="$REPO_DIR/skill/logs"
|
|
|
20
20
|
mkdir -p "$LOG_DIR"
|
|
21
21
|
LOG_FILE="$LOG_DIR/github-engage-$(date +%Y-%m-%d_%H%M%S).log"
|
|
22
22
|
|
|
23
|
-
log() { echo "[$(date +%H:%M:%
|
|
23
|
+
log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*" | tee -a "$LOG_FILE"; }
|
|
24
24
|
|
|
25
25
|
# Per-cycle batch id stamped onto every claude_sessions row spawned by this
|
|
26
26
|
# engagement run (via SA_CYCLE_ID env -> log_claude_session.py). 2026-05-10
|
|
@@ -30,7 +30,7 @@ LE_HELPER="$REPO_DIR/scripts/link_edit_helper.py"
|
|
|
30
30
|
mkdir -p "$LOG_DIR"
|
|
31
31
|
LOG_FILE="$LOG_DIR/link-edit-github-$(date +%Y-%m-%d_%H%M%S).log"
|
|
32
32
|
|
|
33
|
-
log() { echo "[$(date +%H:%M:%
|
|
33
|
+
log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*" | tee -a "$LOG_FILE"; }
|
|
34
34
|
|
|
35
35
|
RUN_START=$(date +%s)
|
|
36
36
|
log "=== GitHub Link Edit Run: $(date) ==="
|
|
@@ -29,7 +29,7 @@ LE_HELPER="$REPO_DIR/scripts/link_edit_helper.py"
|
|
|
29
29
|
mkdir -p "$LOG_DIR"
|
|
30
30
|
LOG_FILE="$LOG_DIR/link-edit-moltbook-$(date +%Y-%m-%d_%H%M%S).log"
|
|
31
31
|
|
|
32
|
-
log() { echo "[$(date +%H:%M:%
|
|
32
|
+
log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*" | tee -a "$LOG_FILE"; }
|
|
33
33
|
|
|
34
34
|
RUN_START=$(date +%s)
|
|
35
35
|
log "=== Moltbook Link Edit Run: $(date) ==="
|
|
@@ -38,7 +38,7 @@ LE_HELPER="$REPO_DIR/scripts/link_edit_helper.py"
|
|
|
38
38
|
mkdir -p "$LOG_DIR"
|
|
39
39
|
LOG_FILE="$LOG_DIR/link-edit-reddit-$(date +%Y-%m-%d_%H%M%S).log"
|
|
40
40
|
|
|
41
|
-
log() { echo "[$(date +%H:%M:%
|
|
41
|
+
log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*" | tee -a "$LOG_FILE"; }
|
|
42
42
|
|
|
43
43
|
RUN_START=$(date +%s)
|
|
44
44
|
log "=== Reddit Link Edit Run: $(date) ==="
|
package/skill/lock.sh
CHANGED
|
@@ -121,11 +121,11 @@ if [ -z "${_SA_LOCK_DIRS+x}" ]; then
|
|
|
121
121
|
# is defect "owner=OTHER" (wipes a live peer's lock -> double-hold).
|
|
122
122
|
if _sa_we_own_lock "$d"; then
|
|
123
123
|
_sa_lock_event trap_rm "$_lname" "$(_sa_lock_owner_tag "$d")"
|
|
124
|
-
echo "[lock] trap-released $_lname pid=$$ at $(date +%H:%M:%
|
|
124
|
+
echo "[lock] trap-released $_lname pid=$$ at $(date -u +%Y-%m-%dT%H:%M:%SZ)" >&2
|
|
125
125
|
rm -rf "$d"
|
|
126
126
|
else
|
|
127
127
|
_sa_lock_event trap_rm_skipped "$_lname" "$(_sa_lock_owner_tag "$d")"
|
|
128
|
-
echo "[lock] trap-release SKIPPED $_lname pid=$$ (not owner) at $(date +%H:%M:%
|
|
128
|
+
echo "[lock] trap-release SKIPPED $_lname pid=$$ (not owner) at $(date -u +%Y-%m-%dT%H:%M:%SZ)" >&2
|
|
129
129
|
fi
|
|
130
130
|
done
|
|
131
131
|
for t in ${_SA_LOCK_TICKETS[@]+"${_SA_LOCK_TICKETS[@]}"}; do
|
|
@@ -149,7 +149,7 @@ if [ -z "${_SA_LOCK_DIRS+x}" ]; then
|
|
|
149
149
|
_sa_exit_on_signal() {
|
|
150
150
|
local _sig="$1" _code="$2"
|
|
151
151
|
_sa_lock_event signal_exit "-" "signal=$_sig"
|
|
152
|
-
echo "[lock] caught SIG${_sig} pid=$$; releasing locks and exiting $_code at $(date +%H:%M:%
|
|
152
|
+
echo "[lock] caught SIG${_sig} pid=$$; releasing locks and exiting $_code at $(date -u +%Y-%m-%dT%H:%M:%SZ)" >&2
|
|
153
153
|
_sa_release_locks
|
|
154
154
|
trap - EXIT
|
|
155
155
|
exit "$_code"
|
|
@@ -247,7 +247,7 @@ acquire_lock() {
|
|
|
247
247
|
[ "$_existing" != "$ticket_file" ] && _new_t+=("$_existing")
|
|
248
248
|
done
|
|
249
249
|
_SA_LOCK_TICKETS=(${_new_t[@]+"${_new_t[@]}"})
|
|
250
|
-
echo "[lock] acquired $name pid=$$ at $(date +%H:%M:%
|
|
250
|
+
echo "[lock] acquired $name pid=$$ at $(date -u +%Y-%m-%dT%H:%M:%SZ) waited=${waited}s" >&2
|
|
251
251
|
_sa_lock_event acquired "$name" "waited=${waited}s"
|
|
252
252
|
break
|
|
253
253
|
fi
|
|
@@ -694,10 +694,10 @@ release_lock() {
|
|
|
694
694
|
if _sa_we_own_lock "$lock_dir"; then
|
|
695
695
|
_sa_lock_event release "$name" "$(_sa_lock_owner_tag "$lock_dir")"
|
|
696
696
|
rm -rf "$lock_dir"
|
|
697
|
-
echo "[lock] released $name pid=$$ at $(date +%H:%M:%
|
|
697
|
+
echo "[lock] released $name pid=$$ at $(date -u +%Y-%m-%dT%H:%M:%SZ)" >&2
|
|
698
698
|
else
|
|
699
699
|
_sa_lock_event release_skipped "$name" "$(_sa_lock_owner_tag "$lock_dir")"
|
|
700
|
-
echo "[lock] release SKIPPED $name pid=$$ (not owner) at $(date +%H:%M:%
|
|
700
|
+
echo "[lock] release SKIPPED $name pid=$$ (not owner) at $(date -u +%Y-%m-%dT%H:%M:%SZ)" >&2
|
|
701
701
|
fi
|
|
702
702
|
# Rebuild the lock stack without this entry so the EXIT trap doesn't try to
|
|
703
703
|
# rm it again (harmless, but keeps the stack honest if release_lock is paired
|
|
@@ -31,5 +31,5 @@ python3 "$REPO_DIR/scripts/precompute_dashboard_stats.py"
|
|
|
31
31
|
EXIT_CODE=$?
|
|
32
32
|
RUN_ELAPSED=$(( $(date +%s) - RUN_START ))
|
|
33
33
|
|
|
34
|
-
echo "[$(date +%H:%M:%
|
|
34
|
+
echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] === done in ${RUN_ELAPSED}s (exit=${EXIT_CODE}) ==="
|
|
35
35
|
exit "$EXIT_CODE"
|
|
@@ -43,7 +43,7 @@ if [ -f "$REPO_DIR/.env" ]; then
|
|
|
43
43
|
set +a
|
|
44
44
|
fi
|
|
45
45
|
|
|
46
|
-
log() { echo "[$(date +%H:%M:%
|
|
46
|
+
log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*" | tee -a "$LOG_FILE"; }
|
|
47
47
|
|
|
48
48
|
# Run accounting for dashboard Job History (Render · Instagram). Matches the
|
|
49
49
|
# pattern in run-instagram-daily.sh / run-twitter-threads.sh / run-reddit-threads.sh:
|
package/skill/run-linkedin.sh
CHANGED
|
@@ -85,7 +85,7 @@ LINKEDIN_BACKEND="${LINKEDIN_BACKEND:-browser}"
|
|
|
85
85
|
# Clear: python3 ~/social-autoposter/scripts/linkedin_killswitch.py clear
|
|
86
86
|
# Only gates the browser backend — UniPile has no headed session to compromise.
|
|
87
87
|
if [ "$LINKEDIN_BACKEND" = "browser" ] && [ -f "$HOME/.claude/social-autoposter/linkedin.killswitch" ]; then
|
|
88
|
-
echo "[$(date +%H:%M:%
|
|
88
|
+
echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] LINKEDIN_KILLSWITCH active. Aborting LinkedIn pipeline."
|
|
89
89
|
echo " Re-auth LinkedIn in harness Chrome, then: python3 ~/social-autoposter/scripts/linkedin_killswitch.py clear"
|
|
90
90
|
exit 0
|
|
91
91
|
fi
|
|
@@ -43,7 +43,7 @@ LOG_DIR="$REPO_DIR/skill/logs"
|
|
|
43
43
|
mkdir -p "$LOG_DIR"
|
|
44
44
|
LOG_FILE="$LOG_DIR/run-reddit-search-$(date +%Y-%m-%d_%H%M%S).log"
|
|
45
45
|
|
|
46
|
-
log() { echo "[$(date +%H:%M:%
|
|
46
|
+
log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*" | tee -a "$LOG_FILE"; }
|
|
47
47
|
|
|
48
48
|
log "=== Reddit Search Post Run: $(date) ==="
|
|
49
49
|
|
|
@@ -88,7 +88,7 @@ _parse_post_results() {
|
|
|
88
88
|
# Bug observed 2026-05-08: a leaked "[14:57:04] Post phase: ..." line
|
|
89
89
|
# produced "TOTAL_POSTED + [14:57:04]: syntax error" and `set -e` aborted
|
|
90
90
|
# the script BEFORE the discover lane ran.
|
|
91
|
-
echo "[$(date +%H:%M:%
|
|
91
|
+
echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] Post phase: exit code $rc; counting as failed." >> "$LOG_FILE"
|
|
92
92
|
echo "0 1"
|
|
93
93
|
fi
|
|
94
94
|
}
|
|
@@ -33,7 +33,7 @@ RUN_START_EPOCH=$(date +%s)
|
|
|
33
33
|
# calls added in 5e41d96 (2026-05-10) fall through to macOS /usr/bin/log,
|
|
34
34
|
# which barfs `Unknown subcommand` and ERR-traps the run at exit=64 before
|
|
35
35
|
# the browser lease is ever acquired (silent kill since 2026-05-10).
|
|
36
|
-
log() { echo "[$(date +%H:%M:%
|
|
36
|
+
log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*" | tee -a "$LOG_FILE"; }
|
|
37
37
|
|
|
38
38
|
# Diagnostic: log the failing line and command before set -e kills the script.
|
|
39
39
|
# Without this, silent deaths (e.g., Claude exits non-zero inside the $() below)
|
|
@@ -174,7 +174,7 @@ if [ -f "$REPO_DIR/.env" ]; then
|
|
|
174
174
|
set +a
|
|
175
175
|
fi
|
|
176
176
|
|
|
177
|
-
log() { echo "[$(date +%H:%M:%
|
|
177
|
+
log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*" | tee -a "$LOG_FILE"; }
|
|
178
178
|
|
|
179
179
|
log "=== Twitter Cycle (batch=$BATCH_ID): $(date) ==="
|
|
180
180
|
log "Logic=D (no-ripen + 1h freshness + 2k_view_cap; experiment concluded 2026-05-31); discover_freshness=${FRESHNESS_HOURS_DISCOVER}h"
|
package/skill/stats-linkedin.sh
CHANGED
|
@@ -55,7 +55,7 @@ set -euo pipefail
|
|
|
55
55
|
# State: ~/.claude/social-autoposter/linkedin.killswitch
|
|
56
56
|
# Clear: python3 ~/social-autoposter/scripts/linkedin_killswitch.py clear
|
|
57
57
|
if [ -f "$HOME/.claude/social-autoposter/linkedin.killswitch" ]; then
|
|
58
|
-
echo "[$(date +%H:%M:%
|
|
58
|
+
echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] LINKEDIN_KILLSWITCH active. Aborting LinkedIn pipeline."
|
|
59
59
|
echo " Re-auth LinkedIn in harness Chrome, then: python3 ~/social-autoposter/scripts/linkedin_killswitch.py clear"
|
|
60
60
|
exit 0
|
|
61
61
|
fi
|
|
@@ -85,7 +85,7 @@ SCRAPER_TIMEOUT_SEC=900 # 15min outer gtimeout. Inner JS deadline now defaults
|
|
|
85
85
|
|
|
86
86
|
mkdir -p "$LOG_DIR"
|
|
87
87
|
LOG_FILE="$LOG_DIR/stats-linkedin-$(date +%Y-%m-%d_%H%M%S).log"
|
|
88
|
-
log() { echo "[$(date +%H:%M:%
|
|
88
|
+
log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*" | tee -a "$LOG_FILE"; }
|
|
89
89
|
|
|
90
90
|
RUN_START=$(date +%s)
|
|
91
91
|
log "=== LinkedIn Stats Run (unified): $(date) ==="
|
package/skill/stats.sh
CHANGED
|
@@ -87,7 +87,7 @@ mkdir -p "$LOG_DIR"
|
|
|
87
87
|
LOG_TAG="${PLATFORM:-all}"
|
|
88
88
|
LOGFILE="$LOG_DIR/stats-${LOG_TAG}-$(date +%Y-%m-%d_%H%M%S).log"
|
|
89
89
|
|
|
90
|
-
log() { echo "[$(date +%H:%M:%
|
|
90
|
+
log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*" >> "$LOGFILE"; echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*"; }
|
|
91
91
|
|
|
92
92
|
RUN_START=$(date +%s)
|
|
93
93
|
STEP1_EXIT=0; STEP2_EXIT=0; STEP3_EXIT=0; STEP4_EXIT=0
|