anthropics / anthropics/claude-code-action

use_sticky_comment creates a new comment on PRs with more than 30 comments: the sticky lookup only reads the first page

Ouverte
#1,781 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
bug p2
Langage dominant
TypeScript
Étoiles
8.9k
Forks
2.1k
Métriques de merge des PR
Métriques de PR en attente

Description

**Type:** bug
**Severity:** low-medium (feature silently stops working on busy PRs)
**Area:** `src/github/operations/comments/create-initial.ts`
**Effort:** trivial

## Summary

`action.yml` documents `use_sticky_comment` as "Use just one comment to deliver issue/PR comments". `createInitialComment` looks for the existing Claude comment with a single unpaginated `octokit.rest.issues.listComments` call (default 30 per page) and runs `.find` over `comments.data` of page 1 only (`create-initial.ts` lines 36-49). On a PR with more than 30 comments where Claude's comment is not among the first 30, every run creates a new comment.

`src/github/data/fetcher.ts` (around lines 136-145) already uses `octokit.paginate` for the same class of call, and #1629 fixed the same pagination problem in the CI server.

## Reproduction

Running the real `createInitialComment` with `createOctokit` against a fake REST API that serves 35 comments with the Claude comment at position 33:

```
requests: [ "GET /repos/o/r/issues/7/comments", "POST /repos/o/r/issues/7/comments" ]
result comment id: 9999 (a NEW comment was created; sticky not honored)
```

## Expected

`PATCH /repos/o/r/issues/comments/4242` (the existing comment) and `comment_id` output `4242`.

## Root cause

No pagination: `listComments` without `per_page`, and `.find` on the first page only.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.