fix(dev-lead): disposition a fixed bot issue comment, and sweep claim replies posted as PR comments (#2261)

Merged
DO
1mo ago
+447-16

Summary

Reworked after #2156 merged as 9adfeed3 (PR #2231). main now sweeps this pass's disposition=fixed replies on PR issue comments and re-points one whose commit the push guard rebased, which covers part of what this PR first did. What is left:

  • Prompt (prompts/dev-lead/fix-bot-comment.md, unchanged from the first version): a new section, "Fixing a finding posted as a PR issue comment". It applies to every registered reviewer bot, says the addressed-marker and claim are for review threads only, and requires exactly one reply ending in one dev-lead:comment-disposition … disposition=fixed sha=<40-hex> marker, with a runnable example keyed on ${COMMENT_NODE_ID}.
  • Claim sweep over PR issue comments (retract_unlanded_claims): main sweeps only disposition=fixed replies there. An addressed/claim reply posted as a PR comment, the PR #2205 shape, is now re-pointed or retracted like a thread reply.
  • One writer per reply. A PR comment that carries a fixed disposition is left to #2156's sweep_fixed_dispositions, which now also moves a claim citing the same commit on a re-point and removes the addressed-marker and claim on a retraction. The claim sweep skips those replies (cl_without_fixed_dispositions), so a comment listing that lags the first edit cannot make the second sweep overwrite it.
  • cl_retract_body no longer strips a different marker that shares a line with the claim, and removes a claim whose JSON spans lines whole (CodeRabbit). Its stripping is now cl_strip_claim_markers.

Removed in the rework: rdc_repoint_rebased_fixed, cdv_rewrite_disposition_sha and their tests. retract_unlanded_claims runs sweep_fixed_dispositions before resolve_dispositioned_comments, and the resolver re-reads the PR's comments, so it already judges the re-pointed sha. The updateIssueComment call CodeAnt flagged went with them. The sentence in docs/pr-review-agent/maintainer-comment-gate.md now describes that order and cites #2156.

Problem

Closes #2261. On PR #2205 dev-lead fixed a CodeAnt issue-comment finding and answered with the thread-style addressed-marker and claim. The gate does not read that, so the comment stayed open and the retry sweep ran out of attempts. The claim cited f8f0b54, a commit the push guard had rebased to 3e5025bd; nothing checked or corrected it, because the claim sweep only read review-thread replies.

Against the issue's acceptance criteria: 1 is the prompt change here, 2 is met by #2156 on main, 3 is the claim sweep here.

Risk

Medium. It changes the dev-lead harness's claim sweep and a prompt.

  • The claim sweep now edits PR issue comments, but only ones our account posted since the pass start that carry the addressed-marker or a claim and no fixed disposition. An unreadable issue-comment listing makes the sweep report "NOT verified" and return non-zero; thread replies are still swept.
  • sweep_fixed_dispositions behaves as on main for a reply with no addressed-marker or claim: main's 23 tests in test_claim_sweep.bats pass unchanged.

Known limits:

  • This does not by itself clear the PR #2205 comment. That fix only added a line, and the #2004 content rule accepts a fixed disposition only when the diff removes a token the finding names. That is #2269; the maintainer has chosen its option 1, and it is not implemented here.
  • sweep_earlier_claims is unchanged: a claim an earlier or cancelled pass posted as an issue comment is still not swept. The stale claim on PR #2205 (comment 6102259888) is one, and stays as it is.
  • That the resolver sees the re-pointed sha was checked by reading the call order and the resolver's own comment fetch on main, not by an end-to-end test.
  • The tests are function-level against a bare remote with a real push-guard rebase. The existing full-script tests stub git push.

Test plan

  • tests/dev-lead/unit/test_claim_sweep.bats: 35/35, main's 23 plus 12 new. All 12 fail without their source change.
  • CI caught one regression in the first reworked push: the new cl_without_fixed_dispositions rejected a comment listing that was JSON but not a list, which failed the sweep and made a pushed pass read as failed (resolve_deferred_bot_threads (#2045): … keyed to the pushed head, whose gh stub answers with an object). It now passes such a payload through, as main's sweep does. That test and a new one for the case pass. They cover a claim that never landed, a rebased one, selection (ours, this pass, landed left alone), a claim on the second page of the listing, a non-fixed disposition surviving on the claim's line, a thread claim with a second marker on its line, a reply carrying both a claim and a fixed disposition (re-pointed once and retracted once), an unreadable listing, cl_without_fixed_dispositions, and a claim whose JSON spans lines.
  • The gh stub serves the same listing after a PATCH, which is what a lagging listing returns, so the two "both markers" tests also show the reply is written once.
  • test_claim_landing 45/45, test_comment_disposition_verify 60/60 (both as on main), the two #2261 prompt tests in test_fix_reviews 2/2; both fail against main's prompt.
  • shellcheck --severity=warning -x on the three scripts: clean. scripts/check-duplicate-decls.sh: pass. markdownlint-cli2 on the doc: clean.
  • Not re-run here: the full test_fix_reviews.bats, which has about 10 failures on this Mac from BSD sed; CI is the authority.

Rollback

Revert this PR. A reply already re-pointed or retracted stays valid under the old code.

Monitoring

In a fix-bot-comment run log: retracted PR-comment claim reply … or PR-comment claim reply … claim updated. Inert until the dev-lead channel tag moves onto it (next autocut to dev-lead/v139-next, then ring promotion).

Interaction contract

  • N/A: no agentic role added or changed.

🤖 Generated with Claude Code