Skip to content

AI agent skill that researches any topic across Reddit, X, YouTube, HN, Polymarket, and the web - then synthesizes a grounded summary

fix(doctor): detect GITHUB_TOKEN from process env (#782)

Sean Gearin98dd5dce292a
diff --git a/skills/last30days/scripts/lib/doctor.py b/skills/last30days/scripts/lib/doctor.py
index bb5f7ba5..51582c96 100644
--- a/skills/last30days/scripts/lib/doctor.py
+++ b/skills/last30days/scripts/lib/doctor.py
@@ -303,7 +303,7 @@ def _polymarket_record(config):
def _github_record(config):
- authed = bool(config.get("GITHUB_TOKEN") or shutil.which("gh"))
+ authed = bool(env.read_secret_env("GITHUB_TOKEN") or shutil.which("gh"))
detail = (
"authenticated tier (GITHUB_TOKEN or gh CLI)"
if authed
diff --git a/tests/test_doctor.py b/tests/test_doctor.py
index e78aa987..aa643693 100644
--- a/tests/test_doctor.py
+++ b/tests/test_doctor.py
@@ -172,6 +172,28 @@ class KeylessEnvironment(unittest.TestCase):
self.assertIn("last30days doctor", out)
+class GitHubAuthDetection(unittest.TestCase):
+ """GitHub doctor auth must mirror the real fetcher token source."""
+
+ def test_github_env_token_without_gh_reports_authenticated_tier(self):
+ with mock.patch.dict("os.environ", {"GITHUB_TOKEN": "dummy-github-secret-000"}), \
+ mock.patch("lib.doctor.shutil.which", return_value=None):
+ record = _build({})["sources"]["github"]
+
+ self.assertEqual("ok", record["tier"])
+ self.assertEqual("ok", record["status"])
+ self.assertEqual("authenticated tier (GITHUB_TOKEN or gh CLI)", record["detail"])
+
+ def test_github_without_env_token_or_gh_reports_unauthenticated_tier(self):
+ with mock.patch.dict("os.environ", {"GITHUB_TOKEN": ""}), \
+ mock.patch("lib.doctor.shutil.which", return_value=None):
+ record = _build({})["sources"]["github"]
+
+ self.assertEqual("ok", record["tier"])
+ self.assertEqual("ok", record["status"])
+ self.assertIn("unauthenticated REST tier", record["detail"])
+
+
class UnconfiguredXWithBrokenNode(unittest.TestCase):
"""F9 repro: no X configuration + a broken node runtime must read as
off/unconfigured with the cookie fix on bird — never a configured-but-