From e6e6c544aeedee56f09dbd4ede2780015727ab08 Mon Sep 17 00:00:00 2001 From: Philip Taron Date: Tue, 20 Jan 2026 05:43:14 -0800 Subject: [PATCH] ci/github-script/bot: handle deleted maintainer accounts gracefully When a maintainer deletes their GitHub account, the bot would crash with a 404 error when trying to fetch their user info via `/user/{id}`. This caused the scheduled bot workflow to fail repeatedly until manual intervention (e.g., closing/reopening the affected PR to clear the requested reviewer). Fix by returning null from getUser() for 404 responses and filtering out null users when building the reviewers list. --- ci/github-script/bot.js | 5 +++++ ci/github-script/reviewers.js | 12 +++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/ci/github-script/bot.js b/ci/github-script/bot.js index ffa71892c1e8..35553b443c87 100644 --- a/ci/github-script/bot.js +++ b/ci/github-script/bot.js @@ -133,6 +133,11 @@ module.exports = async ({ github, context, core, dry }) => { id, }) .then((resp) => resp.data) + .catch((e) => { + // User may have deleted their account + if (e.status === 404) return null + throw e + }) } return users[id] diff --git a/ci/github-script/reviewers.js b/ci/github-script/reviewers.js index b581f3c20755..d10b9f6a98e2 100644 --- a/ci/github-script/reviewers.js +++ b/ci/github-script/reviewers.js @@ -42,9 +42,15 @@ async function handleReviewers({ } const users = new Set([ - ...(await Promise.all( - maintainers.map(async (id) => (await getUser(id)).login.toLowerCase()), - )), + ...( + await Promise.all( + maintainers.map(async (id) => { + const user = await getUser(id) + // User may have deleted their account + return user?.login?.toLowerCase() + }), + ) + ).filter(Boolean), ...owners .filter((handle) => handle && !handle.includes('/')) .map((handle) => handle.toLowerCase()),