chatgpt-review: pr mode returns a stale-head review after a push (restates prior findings, reports the old SHA) in long conversations
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 68/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- github, javascript, node.js
Direção de pesquisa
Comece por scripts/lib/prompt.mjs, especialmente pelos prompts fresh-review e fix-review nas linhas 26–27, e depois inspecione como a CLI obtém e trata o PR head SHA. Acompanhe o workflow code-review-pass em .claude/skills/ship/references/code-review-pass.workflow.mjs para entender a contagem de passes e o tratamento de reviews obsoletos. Está concluído quando o head atual é explicitamente verificado e as divergências são expostas sem consumir um pass de review válido.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Summary
In pr mode, chatgpt-review.mjs sometimes returns a review of a stale PR head: the response restates findings from an earlier pass verbatim and self-reports reported_reviewed_sha as an older commit, even though (a) the fixes for those findings were pushed before the call, and (b) gh pr view <n> --json headRefOid confirmed the live head was the newer commit at call time. The independent fact-check stage downstream caught every instance (all stale findings were rejected as "already fixed at HEAD"), so no bad fix was applied — but each occurrence burns one of the session's three hard-capped pr-mode passes on a review of code that no longer exists.
Observed 3 times across 2 PRs in one /ship run (Altinity/altinity-oauth-helper), each time in a long-running ChatGPT conversation with many prior turns (plan authoring + prior review passes in the same thread), and each time immediately after a fix had been pushed between passes.
Reproduction (as observed)
- Run a
plan-authorloop, then startprmode with--seed-from-session <plan-session>on the PR. Pass 1 reviews the correct head and finds real issues. - Fix them, push, confirm
gh pr view --json headRefOidshows the new head. - Re-invoke the same PR with
--session <pr-session>(pass 2), or--seed-from-session <exhausted-session>to start a newprsession (pass 1 of session 2). - Response: the same findings as the prior pass, byte-for-byte in substance;
reported_reviewed_sha= the pre-fix SHA. The published PR comment for that pass likewise cites the old SHA.
Instances (all in https://github.com/Altinity/altinity-oauth-helper):
| PR | Pass | Live head at call time | reported_reviewed_sha returned |
Outcome |
|---|---|---|---|---|
| #21 | session 1 pass 2 | e1a434f |
c0c495f (pre-fix) |
2 stale findings, both rejected by fact-check |
| #21 | session 2 pass 1 (seeded) | eb3d02f |
e1a434f (pre-fix) |
2 stale findings, both rejected |
| #22 | session 1 pass 2 | e577d06 |
8f3e303 (pre-fix) |
4 stale findings, all rejected |
Conversations: https://chatgpt.com/c/6a9098f3-a038-83eb-b5e2-852a4f1cd2bc (PR #21; sessions c16ce96d-caee-48ae-894b-7a77c59b0670, dd05fae0-8a2c-4c26-bce1-9f481fd10b46) and https://chatgpt.com/c/6a910d15-c1a0-83eb-aa16-d926786d07ad (PR #22; session 55cd505c-ece3-4547-9942-c614259682dd).
What made it go away
Appending an explicit instruction to the question file worked every time it was tried:
Your previous response reviewed a stale snapshot (self-reported
reviewed_sha<old>; the live head is<new>, confirmed viagh pr view). Navigate tohttps://github.com/<owner>/<repo>/pull/<n>/filesfresh and, BEFORE writing any finding, state the exact head SHA GitHub shows you and confirm it is<new>; if it differs, say so rather than proceeding.
The next pass then reported the correct SHA and produced genuinely new findings (PR #21 passes 5–6; PR #22 second-session pass 1).
Likely cause
scripts/lib/prompt.mjs:27 — the fix-review pass prompt reads:
This is fix-review pass N. Reuse your earlier analysis, fetch the new PR head, compare it with the previously reviewed SHA
<previousSha>, reassess every earlier finding, and inspect the complete updated PR for regressions. Report both old and new exact SHAs.
It leads with "reuse your earlier analysis", and it tells the model the old SHA but never the expected new one — so there is nothing the model must verify against, and in a long conversation it can satisfy the prompt from memory ("new head" = whatever it last saw) and report the old SHA as "reviewed". The --seed-from-session first pass uses the fresh "Browse the canonical PR, clone or fetch the repository…" prompt (prompt.mjs:26) and still went stale once (PR #21 session 2 pass 1), so conversation memory dominates even the fresh-review wording when the thread is long. The fact that a plain-language "state the head SHA you see and confirm it equals <new>" instruction fixed it every time supports this.
Suggested fixes
- Make the pass prompt state the expected head SHA and require confirmation. The CLI already knows (or can cheaply fetch via
gh pr view --json headRefOid) the live head. Put it in everypr-mode prompt: "The PR head is<sha>. Re-open the Files view and confirm you are reviewing<sha>before writing findings; if GitHub shows a different SHA, stop and report it." This is exactly the manual workaround, automated. - Fail closed on SHA mismatch in the CLI. After the response, compare
reported_reviewed_shato the liveheadRefOid; if they differ, return a distinct status (e.g.stale_review) instead ofcompleted, so callers (the/shipcode-review-passworkflow) don't spend fact-check agents and a pass slot on it. Ideally the CLI retries once with the re-navigate instruction before giving up. - Don't count a stale review against the 3-pass cap (or at least surface it), since the cap exists to bound real review rounds. Note the interaction with the cap is what made this costly: on PR #22 a stale pass 2 plus pass 1's internal retries exhausted the session before pass 3 could run at all (
session-cap-exhausted). - (Nice to have) In
--seed-from-sessionstarts, explicitly tell the model the conversation is being continued for a new review of the current head and that earlier findings may already be fixed.
Environment
- Skill at
skills/chatgpt-review(this repo), consumed via~/.claude/skills/chatgpt-review; Agent Chrome over CDP; Node 20+. - Observed 2026-08-27/28 during
/ship 19inAltinity/altinity-oauth-helper; the downstream fact-check that caught it isaltinity-oauth-helper/.claude/skills/ship/references/code-review-pass.workflow.mjs.
- Linguagem predominante
- TypeScript
- Estrelas
- 8
- Forks
- 2
- Merge médio
- 1h 34min
- PRs com merge (30d)
- 6
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de Altinity/altinity-sql-browser
-
inbox
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
Altinity/altinity-sql-browser#605 ·
-
inbox
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Altinity/altinity-sql-browser#509 ·
-
inbox
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Altinity/altinity-sql-browser#489 ·
-
flamegraph Abertaenhancement
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 25/100
Altinity/altinity-sql-browser#684 ·
-
inbox
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 35/100
Altinity/altinity-sql-browser#673 ·
Todas as issues de Altinity/altinity-sql-browser
Issues semelhantes
-
comp/dashboard P3 type/bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 86/100
NousResearch/hermes-agent#117722 ·
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 76/100
-
code-quality refactoring
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
langchain-ai/deepagents#6450 ·