@m13v/s4l 1.7.4-rc.34 → 1.7.4-rc.36
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/version.json +2 -2
- package/mcp/manifest.json +1 -1
- package/mcp/package.json +1 -1
- package/package.json +1 -1
- package/scripts/twitter_scan.py +51 -0
- package/scripts/watchdog_hung_runs.py +11 -3
- package/skill/lib/twitter-backend.sh +38 -13
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.36",
|
|
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.
|
|
3
|
+
"version": "1.7.4-rc.36",
|
|
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
package/scripts/twitter_scan.py
CHANGED
|
@@ -55,6 +55,8 @@ import json
|
|
|
55
55
|
import os
|
|
56
56
|
import pathlib
|
|
57
57
|
import re
|
|
58
|
+
import sys
|
|
59
|
+
import threading
|
|
58
60
|
import time
|
|
59
61
|
import urllib.parse
|
|
60
62
|
|
|
@@ -245,6 +247,40 @@ def _navigate(url: str) -> None:
|
|
|
245
247
|
new_tab(url)
|
|
246
248
|
|
|
247
249
|
|
|
250
|
+
# Per-query stall guard (2026-07-13). The daemon helpers (goto_url/js) relay
|
|
251
|
+
# CDP through the harness daemon; against a half-wedged Chrome those calls can
|
|
252
|
+
# hang far past any useful budget, and one stuck query froze a Phase 1 scan at
|
|
253
|
+
# "scan 0 · 23m" while holding the browser lock — the entry wedge check can't
|
|
254
|
+
# help because the NEXT cycle can't start until this one dies. Self-heal from
|
|
255
|
+
# inside instead: if a single scan() call exceeds the deadline, print a loud
|
|
256
|
+
# marker, stamp the wedge strike file (so the next cycle's two-strike gate in
|
|
257
|
+
# twitter-backend.sh converges to a kill+relaunch if Chrome is still sick),
|
|
258
|
+
# and hard-exit the scan process so the cycle fails fast and releases the
|
|
259
|
+
# lock. A healthy query completes in well under a minute; 240s is generous.
|
|
260
|
+
_SCAN_QUERY_DEADLINE_S = float(os.environ.get("S4L_SCAN_QUERY_DEADLINE_S", "240"))
|
|
261
|
+
_WEDGE_STRIKE_FILE = "/tmp/s4l_cdp_wedge_strike_9555" # matches twitter-backend.sh
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
def _arm_stall_guard(query: str):
|
|
265
|
+
def _fire():
|
|
266
|
+
sys.stderr.write(
|
|
267
|
+
f"[twitter_scan] SCAN_STALL_ABORT query={query!r} "
|
|
268
|
+
f"deadline={_SCAN_QUERY_DEADLINE_S:.0f}s — CDP call hung (wedged "
|
|
269
|
+
"Chrome); stamping wedge strike and aborting the scan process\n"
|
|
270
|
+
)
|
|
271
|
+
sys.stderr.flush()
|
|
272
|
+
try:
|
|
273
|
+
pathlib.Path(_WEDGE_STRIKE_FILE).touch()
|
|
274
|
+
except OSError:
|
|
275
|
+
pass
|
|
276
|
+
os._exit(75) # EX_TEMPFAIL: cycle fails fast, lock + slot free up
|
|
277
|
+
|
|
278
|
+
t = threading.Timer(_SCAN_QUERY_DEADLINE_S, _fire)
|
|
279
|
+
t.daemon = True
|
|
280
|
+
t.start()
|
|
281
|
+
return t
|
|
282
|
+
|
|
283
|
+
|
|
248
284
|
def scan(
|
|
249
285
|
query: str,
|
|
250
286
|
project: str,
|
|
@@ -257,6 +293,21 @@ def scan(
|
|
|
257
293
|
###TWEETS_BEGIN###/###TWEETS_END### sentinels for the scan model to relay
|
|
258
294
|
into StructuredOutput; also returns the kept list so direct callers (tests,
|
|
259
295
|
future shell-driven invocations) can consume it without parsing stdout."""
|
|
296
|
+
_stall_guard = _arm_stall_guard(query)
|
|
297
|
+
try:
|
|
298
|
+
return _scan_inner(query, project, search_topic, freshness_hours, skip_ids, settle_seconds)
|
|
299
|
+
finally:
|
|
300
|
+
_stall_guard.cancel()
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
def _scan_inner(
|
|
304
|
+
query: str,
|
|
305
|
+
project: str,
|
|
306
|
+
search_topic: str,
|
|
307
|
+
freshness_hours: int = 6,
|
|
308
|
+
skip_ids=None,
|
|
309
|
+
settle_seconds: float = 4.0,
|
|
310
|
+
) -> list:
|
|
260
311
|
skip = {str(s) for s in (skip_ids or [])}
|
|
261
312
|
url = _build_url(query, int(freshness_hours))
|
|
262
313
|
_navigate(url)
|
|
@@ -17,7 +17,15 @@ from pathlib import Path
|
|
|
17
17
|
|
|
18
18
|
REPO = Path("/Users/matthewdi/social-autoposter")
|
|
19
19
|
LOG_RUN_PY = REPO / "scripts" / "log_run.py"
|
|
20
|
-
|
|
20
|
+
# Both homes of skill/*.sh: the operator repo AND the installed-app package.
|
|
21
|
+
# The single operator-repo marker left every kicker-driven cycle (which runs
|
|
22
|
+
# from ~/.social-autoposter-mcp/repo/package/skill/) invisible to this
|
|
23
|
+
# watchdog — a scan stuck on a half-wedged Chrome sat 23+ minutes at zero
|
|
24
|
+
# progress with nothing entitled to kill it (2026-07-13).
|
|
25
|
+
SKILL_PATH_MARKERS = (
|
|
26
|
+
"/social-autoposter/skill/",
|
|
27
|
+
"/.social-autoposter-mcp/repo/package/skill/",
|
|
28
|
+
)
|
|
21
29
|
MAX_AGE_SEC = 45 * 60
|
|
22
30
|
|
|
23
31
|
# --- L2: browser-lock liveness (2026-07-13) ----------------------------------
|
|
@@ -212,12 +220,12 @@ def list_skill_shell_processes():
|
|
|
212
220
|
ppid = int(ppid_s)
|
|
213
221
|
except ValueError:
|
|
214
222
|
continue
|
|
215
|
-
if
|
|
223
|
+
if not any(m in command for m in SKILL_PATH_MARKERS):
|
|
216
224
|
continue
|
|
217
225
|
script_name = None
|
|
218
226
|
tokens = command.split()
|
|
219
227
|
for tok in tokens:
|
|
220
|
-
if tok.endswith(".sh") and
|
|
228
|
+
if tok.endswith(".sh") and any(m in tok for m in SKILL_PATH_MARKERS):
|
|
221
229
|
script_name = os.path.basename(tok)
|
|
222
230
|
break
|
|
223
231
|
if not script_name:
|
|
@@ -232,22 +232,47 @@ ensure_twitter_browser_for_backend() {
|
|
|
232
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
|
+
# TWO-STRIKE gate (2026-07-13): one failed handshake is NOT proof of a
|
|
236
|
+
# wedge. Under heavy system load (observed at loadavg ~18) a perfectly
|
|
237
|
+
# healthy Chrome blows the 8s Playwright attach budget, and a
|
|
238
|
+
# single-failure kill produced 3 false wedge-kills in one day on the
|
|
239
|
+
# operator Mac — each one a relaunch flash plus an "Aw, Snap" corpse
|
|
240
|
+
# tab from the SIGKILLed renderer. First failure: stamp a strike file
|
|
241
|
+
# and proceed WITHOUT killing (a truly wedged Chrome makes the cycle's
|
|
242
|
+
# own pre-flight fail loudly right after, so nothing silently hangs).
|
|
243
|
+
# Second consecutive failure within 30 minutes: genuinely wedged, kill
|
|
244
|
+
# + relaunch. A passing check clears any stale strike.
|
|
245
|
+
local _strike="/tmp/s4l_cdp_wedge_strike_9555"
|
|
235
246
|
if ! _ready_verdict=$(_bh_cdp_ready "$_BH_DEFAULT_URL"); then
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
+
if [ -z "$(find "$_strike" -mmin -30 2>/dev/null)" ]; then
|
|
248
|
+
touch "$_strike"
|
|
249
|
+
echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] Harness Chrome failed the CDP handshake check (${_ready_verdict:-no verdict}); first strike — NOT killing (loaded-machine tolerance). Second consecutive failure within 30m triggers the wedge heal." >&2
|
|
250
|
+
echo "twitter_cdp_wedge: detected url=$_BH_DEFAULT_URL action=first_strike" >&2
|
|
251
|
+
_bh_record_cdp_health wedge_first_strike "$_ready_verdict"
|
|
252
|
+
# Fall through WITHOUT killing: session restore + tab cleanup
|
|
253
|
+
# below still run.
|
|
254
|
+
else
|
|
255
|
+
rm -f "$_strike" 2>/dev/null || true
|
|
256
|
+
_need_launch=1; _launch_reason="cdp_wedge"
|
|
257
|
+
echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] Harness Chrome WEDGED on port 9555 (second consecutive handshake failure: ${_ready_verdict:-no verdict}); killing and relaunching..." >&2
|
|
258
|
+
# Machine-greppable marker (same stderr-marker convention as
|
|
259
|
+
# twitter_access_gate; bin/server.js parses these).
|
|
260
|
+
echo "twitter_cdp_wedge: detected url=$_BH_DEFAULT_URL action=restart" >&2
|
|
261
|
+
_bh_record_cdp_health wedge_restart "$_ready_verdict"
|
|
262
|
+
local _wedge_pids
|
|
247
263
|
_wedge_pids=$(pgrep -f -- "--user-data-dir=$_bh_prof_dir " 2>/dev/null || true)
|
|
248
|
-
[ -n "$_wedge_pids" ]
|
|
249
|
-
|
|
264
|
+
if [ -n "$_wedge_pids" ]; then
|
|
265
|
+
kill $_wedge_pids 2>/dev/null || true
|
|
266
|
+
sleep 2
|
|
267
|
+
_wedge_pids=$(pgrep -f -- "--user-data-dir=$_bh_prof_dir " 2>/dev/null || true)
|
|
268
|
+
[ -n "$_wedge_pids" ] && { kill -9 $_wedge_pids 2>/dev/null || true; sleep 1; }
|
|
269
|
+
rm -f "$_bh_prof_dir/SingletonLock" "$_bh_prof_dir/SingletonSocket" "$_bh_prof_dir/SingletonCookie" 2>/dev/null || true
|
|
270
|
+
fi
|
|
250
271
|
fi
|
|
272
|
+
else
|
|
273
|
+
# Healthy handshake — clear any earlier strike so isolated blips
|
|
274
|
+
# never accumulate into a kill.
|
|
275
|
+
rm -f "$_strike" 2>/dev/null || true
|
|
251
276
|
fi
|
|
252
277
|
fi
|
|
253
278
|
if [ "$_need_launch" = 1 ]; then
|