Skip to content

fix(review): suppress fresh exact hot-intake duplicates - #992

Merged
brokemac79 merged 3 commits into
mainfrom
codex/csw-088-hot-intake-exact-suppression
Aug 1, 2026
Merged

brokemac79 merged 3 commits into
mainfrom
codex/csw-088-hot-intake-exact-suppression

Conversation

@brokemac79

@brokemac79 brokemac79 commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Prevent the scheduled hot-intake planner from immediately starting a second review for a freshly completed exact review of the same OpenClaw PR state.

Problem

OpenClaw PR #117063 showed multiple recent ClawSweeper review-start comments despite one observed merge-related event. The hot scheduler could select a PR again immediately after an exact review because it did not confirm that the persisted review still matched the live PR head, relevant source/body state, structural pull state, and review activity.

Implementation

  • Suppress only a fresh, completed scheduled hot-intake review whose persisted exact snapshot still matches.
  • Fence the snapshot with stable review-activity reads and the final pull updated_at; unknown or changed state fails open and remains eligible.
  • Preserve explicit re-review routes, normal cadence, capacity/selection ordering, leases/claims, and all routing/workflow behavior.
  • Keep the pure snapshot assertions in test/scheduler-policy.test.ts; retain the CLI integration scenario in test/command.test.ts.
  • Rebased deliberately onto refactor: modularize ClawSweeper and make autofix fast and merge-safe #993 / 8fd1140e7aa97790513afaab43eba4dd1085f85a, preserving its planner refactor and source-revision helpers while applying the exact-snapshot guard at the current planner boundary.

Validation

  • pnpm run build — passed.
  • node --test --test-name-pattern "CSW-088" test/scheduler-policy.test.ts test/command.test.ts — 2 passed.
  • pnpm run lint — passed.
  • pnpm exec oxfmt --check src/clawsweeper.ts src/scheduler-policy.ts test/command.test.ts test/scheduler-policy.test.ts — passed.
  • git diff --check origin/main...HEAD — passed.
  • pnpm run format:check reports 541 repository-wide formatter findings already present on rebased main/refactor: modularize ClawSweeper and make autofix fast and merge-safe #993; no unrelated reformat is included here.

Real Behavior Proof

  • Claim: a freshly completed exact review of the same PR state is omitted from scheduled hot intake; a changed in-flight snapshot and an explicit re-review route remain eligible.
  • Surface: the built clawsweeper plan --hot-intake CLI, exercised through the #117063-shaped integration fixture in test/command.test.ts.
  • Scenario / fixture: a completed persisted record matches head, item_updated_at, source revision, structural pull-state digest, and review-activity cursor. The same controlled run then changes the body during snapshot reads, changes ordinary comment activity, and invokes the explicit item route.
  • Command / environment: current head 54e6e4786cfa90be3a51e307e49ad9488a7a3247; Docker-backed Crabbox Linux local-container, image mcr.microsoft.com/playwright:v1.60.0-noble, lease cbx_40c99cfc0573; Node v24.15.0, Corepack pnpm 11.10.0; corepack pnpm install --frozen-lockfile, corepack pnpm run build, then node --test --test-name-pattern 'CSW-088 scheduled hot planning suppresses #117063' test/command.test.ts.
  • Observed result: the matching scheduled snapshot returned no candidate; each changed-snapshot case returned #117063; the explicit route returned #117063. One test passed, exit code 0, with CSW_088_REBASED_PROOF=PASS.
  • Artifact / trace: Crabbox lease cbx_40c99cfc0573, provider local-container, synced 645 files / 24.1 MiB; command phases install 8.262s, build 1.562s, proof 2.821s; total 19.734s.
  • Limits: controlled, read-only CLI proof; it does not mutate GitHub or execute a live scheduled workflow.

Codex Review Closeout

  • codex review --uncommitted — no staged, unstaged, or untracked changes after the clean rebase.
  • codex review --base origin/main — clean: “No actionable correctness issues were identified in the diff.”

Accepted Residual Risks

The maintainer accepted these bounded external-snapshot and scheduling limits for this narrow PR; no further probe, routing, capacity, or selection change is included:

  • A change that lands in the final non-atomic external-read tail can defer its hot-intake follow-up by at most one hot cycle.
  • A fresh legacy report absent from the Worker coverage manifest can defer canonical coverage restoration by at most one hot cycle.
  • A check-only change during a bot-owned update can defer the next follow-up by at most one hot cycle.

