From 495cae45a69f8bf69d3af9325b25debe987af8fe Mon Sep 17 00:00:00 2001 From: Doug Hatcher Date: Mon, 4 May 2026 14:45:13 -0400 Subject: [PATCH] fix(slack-bot): match all open blog PRs in #N resolver, not just drafts pr-creator.js opens posts ready-for-review (commit 5ddb53c removed --draft), but getLatestIdeaBatch was filtering on pr.draft === true so the batch came back empty and "#3 ..." replies fell through to the slug-matching parseIntent path, which failed to find unmerged drafts in main. Drop the draft requirement; identify the batch purely by the blog/YYYY-MM-DD- branch prefix instead. Co-Authored-By: Claude Opus 4.7 (1M context) --- apps/slack-bot/src/services/github.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/apps/slack-bot/src/services/github.js b/apps/slack-bot/src/services/github.js index 18adf52..563cc7b 100644 --- a/apps/slack-bot/src/services/github.js +++ b/apps/slack-bot/src/services/github.js @@ -155,10 +155,11 @@ export async function listPRs(repo, token, headPrefix) { } /** - * Return the latest editorial-loop batch of draft blog PRs, ordered to match + * Return the latest editorial-loop batch of open blog PRs, ordered to match * the numbered Slack post (idea 1 first). Groups by the YYYY-MM-DD prefix * embedded in the `blog/-` branch name and picks the most recent - * date, then sorts that group by PR creation time ascending. + * date, then sorts that group by PR creation time ascending. Includes both + * draft and ready-for-review PRs since pr-creator.js opens them as the latter. */ export async function getLatestIdeaBatch(repo, token) { const prs = await ghFetch(`/repos/${repo}/pulls?state=open&per_page=50`, {}, token); @@ -166,10 +167,10 @@ export async function getLatestIdeaBatch(repo, token) { const m = pr.head.ref.match(/^blog\/(\d{4}-\d{2}-\d{2})-/); return m ? m[1] : null; }; - const drafts = prs.filter(pr => pr.draft && dateOf(pr)); - if (drafts.length === 0) return []; - const latestDate = drafts.map(dateOf).sort().pop(); - return drafts + const blogPRs = prs.filter(pr => dateOf(pr)); + if (blogPRs.length === 0) return []; + const latestDate = blogPRs.map(dateOf).sort().pop(); + return blogPRs .filter(pr => dateOf(pr) === latestDate) .sort((a, b) => new Date(a.created_at) - new Date(b.created_at)); }