fix: use configurable bot ID for sticky comment search#1123
Open
sxlehman-godaddy wants to merge 1 commit intoanthropics:mainfrom
Open
fix: use configurable bot ID for sticky comment search#1123sxlehman-godaddy wants to merge 1 commit intoanthropics:mainfrom
sxlehman-godaddy wants to merge 1 commit intoanthropics:mainfrom
Conversation
The sticky comment search in create-initial.ts had two bugs that caused it to never find existing comments to update, resulting in duplicate comments on every workflow run: 1. Hardcoded bot ID mismatch: A local constant CLAUDE_APP_BOT_ID (209825114, claude[bot]) shadowed the shared constant in constants.ts (41898282, github-actions[bot]). The search used 209825114 but the action's default bot_id is 41898282, so the ID match never succeeded. 2. Event type guard too restrictive: The guard required isPullRequestEvent(context), which only matched eventName === "pull_request". Comment-triggered workflows (issue_comment events on PRs) were excluded even though context.isPR was true. Fix: Use context.inputs.botId (configurable via the bot_id input) instead of the hardcoded constant, and widen the guard to also include issue_comment events on PRs. Review-thread reply behavior (pull_request_review_comment events) is unchanged. Adds regression tests for sticky comment routing across event types. Related: anthropics#759
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.
Problem
use_sticky_comment: "true"never finds existing comments to update, causing duplicate comments on every workflow run. Two independent bugs cause this:1. Hardcoded bot ID mismatch
create-initial.tsdefines a localCLAUDE_APP_BOT_ID = 209825114(claude[bot]) that shadows the shared constant inconstants.ts(41898282,github-actions[bot]). The comment search uses this value to matchcomment.user?.id, but the action's defaultbot_idis"41898282". Under the default configuration, the search never matches.Fix: Use
context.inputs.botId(configurable via thebot_idinput) instead of the hardcoded constant.2. Event type guard too restrictive
The sticky comment guard requires
isPullRequestEvent(context), which only returnstrueforeventName === "pull_request". Comment-triggered workflows (issue_commentevents on PRs) are excluded even thoughcontext.isPRistrue.Fix: Widen the guard to also match
issue_commentevents on PRs viaisIssueCommentEvent(context) && context.isPR. Review-thread reply behavior (pull_request_review_commentevents) is unchanged — they continue to usecreateReplyForReviewCommentas before.Changes
src/github/operations/comments/create-initial.ts: Removed hardcoded bot ID, usecontext.inputs.botId; widened sticky comment guard to include PR issue commentstest/create-initial-comment.test.ts: New test file with 5 regression tests covering sticky comment routing across event typesVerification
bun run typecheck— passesbun run format:check— passesbun test— 657/657 tests pass (5 new)Impact
Affects every user running with the default
github_tokenwho enablesuse_sticky_commentortrack_progress. Previously, duplicate comments were created on every workflow run.Related: #759 (same root cause — bot ID mismatch — different symptom: unsigned commits)