These cases do not create a stale review effect, completion, or data loss; the next hot cycle remains eligible.

Links

@clawsweeper clawsweeper Bot added 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. P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. labels Aug 1, 2026
@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 1:56 AM ET / 05:56 UTC.

ClawSweeper review

What this changes

The branch prevents scheduled hot intake from immediately selecting a pull request that already has a fresh, completed review of the exact same observable state.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

This PR is still necessary and appears to implement the intended narrow hot-intake suppression on its current rebased head. The guard runs only for scheduled hot intake, skips only a fresh completed review whose head, source content, structural pull state, activity cursor, and safe update state still match, and leaves unknown or changed state eligible. No discrete correctness or security finding was identified; it is ready for normal maintainer review once the current required checks are terminal.

Priority: P2
Reviewed head: 54e6e4786cfa90be3a51e307e49ad9488a7a3247

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, rebased automation repair with direct built-CLI proof and no actionable correctness finding; only normal terminal-check and maintainer landing review remain.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The PR body supplies a current-head, Docker-backed built-CLI proof showing the exact snapshot yields no candidate while changed snapshots and the explicit route yield the target candidate; it directly demonstrates the changed planner behavior without mutating GitHub.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body supplies a current-head, Docker-backed built-CLI proof showing the exact snapshot yields no candidate while changed snapshots and the explicit route yield the target candidate; it directly demonstrates the changed planner behavior without mutating GitHub.
Evidence reviewed 4 items Scheduled planner wiring: The current PR head invokes the exact-review skip predicate inside the scheduled hot-intake loop after due-candidate evaluation and before candidate selection; explicit item routes take a separate earlier path.
Fail-open exact snapshot fence: The guard requires a completed review inside the one-hour hot-intake window and matching head SHA, source revision, structural pull-state digest, stable review-activity cursor, and update state; failed reads return null and leave the item eligible.
Focused behavioral coverage: The branch adds both policy assertions for every comparison fence and a built CLI scenario that omits the exact snapshot while retaining changed body/comment/activity snapshots and the explicit route.
Findings None None.
Security None None.

How this fits together

ClawSweeper’s hot-intake planner polls recently active GitHub items, ranks eligible review candidates, and hands the selected items to scheduled review workers. This patch compares a persisted completed-review snapshot with current pull-request state before the item enters hot-intake selection.

flowchart LR
  A[Recent GitHub pull requests] --> B[Hot-intake planner]
  C[Completed review record] --> D[Exact snapshot comparison]
  A --> D
  D --> E{Fresh and unchanged?}
  E -->|Yes| F[Omit scheduled duplicate]
  E -->|No or unknown| B
  B --> G[Selected review workers]
  H[Explicit re-review route] --> G
Loading

Before merge

  • Resolve merge risk (P1) - The snapshot spans several non-atomic GitHub reads; a state change in the final read tail can defer one hot-intake follow-up by at most one cycle, while unreadable or mismatched state fails open and remains eligible.
  • Resolve merge risk (P1) - GitHub currently reports the PR as mergeable but unstable, so normal required-check completion and a final current-head status check remain necessary before landing.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Patch footprint 630 added, 2 removed across 4 files The production change is localized to planner snapshot comparison and is backed by focused policy and built-CLI coverage.
Snapshot fences 5 state comparisons Head, source revision, structural pull state, review activity, and update state prevent suppression when observable review inputs changed.

Merge-risk options

Maintainer options:

  1. Accept the bounded scheduling tradeoff (recommended)
    Merge after required checks are terminal, accepting that a change in the final external-read tail can delay only the next hot-intake cycle while uncertain state remains eligible.
  2. Broaden snapshot fencing
    Pause for a larger design if maintainers require stronger atomicity than GitHub’s read APIs provide, recognizing that this expands the narrow duplicate-suppression scope.

Technical review

Best possible solution:

Land the narrow exact-snapshot guard after required checks are terminal, while retaining its fail-open behavior and documenting the bounded one-cycle defer window as the intended scheduling tradeoff.

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

Yes: the built CLI scenario in the branch exercises plan --hot-intake with a completed persisted review, then verifies that an exact snapshot is omitted while body, ordinary-comment, and review-activity changes remain eligible.

