Skip to content

chore(meta): institutionalize PR ↔ Issue cross-reference pattern#159

Merged
adm01-debug merged 2 commits into
mainfrom
chore/improve-cross-references-and-templates
May 12, 2026
Merged

chore(meta): institutionalize PR ↔ Issue cross-reference pattern#159
adm01-debug merged 2 commits into
mainfrom
chore/improve-cross-references-and-templates

Conversation

@adm01-debug
Copy link
Copy Markdown
Owner

@adm01-debug adm01-debug commented May 12, 2026

🎯 Por que esta PR existe

Durante a auditoria pós-redeploy (sessão de hoje), descobri que issues criadas por PRs não tinham comentário automático linkando à PR de origem. Isso prejudica rastreabilidade depois de meses (e, no nosso caso, entre sessões de Claude).

Corrigi manualmente as 3 issues existentes (#151, #153, #155 com cross-refs para #152, #154 e #140-#142). Esta PR institucionaliza o padrão para que não aconteça de novo.

📋 Mudanças

1. .github/PULL_REQUEST_TEMPLATE.md — consolidação

🚨 Bug latente descoberto: existiam DOIS templates de PR:

  • .github/PULL_REQUEST_TEMPLATE.md (89 linhas, com seção de "Sistemas afetados")
  • .github/pull_request_template.md (32 linhas, minúscula, sem essa seção)

GitHub busca em ordem case-insensitive e usa um deles, sem garantia. Removido o duplicado em minúscula. Template consolidado tem o melhor dos dois + instruções explícitas sobre keywords (Closes/Fixes/Refs/Part of).

2. Templates de issue — campo "PR de origem"

Template Mudança
bug_report.yml Campo PR de origem opcional
feature_request.yml Campo PR de origem opcional
tracking.yml (NOVO) Campo PR de origem obrigatório + DoD obrigatório

O template de tracking é o padrão para issues como #151, #153, #155 (tech-debt / discussion / follow-up).

3. .github/workflows/cross-reference-issues.yml (NOVO, 179 linhas)

A peça que importa. Bot que automatiza cross-references:

Evento Ação
PR aberta com Closes #N Adiciona comentário na issue #N linkando à PR
PR mergeada Adiciona comentário final com merge SHA
Issue nova com PR de origem #N Adiciona comentário na PR #N referenciando a issue
  • Idempotente (usa markers HTML pra não duplicar)
  • Permissions mínimos (pull-requests: write, issues: write)
  • Cuida de edge cases: issue 404, PR é a própria issue, etc

4. CONTRIBUTING.md — nova seção

Documenta o padrão em prosa para humanos lerem. Explica:

  • Os 2 fluxos (PR descobre nova issue / PR resolve issue existente)
  • Por que importa (rastreabilidade entre sessões)
  • Aponta para o workflow

✅ Benefício esperado

Daqui pra frente, qualquer dev (ou Claude em sessão futura) que abrir uma issue #999 mencionando "PR de origem #998" vai automaticamente ver um comentário do bot na #998 dizendo "esta PR descobriu a issue #999". E vice-versa.

O problema que peguei manualmente hoje não vai mais acontecer.

🧪 Validação

  • ✅ Workflow YAML sem TABs (sanity check)
  • ✅ Templates YAML sem TABs
  • ✅ Diff de 7 arquivos, +347 −49

Sem mudança de código de runtime

Apenas .github/ e CONTRIBUTING.md. Risco zero pra produção.

Refs #151
Refs #153
Refs #155

Co-Authored-By: Claude noreply@anthropic.com

Summary by CodeRabbit

Melhorias

  • Chores

    • Atualizados templates de issue/feature com novo campo de referência ao PR de origem
    • Adicionado template dedicado para tracking/discussão
    • Refinado template de PR com novas seções de qualidade, testes e rollback; substituição do template antigo
    • Nova automação para ligação bidirecional entre PRs e issues (comentários e status)
  • Documentation

    • Atualizado CONTRIBUTING com regras obrigatórias de cross-referência entre PRs e issues

Aprendizado da sessão de redeploy: durante auditoria pós-T7, descobri que
issues criadas por PRs (#151, #153, #155) não tinham comentário automático
linkando à PR de origem, o que prejudica rastreabilidade depois de meses.

Corrigi manualmente as 3 issues existentes nesta sessão. Esta PR
institucionaliza o padrão para que NÃO ACONTEÇA DE NOVO no futuro.

Mudanças:

1. .github/PULL_REQUEST_TEMPLATE.md
   - Consolidado: existiam DOIS templates (PULL_REQUEST_TEMPLATE.md e
     pull_request_template.md em minúscula). GitHub buscava em ordem
     case-insensitive e podia usar qualquer um — bug latente.
   - Removido o duplicado em minúscula via 'git rm'.
   - Reescrito com instruções explícitas sobre keywords (Closes/Fixes/Refs/Part of)
     e padrão do projeto sobre cross-reference.

2. .github/ISSUE_TEMPLATE/bug_report.yml + feature_request.yml
   - Adicionado campo 'PR de origem' (input opcional)
   - Texto explica o padrão do projeto

3. .github/ISSUE_TEMPLATE/tracking.yml (NOVO)
   - Template específico para issues de tracking / tech-debt / discussion
   - Campo 'PR de origem' marcado como required (forma de impor o padrão)
   - DoD obrigatória, prioridade obrigatória, contexto obrigatório

4. .github/workflows/cross-reference-issues.yml (NOVO, 179 linhas)
   - Roda em pull_request e issues events
   - Quando PR menciona 'Closes #N' ou 'Refs #N':
     adiciona comentário automático na issue linkando à PR
   - Quando PR é mergeada: adiciona comentário final com merge SHA
   - Quando issue nova declara 'PR de origem #N':
     adiciona comentário na PR referenciando a issue
   - Idempotente (usa markers HTML pra evitar duplicação)
   - Permissions mínimos: pull-requests:write + issues:write

5. CONTRIBUTING.md
   - Nova seção '🔗 Cross-reference Issue ↔ PR (obrigatório)'
   - Explica os 2 fluxos (PR descobre issue / PR resolve issue)
   - Justifica o porquê (rastreabilidade pra futuras sessões)
   - Aponta para o workflow que automatiza

Benefício: o problema que peguei manualmente nesta sessão (issues #151 e #153
sem cross-reference para suas PRs #152 e #154) não vai mais acontecer porque
o bot detecta e adiciona automaticamente.

Refs #151
Refs #153
Refs #155

Co-Authored-By: Claude <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 12, 2026 20:20
@vercel
Copy link
Copy Markdown

vercel Bot commented May 12, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
promo-gifts Ready Ready Preview, Comment May 12, 2026 8:27pm

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 12, 2026

Caution

Review failed

Pull request was closed or merged during review

Walkthrough

Adiciona workflow GitHub Actions que cria comentários bidirecionais entre PRs e issues; adiciona campo origin_pr em templates de issue, novo template tracking.yml, consolida/expande template de PR e documenta regras obrigatórias de cross-reference em CONTRIBUTING.md.

Changes

Issue templates

Layer / File(s) Summary
Campo origin_pr em templates existentes
.github/ISSUE_TEMPLATE/bug_report.yml, .github/ISSUE_TEMPLATE/feature_request.yml
Adiciona um campo input origin_pr (rótulo/placeholder em português) antes do campo de contexto para capturar referência à PR de origem.
Novo template de tracking/discussion
.github/ISSUE_TEMPLATE/tracking.yml
Novo issue form Tracking / Discussion com metadados (prefixo de título, labels) e campos obrigatórios (summary, origin_pr, context, dod, priority) e opcionais (options, docs).

Pull request templates

Layer / File(s) Summary
Consolidação e ampliação do template de PR
.github/PULL_REQUEST_TEMPLATE.md
Substitui/expande o template de PR: texto de descrição, mais opções em "Tipo de mudança" (performance/security/hotfix/breaking), seção "Sistemas afetados", expand "Como testar", e novas seções para screenshots, rollback e notas ao reviewer.
Checklist pré-merge reestruturado
.github/PULL_REQUEST_TEMPLATE.md (linhas 54–89)
Checklist detalhado em subseções: Quality (lint/tsc/tests), Security (payloads/validações), Documentation (migrations/memória), UI (tokens/screenshots), plano de rollback e notas ao reviewer.
Remoção de template duplicado
.github/pull_request_template.md
Arquivo antigo removido para evitar conflito com .github/PULL_REQUEST_TEMPLATE.md.

Cross-reference workflow

Layer / File(s) Summary
Trigger e permissões
.github/workflows/cross-reference-issues.yml (linhas 17–27)
Workflow Cross-reference PR ↔ Issue dispara em pull_request (opened/edited/synchronize/closed) e issues (opened), com permissões de escrita para PRs/issues e leitura de contents.
Parsing e comentários a partir da PR
.github/workflows/cross-reference-issues.yml (linhas 28–135)
Ao evento pull_request, o script extrai referências de issues da descrição usando palavras-chave (e.g., Closes, Refs, Part of) — nota: não há matcher genérico #N para PRs — valida que o número é issue (skip se for PR), checa marcador HTML para idempotência e posta comentário na issue; conteúdo difere se PR já foi merged (inclui SHA/timestamp) ou não; 404s são warnings, outros erros são logados.
Linkagem quando issue é criada
.github/workflows/cross-reference-issues.yml (linhas 136–200)
Ao evento issues (opened), extrai origin_pr do corpo da issue via regex, busca a PR referenciada, checa marcador de idempotência e posta comentário na PR linkando a issue; 404s geram warning.
Tratamento de idempotência e erros
.github/workflows/cross-reference-issues.yml (todo)
Uso de comentários HTML-scoped por PR/issue para evitar duplicação; diferencia 404 (recurso ausente) de outros erros (logs/report).

Documentação de processo

Layer / File(s) Summary
Política obrigatória de cross-reference
CONTRIBUTING.md (linhas 92–126)
Adiciona seção "Cross-reference Issue ↔ PR (obrigatório)" definindo quando abrir issue antes do merge vs. quando referenciar issue existente, exigência de keywords (Closes/Refs/Part of) e pointer para o workflow de automação.

Sequence Diagram

sequenceDiagram
    participant Dev as Developer
    participant GH as GitHub
    participant WF as Workflow (cross-reference)
    participant PR as Pull Request
    participant IS as Issue

    Dev->>GH: Open/Edit PR com "Closes/Refs/Part of `#123`"
    GH->>WF: Trigger pull_request event
    WF->>PR: Parse body, extract referenced issue numbers via keywords
    WF->>GH: GET /repos/.../issues/123
    alt 123 é Issue
        WF->>IS: Check dedup HTML marker
        alt sem marker
            alt PR merged
                WF->>IS: POST comment (merged — SHA, time)
            else PR não merged
                WF->>IS: POST comment (cross-reference pending)
            end
        else com marker
            WF->>WF: Skip (já comentado)
        end
    else 123 é PR
        WF->>WF: Skip (não é issue)
    end

    Dev->>GH: Open Issue com campo origin_pr: "#456"
    GH->>WF: Trigger issues opened
    WF->>IS: Extract origin_pr from issue body
    WF->>GH: GET /repos/.../pulls/456
    alt PR 456 encontrada
        WF->>PR: Check dedup HTML marker
        alt sem marker
            WF->>PR: POST comment (link to new issue)
        else com marker
            WF->>WF: Skip
        end
    else PR não encontrada
        WF->>WF: Log 404 warning
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive A descrição é detalhada, bem estruturada e cobre todos os arquivos alterados com contexto claro. Porém, não segue o template obrigatório do repositório (faltam seções como '🎯 Tipo de mudança', '✅ Checklist pré-merge'). Use o template padrão da PR adicionando seções como Tipo de mudança (marque Documentação/Chore) e Checklist. A explicação pode estar completa, mas a estrutura facilita reviews.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed O título descreve precisamente a mudança principal: institucionalizar o padrão de cross-reference entre PRs e Issues. É específico, conciso e alinhado com o objetivo geral da PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/improve-cross-references-and-templates

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b4ae5826c4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

// Captura tanto "Closes #123" quanto "closes part of #155" etc
const issueRefs = new Set();
const patterns = [
/(?:closes|fixes|resolves|refs|references|part of)\s+#(\d+)/gi,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Support documented partial-close references

When contributors follow the new documented pattern Closes part of #155 from CONTRIBUTING.md, this regex does not match it because closes must be followed directly by #; the only alternative that would match is part of #155 without Closes. In that documented scenario the workflow exits at issueRefs.size === 0, so no cross-reference comment is added even though the instructions say it will be.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/cross-reference-issues.yml:
- Around line 158-172: The code always posts a new PR comment (using marker,
commentBody and github.rest.issues.createComment) without checking for an
existing marker, causing duplicate comments on re-runs; fix by first listing
comments for the PR (github.rest.issues.listComments with issue_number = prNum),
search for a comment whose body includes the marker (`<!--
cross-ref-bot:issue-${issue.number} -->`), and only call
github.rest.issues.createComment if no existing comment is found; if a matching
comment exists, skip creation and adjust the core.info message accordingly.
- Around line 44-52: The fallback regex patterns[1] is never applied because the
code only iterates body.matchAll(patterns[0]); update the logic around the const
patterns array so you also run body.matchAll for the fallback (either always
loop over both patterns or run patterns[1] only when no matches found by
patterns[0]), and for each match call issueRefs.add(parseInt(m[1], 10)) just
like the primary loop; look for the variables patterns, body.matchAll, and
issueRefs.add to place the additional iteration.
- Around line 87-110: The multiline template assigned to commentBody (in the
isMerged / isOpened branches using marker, pr, title, etc.) is leaking raw
newlines into the workflow YAML and breaking the script block; instead build a
single-line serialized string (e.g., join an array of lines or escape newlines)
and ensure it is JSON/string-escaped before embedding into the YAML script, so
commentBody contains escaped \n sequences (or use JSON.stringify) and any
backticks or quotes are escaped; update the assignments to commentBody in the
isMerged and isOpened/!existing branches to produce a safely serialized
single-line value.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f09ee39a-129d-49d1-b8e5-676b0d9e2d90

📥 Commits

Reviewing files that changed from the base of the PR and between 4702fea and b4ae582.

📒 Files selected for processing (7)
  • .github/ISSUE_TEMPLATE/bug_report.yml
  • .github/ISSUE_TEMPLATE/feature_request.yml
  • .github/ISSUE_TEMPLATE/tracking.yml
  • .github/PULL_REQUEST_TEMPLATE.md
  • .github/pull_request_template.md
  • .github/workflows/cross-reference-issues.yml
  • CONTRIBUTING.md
💤 Files with no reviewable changes (1)
  • .github/pull_request_template.md

Comment on lines +44 to +52
const patterns = [
/(?:closes|fixes|resolves|refs|references|part of)\s+#(\d+)/gi,
/#(\d+)/g // pega outras menções diretas no body como fallback
];

// Pattern principal (palavras-chave)
for (const m of body.matchAll(patterns[0])) {
issueRefs.add(parseInt(m[1], 10));
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fallback de referência direta (#N) nunca é usado.

Você declara dois regexes, mas só percorre patterns[0]. Hoje, menções diretas no body (sem keyword) não entram no issueRefs.

💡 Patch sugerido
-            const patterns = [
-              /(?:closes|fixes|resolves|refs|references|part of)\s+#(\d+)/gi,
-              /#(\d+)/g  // pega outras menções diretas no body como fallback
-            ];
-
-            // Pattern principal (palavras-chave)
-            for (const m of body.matchAll(patterns[0])) {
-              issueRefs.add(parseInt(m[1], 10));
-            }
+            const patterns = [
+              /(?:closes|fixes|resolves|refs|references|part of)\s+#(\d+)/gi,
+              /#(\d+)/g // fallback para menções diretas
+            ];
+
+            for (const pattern of patterns) {
+              for (const m of body.matchAll(pattern)) {
+                issueRefs.add(parseInt(m[1], 10));
+              }
+            }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const patterns = [
/(?:closes|fixes|resolves|refs|references|part of)\s+#(\d+)/gi,
/#(\d+)/g // pega outras menções diretas no body como fallback
];
// Pattern principal (palavras-chave)
for (const m of body.matchAll(patterns[0])) {
issueRefs.add(parseInt(m[1], 10));
}
const patterns = [
/(?:closes|fixes|resolves|refs|references|part of)\s+#(\d+)/gi,
/#(\d+)/g // fallback para menções diretas
];
for (const pattern of patterns) {
for (const m of body.matchAll(pattern)) {
issueRefs.add(parseInt(m[1], 10));
}
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/cross-reference-issues.yml around lines 44 - 52, The
fallback regex patterns[1] is never applied because the code only iterates
body.matchAll(patterns[0]); update the logic around the const patterns array so
you also run body.matchAll for the fallback (either always loop over both
patterns or run patterns[1] only when no matches found by patterns[0]), and for
each match call issueRefs.add(parseInt(m[1], 10)) just like the primary loop;
look for the variables patterns, body.matchAll, and issueRefs.add to place the
additional iteration.

Comment thread .github/workflows/cross-reference-issues.yml Outdated
Comment thread .github/workflows/cross-reference-issues.yml
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Institucionaliza um padrão de rastreabilidade entre Pull Requests e Issues via templates + um workflow do GitHub Actions que cria cross-references automáticas, reduzindo perda de contexto ao longo do tempo.

Changes:

  • Consolida o template de PR e explicita keywords/padrão de linkage com issues.
  • Adiciona/ajusta templates de issue para capturar “PR de origem” (inclui novo template Tracking/Discussion).
  • Introduz workflow para comentar automaticamente em issues/PRs com base em referências detectadas.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
CONTRIBUTING.md Documenta o padrão obrigatório de cross-reference Issue ↔ PR e o workflow responsável.
.github/workflows/cross-reference-issues.yml Implementa automação de comentários cruzados entre PRs e issues.
.github/PULL_REQUEST_TEMPLATE.md Reorganiza o template e adiciona seção dedicada a keywords de issues relacionadas.
.github/pull_request_template.md Remove template duplicado (minúsculo) para evitar ambiguidade.
.github/ISSUE_TEMPLATE/tracking.yml Novo template Tracking/Discussion com “PR de origem” obrigatório e DoD obrigatório.
.github/ISSUE_TEMPLATE/feature_request.yml Adiciona campo opcional “PR de origem”.
.github/ISSUE_TEMPLATE/bug_report.yml Adiciona campo opcional “PR de origem”.
Comments suppressed due to low confidence (1)

.github/workflows/cross-reference-issues.yml:170

  • O handler de issues não está idempotente: ele sempre cria comentário na PR e não verifica se já existe um comentário com o marker <!-- cross-ref-bot:issue-... -->. Em caso de edited (se habilitado) ou re-run do workflow, isso vai duplicar comentários; liste comentários existentes e pule/crie apenas se o marker não estiver presente.
              await github.rest.issues.createComment({
                owner: context.repo.owner,
                repo: context.repo.repo,
                issue_number: prNum,
                body: commentBody,

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +44 to +47
const patterns = [
/(?:closes|fixes|resolves|refs|references|part of)\s+#(\d+)/gi,
/#(\d+)/g // pega outras menções diretas no body como fallback
];
Comment on lines +77 to +82
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNum,
per_page: 100,
});
Comment on lines +112 to +116
if (commentBody && (!existing || isMerged)) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNum,
Comment on lines +132 to +134
- name: Cross-reference on Issue events
if: github.event_name == 'issues' && github.event.action == 'opened'
uses: actions/github-script@v8
CodeRabbit identificou 3 issues importantes:

1. Branch 'Issue events' não checava marker antes de comentar
   → posts duplicados em re-runs (issue.edited dispara o mesmo workflow)
   Fix: listComments primeiro, search por marker, skip se já existe

2. Dead code: const patterns = [keywordPattern, fallbackRegex]
   patterns[1] declarado mas nunca usado no loop
   Fix: removido, apenas keywordPattern fica

3. Template literals com newlines no commentBody podiam dar parsing issues
   Fix: tudo construído via array.join('\n') agora — explícito e safe

Bônus além dos achados:

- Markers diferenciados :opened vs :merged
  Antes: 1 marker por PR → comentário de merged sobrescrevia o de opened
  Agora: dois markers permitem coexistir ambos os comentários (que é o
  comportamento desejado: histórico tem evento opened E evento merged)

- error.message agora consistente em todos os catch blocks

Diff: 200 linhas (era 179) — verbosidade extra justificada pela correção
das 3 falhas + robustez adicional.

Refs CodeRabbit review em #159

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 95c50fcb2c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +74 to +79
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNum,
per_page: 100,
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Paginate comment scans to preserve idempotency

For issues or PRs that already have more than 100 comments, this only checks one page of comments before deciding whether the marker exists. In that scenario the marker can be outside the fetched page, so every later edited/synchronize/closed run creates another bot comment even though the workflow promises idempotency; use pagination for the marker lookup instead of a single per_page: 100 request.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants