Skip to content

Fix PR merge drift review context - #195

Merged
Takhoffman merged 1 commit into
mainfrom
codex/fix-pr-merge-drift-review
May 25, 2026
Merged

Takhoffman merged 1 commit into
mainfrom
codex/fix-pr-merge-drift-review

Conversation

@Takhoffman

@Takhoffman Takhoffman commented May 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • expose REST mergeable_state in compact PR review context
  • tell PR review prompts not to treat clean behind-base drift as deleting current-base-only changes
  • add regression coverage for the compact context and prompt guard

Fixes #119

Validation

  • pnpm run check
  • node --test test/clawsweeper.test.ts --test-name-pattern 'review prompt includes merge state and guards clean behind-branch drift'

Real behavior proof

Focused regression proof from the local terminal after the fix:

$ node --test test/clawsweeper.test.ts --test-name-pattern 'review prompt includes merge state and guards clean behind-branch drift'
✔ review prompt includes merge state and guards clean behind-branch drift (0.129ms)
ℹ tests 282
ℹ pass 282
ℹ fail 0

Direct prompt/context generation proof from the built ClawSweeper code path after the fix:

$ node --input-type=module -e 'import { compactPullRequestForTest, reviewPromptForTest } from ./dist/clawsweeper.js; /* render compact PR context into review prompt */'
compact pullRequest mergeableState: clean
prompt contains mergeableState clean: true
prompt contains behind-base drift guard: true

This compacts REST PR data with mergeable_state: "clean", renders it through ClawSweeper's review prompt builder, and verifies the resulting prompt includes both mergeableState: "clean" and the clean behind-branch drift guard.

@Takhoffman

Copy link
Copy Markdown
Contributor Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented May 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper

clawsweeper Bot commented May 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed May 25, 2026, 1:39 AM ET / 05:39 UTC.

Summary
This PR adds PR mergeable_state to compact review context, updates the review prompt to treat clean behind-base drift as rebase/review-staleness rather than deletion risk, and adds focused regression coverage.

Reproducibility: Do we have a high-confidence way to reproduce the issue? Yes, source-level: current main omits mergeable_state from compact PR context, and the PR adds a fixture that renders a clean mergeable PR through the review prompt path; I did not run tests because this review is read-only.

Review metrics: 2 noteworthy metrics.

  • Changed surface: 3 files changed, 47 additions, 0 deletions. The patch is confined to the review prompt, PR context compaction, and focused regression coverage.
  • Regression coverage: 1 focused test added. The new test directly exercises the compact context field and prompt guard that address the linked false-positive review behavior.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • none

Next step before merge
No repair lane is needed; the remaining path is ordinary maintainer review and merge once repository checks are satisfactory.

Security
Cleared: The diff only changes prompt text, compact PR context serialization, and tests; it adds no dependencies, workflow permissions, secrets handling, or external code execution path.

Review details

Best possible solution:

Land the narrow context, prompt, and regression-test change after normal maintainer review so future PR reviews distinguish clean behind-base drift from actual merge-result regressions.

Do we have a high-confidence way to reproduce the issue?

Do we have a high-confidence way to reproduce the issue? Yes, source-level: current main omits mergeable_state from compact PR context, and the PR adds a fixture that renders a clean mergeable PR through the review prompt path; I did not run tests because this review is read-only.

Is this the best way to solve the issue?

Is this the best way to solve the issue? Yes for the current boundary: exposing GitHub's merge state and tightening prompt guidance is a narrow maintainable fix, while a full merge-tree comparison can remain future hardening if false positives persist.

AGENTS.md: found and applied where relevant.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 1734b1683911.

Label changes

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes after-fix terminal output from the built prompt/context generation path showing the new merge-state field and guard, which is sufficient for this non-visual automation behavior.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body includes after-fix terminal output from the built prompt/context generation path showing the new merge-state field and guard, which is sufficient for this non-visual automation behavior.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P2: This fixes misleading PR review risk context in ClawSweeper automation with a limited, normal-priority blast radius.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body includes after-fix terminal output from the built prompt/context generation path showing the new merge-state field and guard, which is sufficient for this non-visual automation behavior.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes after-fix terminal output from the built prompt/context generation path showing the new merge-state field and guard, which is sufficient for this non-visual automation behavior.
Evidence reviewed