Is this the best way to solve the issue?

Yes: applying a short-lived exact-snapshot guard at the scheduled planner boundary is the narrowest maintainable solution because it preserves explicit re-review routes, normal cadence outside the freshness window, ordering, and fail-open handling of uncertain state.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 8fd1140e7aa9.

Labels

Label justifications:

  • P2: Duplicate scheduled reviews are a bounded automation reliability problem without evidence of data loss, security exposure, or a core-runtime outage.
  • merge-risk: 🚨 automation: The PR changes scheduled candidate selection and can intentionally defer a follow-up review for one hot-intake cycle in a narrow race window.
  • 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 (live_output): The PR body supplies a current-head, Docker-backed built-CLI proof showing the exact snapshot yields no candidate while changed snapshots and the explicit route yield the target candidate; it directly demonstrates the changed planner behavior without mutating GitHub.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body supplies a current-head, Docker-backed built-CLI proof showing the exact snapshot yields no candidate while changed snapshots and the explicit route yield the target candidate; it directly demonstrates the changed planner behavior without mutating GitHub.

Evidence

What I checked:

  • Scheduled planner wiring: The current PR head invokes the exact-review skip predicate inside the scheduled hot-intake loop after due-candidate evaluation and before candidate selection; explicit item routes take a separate earlier path. (src/clawsweeper.ts:5359, 54e6e4786cfa)
  • Fail-open exact snapshot fence: The guard requires a completed review inside the one-hour hot-intake window and matching head SHA, source revision, structural pull-state digest, stable review-activity cursor, and update state; failed reads return null and leave the item eligible. (src/clawsweeper.ts:4469, 54e6e4786cfa)
  • Focused behavioral coverage: The branch adds both policy assertions for every comparison fence and a built CLI scenario that omits the exact snapshot while retaining changed body/comment/activity snapshots and the explicit route. (test/command.test.ts:250, 54e6e4786cfa)
  • Planner provenance: Current main’s planner boundary and scheduler-related history were recently maintained through the modularization and canonical-coverage work; the PR head is directly based on the current main commit. (src/clawsweeper.ts:5345, 8fd1140e7aa9)

Likely related people:

  • steipete: Peter Steinberger authored the current-main modularization commit that established the planner boundary where this guard is applied, and recent scheduler history is concentrated in this area. (role: recent area contributor; confidence: high; commits: 8fd1140e7aa9, 9e464d65cecd, 970af34736a6; files: src/clawsweeper.ts, src/scheduler-policy.ts)
  • Vincent Koc: Recent exact-review publication work touches the persisted review state that this PR uses as its snapshot input. (role: adjacent exact-review contributor; confidence: medium; commits: 0925ecae3787; files: src/clawsweeper.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Wait for the current required checks to become terminal before landing.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

History

Review history (3 earlier review cycles)
  • reviewed 2026-08-01T04:06:23.862Z sha 8f83919 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-01T04:22:18.027Z sha 8f83919 :: needs changes before merge. :: [P3] Move the pure hot-intake unit test to a focused file
  • reviewed 2026-08-01T05:31:51.543Z sha c29ef92 :: needs maintainer review before merge. :: none

@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 Aug 1, 2026
@brokemac79
brokemac79 force-pushed the codex/csw-088-hot-intake-exact-suppression branch from 8f83919 to c29ef92 Compare August 1, 2026 05:26
@brokemac79
brokemac79 marked this pull request as ready for review August 1, 2026 05:27
@brokemac79

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 1, 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: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@brokemac79
brokemac79 force-pushed the codex/csw-088-hot-intake-exact-suppression branch from c29ef92 to 54e6e47 Compare August 1, 2026 05:50
@brokemac79
brokemac79 merged commit 0ced0b5 into main Aug 1, 2026
11 checks passed
@brokemac79
brokemac79 deleted the codex/csw-088-hot-intake-exact-suppression branch August 1, 2026 05:58
azaj01 pushed a commit to azaj01/clawsweeper that referenced this pull request Sep 21, 2026
* fix(review): suppress fresh exact hot-intake duplicates

* test(review): locate hot intake assertions with scheduler

* fix(review): fence hot intake exact snapshots
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. 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.

1 participant