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): count person-mode PRs inside the research window (#1286)

Jay Hemnani14674c239580
diff --git a/changelog.d/+github-person-window.fixed.md b/changelog.d/+github-person-window.fixed.md
new file mode 100644
index 00000000..5c7e76bc
--- /dev/null
+++ b/changelog.d/+github-person-window.fixed.md
@@ -0,0 +1 @@
+GitHub person mode (`--github-user`) now counts PRs created inside the research window only, so an `--as-of` run no longer reports every PR up to today, and its velocity summary names the real window length instead of always saying 30 days.
diff --git a/skills/last30days/scripts/lib/github.py b/skills/last30days/scripts/lib/github.py
index 769d7edb..fe3e221f 100644
--- a/skills/last30days/scripts/lib/github.py
+++ b/skills/last30days/scripts/lib/github.py
@@ -750,8 +750,8 @@ def search_github_person(
_log(f"Person-mode search for @{username} (since {from_date})")
# Phase 1: PR velocity via search API
- total_q = urllib.parse.quote(f"author:{username} type:pr created:>{from_date}")
- merged_q = urllib.parse.quote(f"author:{username} type:pr is:merged created:>{from_date}")
+ total_q = urllib.parse.quote(f"author:{username} type:pr created:{from_date}..{to_date}")
+ merged_q = urllib.parse.quote(f"author:{username} type:pr is:merged created:{from_date}..{to_date}")
total_url = f"{SEARCH_URL}?q={total_q}&per_page=1"
merged_url = f"{SEARCH_URL}?q={merged_q}&sort=reactions&order=desc&per_page=100"
@@ -823,7 +823,7 @@ def search_github_person(
num_repos = len(repo_pr_counts)
velocity_text = (
f"GitHub Person Profile: @{username}\n\n"
- f"CONTRIBUTION VELOCITY (last {(to_date > from_date) and 30 or 30} days)\n"
+ f"CONTRIBUTION VELOCITY (last {dates.days_ago(from_date, to_date)} days)\n"
f"- {merged_count} PRs merged across {num_repos} repos ({merge_rate}% merge rate)\n"
f"- {total_prs} total PRs submitted, {open_prs} still open\n"
)
diff --git a/tests/test_github.py b/tests/test_github.py
index 82e19703..a9d8ea71 100644
--- a/tests/test_github.py
+++ b/tests/test_github.py
@@ -511,6 +511,40 @@ class TestPersonPushEventsLane(unittest.TestCase):
self.assertEqual(items[0]["metadata"]["event_id"], "2")
+class TestPersonVelocityWindow(unittest.TestCase):
+ """Person-mode PR counts must cover the requested window, not up to today."""
+
+ def _run(self, from_date, to_date):
+ queries = []
+
+ def fetch(url, **kwargs):
+ if "search/issues" in url:
+ queries.append(
+ urllib.parse.parse_qs(urllib.parse.urlparse(url).query)["q"][0]
+ )
+ return {"total_count": 4, "items": []}
+ return []
+
+ with patch.object(github, "_resolve_token", return_value="t"), \
+ patch.object(github, "_fetch_json", side_effect=fetch):
+ items = github.search_github_person("kurt", from_date, to_date, token="t")
+ return queries, items
+
+ def test_pr_searches_end_at_window_end(self):
+ queries, _ = self._run("2026-05-31", "2026-06-30")
+
+ self.assertEqual(len(queries), 2)
+ for q in queries:
+ self.assertIn("created:2026-05-31..2026-06-30", q)
+ self.assertEqual(q.count("created:"), 1)
+
+ def test_velocity_label_uses_window_length(self):
+ _, items = self._run("2026-07-16", "2026-10-14")
+
+ self.assertIn("CONTRIBUTION VELOCITY (last 90 days)", items[0]["snippet"])
+
+
+
class TestStripSearchQualifiers(unittest.TestCase):
"""Planner-injected GitHub search qualifiers must never reach the query
builder: search_github appends its own created:>{from_date}, and two