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

Abierto
#1,781 0 comentarios 0 reacciones 0 asignados Ver en GitHub
bug p2
Lenguaje dominante
TypeScript
Estrellas
8.9k
Forks
2.1k
Métricas de merge de PR
Métricas de PR pendientes

Descripción

**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.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.