AI agent skill that researches any topic across Reddit, X, YouTube, HN, Polymarket, and the web - then synthesizes a grounded summary
Python ai-promptsai-skillblueskyclaudeclaude-codeclawhubdeep-researchhackernewsinstagramopenclawpolymarketrecencyredditresearchsocial-mediatiktoktrendstwitterweb-searchyoutube
fix: setup wizard missing CT0 and check-config.sh miscounts X with only AUTH_TOKEN (#502)
SAI MOHANEESH7d90275d57fa
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 22185e95..4a1618c8 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -22,6 +22,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0- First-run setup wizard in SKILL.md now references the existing Python setup wizard (`last30days.py setup`) instead of the missing `nux-wizard.md` file, so first-run setup actually runs on new installs. ([#574](https://github.com/mvanhorn/last30days-skill/issues/574))- `check-config.sh` no longer exits 1 on the ScrapeCreators-configured path when no prior run exists (empty `LAST_RUN_LINE`) — swapped `&&` guard for an `if` block that always exits cleanly ([#463](https://github.com/mvanhorn/last30days-skill/issues/463))- `check-config.sh` no longer exits 1 when a `.env` value contains an unbalanced quote — replaced `xargs` (which interprets quotes) with `sed` for whitespace trimming in `load_env_vars` ([#506](https://github.com/mvanhorn/last30days-skill/issues/506))+- X/Twitter `.env` template now includes `CT0` alongside `AUTH_TOKEN` in the example skeleton ([CONFIGURATION.md](CONFIGURATION.md)), and the just-in-time unlock wizard offers AUTH_TOKEN/CT0 cookie entry ([#396](https://github.com/mvanhorn/last30days-skill/issues/396))+- `check-config.sh` no longer counts X as an active source when only `AUTH_TOKEN` is set without `CT0` — both cookies are now required to credit X in the source count ([#396](https://github.com/mvanhorn/last30days-skill/issues/396))- Firefox cookie extraction now falls back to scanning non-default profiles when the default profile has no matching X cookies, fixing multi-profile setups where login lives on a non-default profile ([#498](https://github.com/mvanhorn/last30days-skill/issues/498))- `subproc.py` `run_with_timeout()` now guards `os.killpg` / `os.getpgid` with `hasattr`, preventing an uncaught `AttributeError` crash when a subprocess times out on Windows where these functions don't exist ([#527](https://github.com/mvanhorn/last30days-skill/issues/527))- Entity-grounding rerank demotion now keys on the head token of the primary entity instead of requiring the full multi-word phrase as a contiguous substring. A high-engagement on-entity item (e.g. a 323-pt HN thread titled "Stripe is friendly to 'friendly fraud'") is no longer demoted to score 0 on a `Stripe payments` query just because it lacks the trailing search-hint word. The intended demotion still fires for items that never name the brand at all. The keyless Reddit comment-enrichment slot selection (`_slot_priority`), which mirrors this signal, was updated to the same head-token grounding so the two paths stay consistent.diff --git a/CONFIGURATION.md b/CONFIGURATION.mdindex 77628a9f..5b1cf7df 100644--- a/CONFIGURATION.md+++ b/CONFIGURATION.md@@ -82,8 +82,11 @@ SCRAPECREATORS_API_KEY=<your-scrapecreators-key>INCLUDE_SOURCES=tiktok,instagram# X authentication (one option only)-XAI_API_KEY=<your-xai-key>-# OR cookie-jar (no key needed; logs in via your browser session)+AUTH_TOKEN=<your-auth-token>+CT0=<your-ct0-token>+# OR xAI API key (paid)+# XAI_API_KEY=<your-xai-key>+# OR cookie-jar (free; logs in via your browser session)# FROM_BROWSER=firefox# Blueskydiff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.mdindex 70a73225..734e01e6 100644--- a/CONTRIBUTORS.md+++ b/CONTRIBUTORS.md@@ -54,12 +54,7 @@ v3 has durable watchlist with multi-source storage and extended time windows.## Past Contributors-- [@23241a6749](https://github.com/23241a6749) - Windows cp1252 encoding fix ([#550](https://github.com/mvanhorn/last30days-skill/pull/550)), Windows killpg guard ([#552](https://github.com/mvanhorn/last30days-skill/pull/552)), browser cookie message clarity ([#387](https://github.com/mvanhorn/last30days-skill/issues/387))+- [@23241a6749](https://github.com/23241a6749) - Windows cp1252 fixes ([#549](https://github.com/mvanhorn/last30days-skill/pull/549)); Windows killpg guard ([#552](https://github.com/mvanhorn/last30days-skill/pull/552)); browser promo clarity ([#387](https://github.com/mvanhorn/last30days-skill/pull/561)); setup wizard fix ([#574](https://github.com/mvanhorn/last30days-skill/pull/578)); check-config xargs fix ([#506](https://github.com/mvanhorn/last30days-skill/issues/506)); check-config clean-exit on missing last-run ([#463](https://github.com/mvanhorn/last30days-skill/issues/463)); Firefox multi-profile cookies ([#498](https://github.com/mvanhorn/last30days-skill/issues/498)); X/Twitter CT0 template ([#396](https://github.com/mvanhorn/last30days-skill/issues/396))- [@JosephOIbrahim](https://github.com/JosephOIbrahim) - Windows Unicode fix ([#17](https://github.com/mvanhorn/last30days-skill/pull/17))- [@levineam](https://github.com/levineam) - Model fallback for unverified orgs ([#16](https://github.com/mvanhorn/last30days-skill/pull/16))- [@jonthebeef](https://github.com/jonthebeef) - Early testing and feedback-- [@23241a6749](https://github.com/23241a6749) - Windows cp1252 fixes: utf-8 plan-file reads, skill_meta version-detection encoding, MSYS noacl permission check skip ([#549](https://github.com/mvanhorn/last30days-skill/pull/549)); first-run setup wizard fix: SKILL.md references existing Python setup wizard instead of missing nux-wizard.md ([#574](https://github.com/mvanhorn/last30days-skill/pull/574))-- [@23241a6749](https://github.com/23241a6749) - check-config.sh clean-exit on missing last-run.json ([#463](https://github.com/mvanhorn/last30days-skill/issues/463))-- [@23241a6749](https://github.com/23241a6749) - check-config.sh xargs unterminated quote fix ([#506](https://github.com/mvanhorn/last30days-skill/issues/506))-- [@23241a6749](https://github.com/23241a6749) - Firefox multi-profile cookie fallback ([#498](https://github.com/mvanhorn/last30days-skill/issues/498))-- [@23241a6749](https://github.com/23241a6749) - Windows subprocess timeout fix: guard os.killpg/os.getpgid with hasattr in subproc.py ([#527](https://github.com/mvanhorn/last30days-skill/issues/527))diff --git a/hooks/scripts/check-config.sh b/hooks/scripts/check-config.shindex 21a85772..6e9bbb01 100755--- a/hooks/scripts/check-config.sh+++ b/hooks/scripts/check-config.sh@@ -122,7 +122,10 @@ fi# Setup done but check for ScrapeCreatorsHAS_SCRAPECREATORS="${ENV_SCRAPECREATORS_API_KEY:-${SCRAPECREATORS_API_KEY:-}}"-HAS_X="${ENV_AUTH_TOKEN:-${AUTH_TOKEN:-}}"+HAS_X=""+if [[ -n "${ENV_AUTH_TOKEN:-${AUTH_TOKEN:-}}" && -n "${ENV_CT0:-${CT0:-}}" ]]; then+ HAS_X="yes"+fiHAS_XAI="${ENV_XAI_API_KEY:-${XAI_API_KEY:-}}"HAS_YTDLP=""if command -v yt-dlp &>/dev/null; thendiff --git a/skills/last30days/SKILL.md b/skills/last30days/SKILL.mdindex 750cb219..94d0947e 100644--- a/skills/last30days/SKILL.md+++ b/skills/last30days/SKILL.md@@ -1477,6 +1477,7 @@ If the research output contains a `**🔍 Research Coverage:**` block, render itQuestion: "X/Twitter wasn't searched. Want to unlock it?"Options:- "Scan my browser cookies (free)" - Get consent, run cookie scan, write BROWSER_CONSENT=true + FROM_BROWSER=auto to .env+- "I have AUTH_TOKEN and CT0 from my browser" - Ask them to paste each value, then write AUTH_TOKEN=<value>\nCT0=<value> to .env- "I have an xAI API key" - Ask them to paste it, write XAI_API_KEY to .env- "Skip for now"diff --git a/tests/test_last_run_state.py b/tests/test_last_run_state.pyindex e8c8885b..58806d11 100644--- a/tests/test_last_run_state.py+++ b/tests/test_last_run_state.py@@ -1,6 +1,7 @@import ioimport jsonimport os+import reimport subprocessimport sysimport tempfile@@ -133,6 +134,70 @@ class LastRunStateTests(unittest.TestCase):self.assertEqual(result.returncode, 0, result.stderr)self.assertIn("Ready —", result.stdout)+ @staticmethod+ def _extract_source_count(output: str) -> int:+ match = re.search(r"Ready — (\d+) sources active", output)+ if not match:+ raise AssertionError(f"Could not find source count in: {repr(output[:200])}")+ return int(match.group(1))++ def _run_hook(self, tmp: str, env_overrides: dict[str, str]) -> subprocess.CompletedProcess[str]:+ env = os.environ.copy()+ env["HOME"] = str(Path(tmp) / "home")+ env["SETUP_COMPLETE"] = "true"+ # Strip credentials that could bleed in from the test-runner environment+ # and corrupt source-count baseline comparisons.+ for key in ("AUTH_TOKEN", "CT0", "XAI_API_KEY", "BSKY_HANDLE", "EXA_API_KEY", "SCRAPECREATORS_API_KEY"):+ env.pop(key, None)+ env.update(env_overrides)+ return subprocess.run(+ ["bash", "hooks/scripts/check-config.sh"],+ cwd=REPO_ROOT,+ env=env,+ capture_output=True,+ text=True,+ check=False,+ )++ def test_x_not_counted_with_only_auth_token(self):+ with tempfile.TemporaryDirectory() as tmp:+ neither = self._extract_source_count(+ self._run_hook(tmp, {}).stdout+ )+ only_auth = self._extract_source_count(+ self._run_hook(tmp, {"AUTH_TOKEN": "test_auth"}).stdout+ )+ self.assertEqual(+ only_auth, neither,+ "X should not be counted when only AUTH_TOKEN is set (CT0 missing)",+ )++ def test_x_not_counted_with_only_ct0(self):+ with tempfile.TemporaryDirectory() as tmp:+ neither = self._extract_source_count(+ self._run_hook(tmp, {}).stdout+ )+ only_ct0 = self._extract_source_count(+ self._run_hook(tmp, {"CT0": "test_ct0"}).stdout+ )+ self.assertEqual(+ only_ct0, neither,+ "X should not be counted when only CT0 is set (AUTH_TOKEN missing)",+ )++ def test_x_counted_when_both_auth_token_and_ct0(self):+ with tempfile.TemporaryDirectory() as tmp:+ neither = self._extract_source_count(+ self._run_hook(tmp, {}).stdout+ )+ both = self._extract_source_count(+ self._run_hook(tmp, {"AUTH_TOKEN": "test_auth", "CT0": "test_ct0"}).stdout+ )+ self.assertEqual(+ both, neither + 1,+ "X should add 1 source when both AUTH_TOKEN and CT0 are set",+ )+def test_hook_shows_last_run_when_json_exists(self):"""Script exits 0 and shows last-run summary when last-run.json exists."""with tempfile.TemporaryDirectory() as tmp: