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(github): keep pinned repos whose newest release predates the window (#1264)

Matt Van Horn71716263b9c3
diff --git a/changelog.d/+github-coverage-count.fixed.md b/changelog.d/+github-coverage-count.fixed.md
new file mode 100644
index 00000000..3cb92d0a
--- /dev/null
+++ b/changelog.d/+github-coverage-count.fixed.md
@@ -0,0 +1 @@
+Fixed `--github-repo` project mode silently dropping the pinned repo when its newest GitHub release is older than the research window (Ghostty's newest release object is a 2022 nightly). The repo snapshot is now dated to the window end unless that release falls inside the window, so the live star count reaches the report and Source Coverage no longer shows "GitHub: 0 items (no results)" after the engine logged a project-mode result. A snapshot dated this way ranks on neutral freshness (the 10-90 scale midpoint) instead of maximum freshness, so the pinned repo card no longer sorts to #1 in every report; a repo whose newest release is inside the window keeps normal freshness.
diff --git a/skills/last30days/scripts/lib/github.py b/skills/last30days/scripts/lib/github.py
index c438cf69..769d7edb 100644
--- a/skills/last30days/scripts/lib/github.py
+++ b/skills/last30days/scripts/lib/github.py
@@ -894,7 +894,7 @@ def search_github_person(
"id": f"GH{idx}",
"title": f"{repo} ({stars_str} stars) - {pr_count} PRs merged",
"url": f"https://github.com/{repo}",
- "date": releases[0]["date"] if releases and releases[0].get("date") else to_date,
+ "date": _snapshot_date(releases, from_date, to_date),
"author": username,
"source": "github",
"score": stars,
@@ -909,6 +909,7 @@ def search_github_person(
"comment_count": pr_count,
"reactions": stars,
"is_pr": False,
+ "date_is_snapshot": not _has_in_window_release(releases, from_date, to_date),
},
})
@@ -952,7 +953,7 @@ def search_github_person(
"id": f"GH{idx}",
"title": f"{repo_name} ({stars_str} stars) - own project, {open_issues} open issues",
"url": f"https://github.com/{repo_name}",
- "date": releases[0]["date"] if releases and releases[0].get("date") else to_date,
+ "date": _snapshot_date(releases, from_date, to_date),
"author": username,
"source": "github",
"score": stars,
@@ -967,6 +968,7 @@ def search_github_person(
"comment_count": open_issues,
"reactions": stars,
"is_pr": False,
+ "date_is_snapshot": not _has_in_window_release(releases, from_date, to_date),
},
})
@@ -1156,6 +1158,29 @@ def _enrich_own_repo(repo: str, token: str) -> Dict[str, Any]:
# Project-mode search: fetch comprehensive data for specific repos
# ---------------------------------------------------------------------------
+def _snapshot_date(releases: List[Dict[str, Any]], from_date: str, to_date: str) -> str:
+ """Date for a live repo snapshot item (stars, issues, PRs read now).
+
+ The newest release's date when it falls in the window, else ``to_date``.
+ An older release date would make the report's date filter drop a repo the
+ user pinned: Ghostty's newest release object is its 2022 "tip" nightly.
+ """
+ if _has_in_window_release(releases, from_date, to_date):
+ return releases[0]["date"]
+ return to_date
+
+
+def _has_in_window_release(releases: List[Dict[str, Any]], from_date: str, to_date: str) -> bool:
+ """True when the newest release date is a real in-window event.
+
+ False means ``_snapshot_date`` fell back to ``to_date``: that date keeps the
+ item through the date filter but says nothing about recency, so the item is
+ marked ``date_is_snapshot`` and ranks on neutral freshness.
+ """
+ release_date = releases[0].get("date") if releases else None
+ return bool(release_date and from_date <= release_date <= to_date)
+
+
def search_github_project(
repos: List[str],
from_date: str,
@@ -1233,7 +1258,7 @@ def search_github_project(
"id": f"GH{idx + 1}",
"title": f"{repo} ({stars_str} stars) - {open_issues} open issues",
"url": f"https://github.com/{repo}",
- "date": releases[0]["date"] if releases and releases[0].get("date") else to_date,
+ "date": _snapshot_date(releases, from_date, to_date),
"author": repo.split("/")[0],
"source": "github",
"score": stars,
@@ -1248,6 +1273,7 @@ def search_github_project(
"comment_count": open_issues,
"reactions": stars,
"is_pr": False,
+ "date_is_snapshot": not _has_in_window_release(releases, from_date, to_date),
"github_stars": {repo: stars},
},
})
diff --git a/skills/last30days/scripts/lib/normalize.py b/skills/last30days/scripts/lib/normalize.py
index a114f647..cae7cde1 100644
--- a/skills/last30days/scripts/lib/normalize.py
+++ b/skills/last30days/scripts/lib/normalize.py
@@ -1042,6 +1042,7 @@ def _normalize_github(
"labels": metadata.get("labels") or [],
"state": metadata.get("state", ""),
"is_pr": metadata.get("is_pr", False),
+ "date_is_snapshot": bool(metadata.get("date_is_snapshot")),
},
)
diff --git a/skills/last30days/scripts/lib/signals.py b/skills/last30days/scripts/lib/signals.py
index daab2915..e75a16ad 100644
--- a/skills/last30days/scripts/lib/signals.py
+++ b/skills/last30days/scripts/lib/signals.py
@@ -89,6 +89,11 @@ def freshness(
reference_date: str | None = None,
max_days: int = 30,
) -> int:
+ # A live repo snapshot dated to the window end (no in-window release) has a
+ # read time, not an event date: rank it at the scale's midpoint instead of
+ # maximum freshness, or every pinned repo card sorts to #1.
+ if isinstance(item.metadata, dict) and item.metadata.get("date_is_snapshot"):
+ return 50
score = dates.recency_score(
item.published_at,
max_days=max_days,
diff --git a/tests/test_github.py b/tests/test_github.py
index 720e3503..82e19703 100644
--- a/tests/test_github.py
+++ b/tests/test_github.py
@@ -858,3 +858,66 @@ class TestSearchGithubQualifiers(unittest.TestCase):
if __name__ == "__main__":
unittest.main()
+
+
+def test_snapshot_date_uses_in_window_release_else_window_end():
+ from lib import github
+
+ window = ("2026-09-11", "2026-10-11")
+ assert github._snapshot_date([{"date": "2026-10-05"}], *window) == "2026-10-05"
+ assert github._snapshot_date([{"date": "2022-11-17"}], *window) == "2026-10-11"
+ assert github._snapshot_date([], *window) == "2026-10-11"
+ assert github._snapshot_date([{"date": None}], *window) == "2026-10-11"
+
+
+def _project_mode_items(release_date):
+ from lib import github
+
+ enrichment = {
+ "info": {"stars": 40000, "open_issues": 900, "description": "A terminal", "language": "Zig"},
+ "readme": "Ghostty terminal",
+ "releases": [{"name": "tip", "date": release_date, "body": ""}],
+ "top_issues": {},
+ }
+ with patch.object(github, "_resolve_token", return_value="t"), \
+ patch.object(github, "_enrich_project_repo", return_value=enrichment):
+ return github.search_github_project(
+ ["ghostty-org/ghostty"], "2026-09-11", "2026-10-11",
+ )
+
+
+def test_snapshot_repo_gets_neutral_freshness_not_window_end_boost():
+ # A pinned repo whose newest release predates the window is dated to_date
+ # so the date filter keeps it. That date is a read time, not an event: it
+ # must rank on neutral freshness, not pin to #1 on maximum freshness.
+ from lib import normalize, signals
+
+ window = ("2026-09-11", "2026-10-11")
+ raw = _project_mode_items("2022-11-17") + [{
+ "id": "GH9",
+ "title": "ghostty-org/ghostty issue",
+ "url": "https://github.com/ghostty-org/ghostty/issues/1",
+ "date": "2026-09-26",
+ "source": "github",
+ "relevance": 0.9,
+ "metadata": {"labels": ["project-mode"], "state": "open"},
+ }]
+ items = normalize.normalize_source_items("github", raw, *window)
+ assert len(items) == 2 # the date filter still keeps the snapshot
+ ranked = signals.annotate_stream(items, "ghostty", "balanced_recent", reference_date=window[1])
+ by_id = {item.item_id: item for item in ranked}
+ snapshot, mid = by_id["GH1"], by_id["GH9"]
+ assert snapshot.local_relevance == mid.local_relevance
+ assert snapshot.freshness == 50
+ assert snapshot.freshness <= mid.freshness # mid-window scores the 50 midpoint
+ assert snapshot.local_rank_score <= mid.local_rank_score + 0.10 # engagement only
+
+
+def test_in_window_release_keeps_normal_freshness():
+ from lib import normalize, signals
+
+ window = ("2026-09-11", "2026-10-11")
+ items = normalize.normalize_source_items("github", _project_mode_items("2026-10-09"), *window)
+ item = signals.annotate_stream(items, "ghostty", "balanced_recent", reference_date=window[1])[0]
+ assert item.published_at == "2026-10-09"
+ assert item.freshness > 80
diff --git a/tests/test_pipeline_v3.py b/tests/test_pipeline_v3.py
index 1ca58025..269936c9 100644
--- a/tests/test_pipeline_v3.py
+++ b/tests/test_pipeline_v3.py
@@ -1,4 +1,5 @@
import threading
+from datetime import datetime, timezone
import time
import unittest
@@ -1019,6 +1020,81 @@ class TestPinnedGithubPersonAuthority(unittest.TestCase):
)
+def _ghostty_enrichment(release_date: str) -> dict:
+ """GitHub fetch result for ghostty-org/ghostty as _enrich_project_repo
+ returns it. The newest release object is the 2022 "tip" nightly, so the
+ adapter's release date sits years outside any report window."""
+ return {
+ "info": {
+ "stars": 52000,
+ "open_issues": 2900,
+ "description": "Ghostty is a fast, feature-rich, cross-platform terminal emulator",
+ "language": "Zig",
+ },
+ "readme": "Ghostty is a terminal emulator.",
+ "releases": [
+ {"tag": "tip", "name": 'Ghostty Tip ("Nightly")', "date": release_date, "body": ""},
+ ],
+ "top_issues": {},
+ }
+
+
+class TestPinnedGithubProjectSurvivesDateWindow(unittest.TestCase):
+ """--github-repo pins a live repo snapshot. Ghostty's newest release object
+ is dated 2022, and dating the snapshot by it made the report's date filter
+ drop the pinned repo after "[GitHub] Project-mode returned 1 items",
+ leaving a false "GitHub: 0 items (no results)" in Source Coverage."""
+
+ _PLAN = {
+ "intent": "product",
+ "freshness_mode": "balanced_recent",
+ "cluster_mode": "none",
+ "subqueries": [
+ {
+ "label": "primary",
+ "search_query": "ghostty terminal",
+ "ranking_query": "What are people saying about Ghostty terminal?",
+ "sources": ["github"],
+ }
+ ],
+ "source_weights": {"github": 1.0},
+ }
+
+ def _run(self, release_date: str):
+ with patch("lib.github._resolve_token", return_value="dummy-token"), patch(
+ "lib.github._enrich_project_repo",
+ return_value=_ghostty_enrichment(release_date),
+ ), patch("lib.pipeline._retrieve_stream", return_value=([], {})):
+ return pipeline.run(
+ topic="Ghostty terminal",
+ config={"LAST30DAYS_REASONING_PROVIDER": "gemini"},
+ depth="default",
+ requested_sources=["github"],
+ mock=True,
+ external_plan=self._PLAN,
+ github_repos=["ghostty-org/ghostty"],
+ )
+
+ def test_out_of_window_release_still_reaches_report(self):
+ report = self._run("2022-11-17")
+
+ items = report.items_by_source.get("github", [])
+ self.assertEqual(["https://github.com/ghostty-org/ghostty"], [i.url for i in items])
+ self.assertNotEqual(schema.NO_RESULTS, report.source_status["github"].state)
+ # The live snapshot is dated to the window end, not the stale release;
+ # the release date stays visible in the snippet text.
+ self.assertEqual(report.range_to, items[0].published_at)
+
+ def test_in_window_release_keeps_release_date(self):
+ """Control: an in-window release still dates the item, so the date is
+ the only variable the out-of-window case exercises."""
+ today = datetime.now(timezone.utc).date().isoformat()
+ report = self._run(today)
+
+ items = report.items_by_source.get("github", [])
+ self.assertEqual(["https://github.com/ghostty-org/ghostty"], [i.url for i in items])
+ self.assertEqual(today, items[0].published_at)
+
class TestTrustpilotNeverRetriedAsThin(unittest.TestCase):
@patch("lib.pipeline._retrieve_stream")