fix: invalidate stale canonical close verdicts#463
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d883a6ca65
ℹ️ 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".
| if (structuredCanonicalRef) { | ||
| const parsed = parseGitHubItemRef(structuredCanonicalRef, "root_cause_cluster.canonicalRef"); | ||
| if (parsed.kind === "pull_request" && parsed.number !== item.number) { | ||
| return [{ number: parsed.number, kind: "pull_url" }]; |
There was a problem hiding this comment.
Check every canonical close target
When root_cause_cluster.canonicalRef is present, this returns that single PR and never inspects the refs that actually appear in the close recommendation/comment. If a report has a structured canonical PR #400 but the durable close verdict says the PR is superseded by #401, and #401 later closes unmerged, the new comment-sync guard only probes #400 and can still refresh the stale close verdict for #401. Please include the signaled close-comment/work-cluster refs in this guard rather than short-circuiting on the structured field.
Useful? React with 👍 / 👎.
Summary
Root cause
Comment-only sync bypassed the live canonical guard used by final close apply, so it could refresh an old trusted close verdict after the canonical PR closed unmerged.
Tests
pnpm run build:allnode --test --test-concurrency=1 test/apply-pr-duplicate-proof.test.ts test/apply-pr-duplicate-ref-proof.test.ts test/repair/workflow-utils.test.ts test/apply-label-sync.test.ts test/apply-pr-coverage-proof-close.test.ts test/apply-pr-promotion.test.ts(105/105)pnpm run test:repair(664/664)pnpm run lintpnpm run format:check