Repository navigation
Conversation
createInitialComment looked for the existing sticky comment with a single unpaginated issues.listComments call, which returns only the first 30 comments. On PRs with more than 30 comments the Claude comment on a later page was never found, so use_sticky_comment created a new comment on every run instead of reusing the existing one. Fetch all comments with octokit.paginate (per_page: 100), matching how fetcher.ts already lists issue events, before searching for the existing comment. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This branch has not been deployed
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
With
use_sticky_commentenabled, a PR with more than 30 comments can get a second tracking comment even though one already exists. This happens because the lookup only reads the first page of comments.This change uses
octokit.paginate(withper_page: 100) to search every page before deciding whether to update the existing comment or create a new one.Closes #1781.
Tests
test/create-initial.test.tsuses the real Octokit client with an in-memoryfetchthat returns paged responses and honorspage,per_page, and theLinkheader. No requests reach GitHub. It covers:per_page: 100)The sticky-comment and no-match cases also check the comment ID written to
GITHUB_OUTPUT.Validation:
main(c0949c5), three of the four new tests fail and the non-sticky control passes. All four pass with the fix.bun test(970 pass),bun run typecheck, andbun run format:checkall pass.test/create-initial.test.tsandtest/modes/tag.test.ts, typecheck, and format check pass. The full suite was not rerun on Windows.The fix has not been tested end to end in a live workflow run.