What I checked:

  • target policy read: AGENTS.md was present and fully read; its ClawSweeper guidance favors narrow, evidence-backed, automation-safe review/workflow changes. (AGENTS.md:1, 1734b1683911)
  • current main context gap: On current main, compactPullRequest includes mergeable but not the REST mergeable_state, so the central context field requested by the linked bug is not implemented yet. (src/clawsweeper.ts:2970, 1734b1683911)
  • PR context change: The PR branch adds mergeableState: pull.mergeable_state to the compact PR context and exports a focused test helper for that compacting path. (src/clawsweeper.ts:2895, 3ca76a69f244)
  • PR prompt guard: The PR branch adds prompt instructions telling reviewers not to treat a clean behind-base branch as proof that merging will delete current-base-only changes without merge-result evidence. (prompts/review-item.md:172, 3ca76a69f244)
  • PR regression coverage: The PR adds a regression test that compacts a REST PR payload with mergeable_state: clean, renders the review prompt, and asserts both the compact field and drift guard are present. (test/clawsweeper.test.ts:871, 3ca76a69f244)
  • diff hygiene: git diff --check produced no whitespace or patch-format warnings for the PR diff. (3ca76a69f244)

Likely related people:

  • Peter Steinberger: git blame attributes the current compactPullRequest, collectItemContext, and nearby merge-risk prompt baseline to commit 3d44506, which introduced the relevant review/context structure on main. (role: introduced behavior; confidence: high; commits: 3d445068fec1, 97885cf4e291, abd3f976f9ed; files: src/clawsweeper.ts, prompts/review-item.md)
  • Tak Hoffman: Recent main history shows multiple prompt/context and review-comment changes by Tak Hoffman, including filtered PR ingestion comments and review metrics work adjacent to this PR's files. (role: recent area contributor; confidence: high; commits: 3719f85d38d8, 1734b1683911, 0f6ea686317a; files: src/clawsweeper.ts, prompts/review-item.md, test/clawsweeper.test.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal priority bug or improvement with limited blast radius. labels May 25, 2026
@clawsweeper

clawsweeper Bot commented May 25, 2026 •

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

✨ Hatched: 🌱 uncommon Cosmic Crabkin

Hatch command

Comment @clawsweeper hatch when this PR is hatchable.

Hatchability rules:

  • Merged PRs are hatchable.
  • Open PRs are hatchable when they are status: 👀 ready for maintainer look, status: 🚀 automerge armed, or labeled clawsweeper:automerge.
  • Closed unmerged PRs are hatchable only when one of those hatchable labels is still present in the durable record.

Rarity: 🌱 uncommon.
Trait: sniffs out flaky tests.
Image traits: location release reef; accessory proof snapshot camera; palette plum, gold, and soft gray; mood calm; pose holding its accessory up for inspection; shell polished stone shell; lighting cool dashboard glow; background soft code-shaped tiles.
Share on X: post this hatch
Copy: My PR egg hatched a 🌱 uncommon Cosmic Crabkin in ClawSweeper.

What is this egg doing here?
  • Eggs appear after the PR passes real-behavior proof. It is here for vibes, not verdicts: it does not change labels, ratings, merge decisions, or automation.
  • The shell reacts to review momentum: open follow-up work warms it up, re-review makes it wobble, and a clean final review lets it hatch.
  • Hatchability usually comes from sufficient real-behavior proof, no blocking P0/P1/P2 findings, no security attention needed, and clean correctness. A merged PR is already final, so merge makes the egg hatchable independently.
  • The hatch is seeded from this repository and PR number, so the same PR keeps the same creature; the reviewed head SHA can only change safe visual details.
  • Rarity is just collectible sparkle: 🥚 common, 🌱 uncommon, 💎 rare, ✨ glimmer, and 🌈 legendary.

@Takhoffman
Takhoffman marked this pull request as ready for review May 25, 2026 05:21
@Takhoffman

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented May 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Command router queued. I will update this comment with the next step.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels May 25, 2026
@Takhoffman

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented May 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Command router queued. I will update this comment with the next step.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels May 25, 2026
@Takhoffman
Takhoffman merged commit ca82d68 into main May 25, 2026
8 of 15 checks passed
@Takhoffman
Takhoffman deleted the codex/fix-pr-merge-drift-review branch May 25, 2026 05:44
azaj01 pushed a commit to azaj01/clawsweeper that referenced this pull request Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PR merge-risk review treats clean behind-branch diff as deleting main-only changes

1 participant