fix: check allowed_bots before API call in checkHumanActor#916
Open
Dave-London wants to merge 1 commit intoanthropics:mainfrom
Open
fix: check allowed_bots before API call in checkHumanActor#916Dave-London wants to merge 1 commit intoanthropics:mainfrom
Dave-London wants to merge 1 commit intoanthropics:mainfrom
Conversation
Move the allowed_bots check (both wildcard "*" and specific bot list) before the octokit.users.getByUsername() API call. Bot accounts like github-merge-queue[bot] return 404 from the users API, causing the function to crash before the allowed_bots configuration is ever checked. Fixes anthropics#900 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
allowed_botscheck (wildcard*and specific bot list) before theoctokit.users.getByUsername()API callgithub-merge-queue[bot]that don't have regular GitHub user profilesProblem
checkHumanActorcallsoctokit.users.getByUsername()as its first action. Bot accounts likegithub-merge-queue[bot]return 404 from this API, causing the function to crash before theallowed_botsconfiguration is ever checked. This makesallowed_botsineffective for scheduled/cron workflows and any bot-triggered events.The GitHub workflow-level guard runs successfully, but the action fails with:
Changes
src/github/validation/actor.ts: Reordered to checkallowed_bots(wildcard and specific list) before making the API calltest/actor.test.ts: Added 3 tests with a mock that throws 404, verifying allowed bots bypass the API callTest plan
bun test test/actor.test.ts)bun run typecheck)bun run format:check)Fixes #900