Skip to content

fix(review): suppress owned activity churn - #1007

Merged
brokemac79 merged 1 commit into
openclaw:mainfrom
PollyBot13:fix/review-storm-self-activity
Aug 3, 2026
Merged

brokemac79 merged 1 commit into
openclaw:mainfrom
PollyBot13:fix/review-storm-self-activity

Conversation

@PollyBot13

@PollyBot13 PollyBot13 commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Scheduled hot intake can repeatedly run a full review on an unchanged issue or PR after ClawSweeper updates its own durable review comment or labels. GitHub may publish the item updated_at after the local sync timestamp, so bot-owned activity can be mistaken for fresh target activity.

Fixes #1006.

Why This Change Was Made

Production run https://github.com/openclaw/clawsweeper/actions/runs/30704608131 reviewed openclaw/clickclack#117 at unchanged head d26c11abba773132c51defb6e647db3a69610003. The review completed at 14:52:41Z, the durable comment synced at 14:53:28Z, and GitHub advanced the PR updated_at to 14:53:29Z. Scheduled hot intake then treated that server-side timestamp as uncaptured activity and ran another full review with zero cache hits.

The original version of this PR persisted the post-mutation timestamp and treated exact equality as ownership. Review correctly identified that as unsafe: an independent target-side update can share GitHub's second-level timestamp.

The revised design keeps the timestamp only as an observation and requires a complete structural ownership receipt before suppressing work:

  • scheduler and hot-intake paths fail open for timestamp-only or incomplete evidence;
  • structural-cache reuse requires matching source and non-automation timeline revisions;
  • PR receipts additionally bind the reviewed head and review-activity cursor;
  • apply/close paths require complete, non-truncated activity hydration;
  • same-second human activity invalidates the receipt, while same-second activity already included in the review remains covered;
  • post-proof covering-PR freshness is bound to a full structural snapshot digest rather than updated_at alone;
  • legacy records without the new receipt retain conservative behavior.

Fresh and cache-hit reports now persist review_timeline_revision, allowing exact same-second discrimination without weakening fail-open behavior.

User Impact

  • Stops ClawSweeper from amplifying its own label and durable-comment writes into repeated reviews.
  • Preserves immediate review eligibility for pushes, comments, reviews, state changes, and ambiguous activity.
  • Preserves daily and weekly coverage cadence.
  • Keeps existing records safe during rollout.

Evidence

Exact reviewed head: 614b40460164b02fe8082fbaa29923d9e9dac9c9
Base: 4f67ca516da0fc29fed5ae2b8e17fce14d49354d

  • pnpm run check passed locally: static checks, production and repair builds, dashboard build, lint, changed coverage, and the full 218-file test/coverage suite.
  • Full-suite coverage: 80.74% lines, 73.56% branches, and 87.10% functions.
  • The focused changed-surface regression set passed 145/145; the persisted-receipt recheck regression set passed 10/10 after the review repair.
  • git diff --check origin/main...HEAD passed.
  • Pre-commit review identified that a prior-run automation receipt needed the same complete identity binding as a current-run receipt. The rebase now accepts it only when timestamp, source/timeline revisions, PR head, and activity cursor all match; a regression covers both the match and mismatch paths.
  • The repeated pre-commit review and the final committed-range Codex review found no correctness issues.
  • Hosted CodeQL, Windows launcher, sparse-repair smoke, and full pnpm check gates passed on this exact head.

Real Behavior Proof

Claim: an automation-owned metadata mutation is structurally covered, while later target-side activity remains review-eligible and invalidates cache reuse.

Exercised surface: the exact-head build loaded shouldReviewItem, reviewStructuralRecordFromGraphql, and reviewStructuralCacheDecision from the compiled PR head.

Scenario and environment: Node 26.5.1 ran the exact head against live GraphQL records from a disposable public fork PR whose base and head were the literal SHAs above. The controlled mutation used the fork-only proof: owned activity label; the target-side mutation edited the disposable PR body.

Observed result:

  1. The owned label mutation advanced GitHub updatedAt from 2026-08-03T18:43:44Z to 2026-08-03T18:44:31Z while the filtered structural source revision remained identical. The scheduler admitted structural verification and the cache returned hit.
  2. The later body edit advanced updatedAt to 2026-08-03T18:44:33Z, changed the structural source revision, and the same exact-head decision failed open with source_changed.

Artifact: the full JSON transcript is inspectable at PollyBot13#3 (comment).

Limits: this controlled proof validates GitHub timestamp ordering plus the scheduler/structural-cache decision boundary. It does not enqueue production reviews, mutate production records, or exercise the full production apply workflow.

Original production-ordering proof

The earlier disposable run remains inspectable at PollyBot13#1 (comment). It demonstrates the original delayed GitHub timestamp ordering on the first implementation head. The current-head proof above supersedes it for the rebased structural-receipt behavior.

AI-assisted

Implemented and reviewed with Codex. Production GitHub state, repository history, both disposable proofs, the full local gate, hosted CI, and independent pre-commit and committed-range reviews were used as evidence.

@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 3, 2026, 3:08 PM ET / 19:08 UTC.

ClawSweeper review

What this changes

The branch records a complete activity identity after ClawSweeper writes comments or labels, then uses it to avoid redundant scheduled reviews while failing open for changed or incomplete GitHub activity.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

This PR remains necessary because current main does not yet contain the structural activity receipt that distinguishes delayed ClawSweeper writes from subsequent target activity. The patch has no supported correctness finding in this review and includes current-head live proof; it needs normal maintainer review because it changes shared review-admission automation. Likely related people: brokemac79 (high confidence) and steipete (medium confidence).

Priority: P2
Reviewed head: 614b40460164b02fe8082fbaa29923d9e9dac9c9

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Strong current-head live proof and broad focused regression coverage support a mergeable patch, with normal maintainer attention appropriate for the shared automation surface.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): The PR body provides a current-head linked live GitHub transcript showing an owned metadata update receives structural cache reuse and a later target-side body edit fails open; it directly supports the changed runtime boundary.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The PR body provides a current-head linked live GitHub transcript showing an owned metadata update receives structural cache reuse and a later target-side body edit fails open; it directly supports the changed runtime boundary.
Evidence reviewed 6 items Current main lacks this receipt: The current main revision has no occurrence of automation_item_updated_at, automationItemUpdatedAt, or review_timeline_revision; the proposed behavior is not already implemented.
Receipt is propagated through the changed boundary: The PR adds the persisted automation timestamp and timeline revision, admits timestamp ambiguity to structural verification, and requires structural-cache comparison rather than treating synchronization clocks as ownership proof.
Same-second collisions remain fail-open: The structural-cache regressions cover an automation timestamp match with changed labels or timeline activity and expect source_changed, rather than a cache hit.
Findings None None.
Security None None.

How this fits together

ClawSweeper selects GitHub issues and pull requests for review from their activity, may reuse a structural cache result, and later synchronizes review comments and labels. The changed receipt follows that lifecycle so a delayed GitHub updated_at caused by ClawSweeper itself does not trigger another expensive review, while user activity still invalidates reuse.

flowchart LR
  A[GitHub issue or PR activity] --> B[Scheduled hot intake]
  B --> C[Complete activity receipt]
  C --> D[Structural cache decision]
  D --> E[Full review or cache reuse]
  E --> F[Review comment and label sync]
  F --> G[Apply freshness recheck]
Loading

Before merge

  • Resolve merge risk (P1) - This shared scheduler/cache/apply change could either skip legitimate review activity if a receipt match is too permissive or increase review load if a valid owned update fails to match; the reviewed paths are designed to fail open, but maintainers should monitor the first scheduled cycles after landing.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Changed surface 23 files affected The change spans scheduling, structural cache reuse, apply freshness, close-proof freshness, record metadata, and regression coverage.
Production and test delta production +327/-94, tests +427/-25 The implementation grows shared automation logic substantially, with more added test coverage than production lines to exercise receipt and collision boundaries.

Merge-risk options

Maintainer options:

  1. Merge with operational observation (recommended)
    Accept the bounded automation risk after normal maintainer review and verify the next scheduled cycles reuse only complete owned receipts while changed target activity remains eligible.

Technical review

Best possible solution:

Land the structural-receipt approach only with its complete source, timeline, pull-head, and review-cursor bindings intact, then confirm operational telemetry shows cache reuse for owned mutations and fresh review admission for subsequent target activity.

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

Yes, source and supplied current-head live proof provide a high-confidence path: an automation-owned label mutation preserves the structural receipt and hits the cache, while a later body edit changes the source revision and fails open. This review did not rerun the suite because the checkout is read-only and must remain byte-for-byte clean.

Is this the best way to solve the issue?

Yes. A complete structural receipt is a narrower and safer solution than timestamp-only suppression because it binds source and timeline state, and for pull requests also binds the reviewed head and review-activity cursor.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 4f67ca516da0.

Labels

Label justifications:

  • P2: The PR addresses redundant review automation with limited but real operational impact, without evidence of data loss, security bypass, or runtime unavailability.
  • merge-risk: 🚨 automation: Merging changes the scheduler, cache, and apply decisions that determine whether automated reviews run or are skipped.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The PR body provides a current-head linked live GitHub transcript showing an owned metadata update receives structural cache reuse and a later target-side body edit fails open; it directly supports the changed runtime boundary.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides a current-head linked live GitHub transcript showing an owned metadata update receives structural cache reuse and a later target-side body edit fails open; it directly supports the changed runtime boundary.

Evidence

What I checked:

  • Current main lacks this receipt: The current main revision has no occurrence of automation_item_updated_at, automationItemUpdatedAt, or review_timeline_revision; the proposed behavior is not already implemented. (src/scheduler-policy.ts:85, 4f67ca516da0)
  • Receipt is propagated through the changed boundary: The PR adds the persisted automation timestamp and timeline revision, admits timestamp ambiguity to structural verification, and requires structural-cache comparison rather than treating synchronization clocks as ownership proof. (src/scheduler-policy.ts:85, 614b40460164)
  • Same-second collisions remain fail-open: The structural-cache regressions cover an automation timestamp match with changed labels or timeline activity and expect source_changed, rather than a cache hit. (test/review-structural-cache.test.ts:500, 614b40460164)
  • Apply freshness checks bind the full PR identity: Post-proof freshness compares source revision and complete activity receipt, then additionally requires the reviewed PR head and review-activity cursor before accepting a self-mutation update. (src/clawsweeper-apply-proof-freshness.ts:129, 614b40460164)
  • Feature-history routing: The immediate predecessor for exact hot-intake suppression is commit 0ced0b5e515bd8fa0d53e3af54392ac474547bf5, and central-path history names Martin Cleary and Peter Steinberger as contributors. (src/scheduler-policy.ts:85, 0ced0b5e515b)
  • Current-head proof and checks: The PR body supplies a current-head live GitHub transcript in a disposable fork: an owned label update produced a structural cache hit, while a later body edit changed the source revision and returned source_changed; the supplied check summary reports hosted CodeQL, Windows launcher, sparse repair smoke, and pnpm check passing. (test/scheduler-policy.test.ts:229, 614b40460164)

Likely related people:

  • brokemac79: Authored the merged immediate hot-intake suppression work that this PR extends with durable activity provenance. (role: recent area contributor; confidence: high; commits: 0ced0b5e515b; files: src/scheduler-policy.ts, src/clawsweeper-review-planning-hot-intake.ts)
  • steipete: Central scheduler, structural-cache, and freshness-path history attributes multiple contributions to Peter Steinberger, including the current baseline around this automation surface. (role: central-path contributor; confidence: medium; commits: df0e4d70165e; files: src/scheduler-policy.ts, src/review-structural-cache.ts, src/clawsweeper-apply-proof-freshness.ts)

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 (15 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-02T15:25:48.934Z sha 84160ed :: needs maintainer review before merge. :: none
  • reviewed 2026-08-02T17:36:00.671Z sha 84160ed :: needs maintainer review before merge. :: none
  • reviewed 2026-08-02T21:04:42.487Z sha 84160ed :: needs maintainer review before merge. :: none
  • reviewed 2026-08-03T01:08:36.048Z sha 84160ed :: needs maintainer review before merge. :: none
  • reviewed 2026-08-03T06:41:12.679Z sha 84160ed :: needs maintainer review before merge. :: none
  • reviewed 2026-08-03T09:05:45.260Z sha 84160ed :: needs maintainer review before merge. :: none
  • reviewed 2026-08-03T17:35:03.767Z sha 84160ed :: needs maintainer review before merge. :: none
  • reviewed 2026-08-03T19:03:24.526Z sha 614b404 :: 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
@PollyBot13

PollyBot13 commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor Author

Historical RCA: why the earlier fixes did not stop the review storm

Short version: no single recent PR introduced the whole failure. A latent timestamp-provenance ambiguity dates to the April scheduler work; later throughput changes amplified it from an occasional redundant review into a visible storm.

Timeline

  1. 21f9571 (25 April, ci: schedule reviews by activity cadence) made GitHub item updated_at part of review scheduling.
  2. 3ac50a8 (30 April, fix: harden clawsweeper scheduler fairness) added bot-owned synchronization timestamps. The safe boundary was effectively “at or before our locally recorded sync”; a later GitHub timestamp remained reviewable.
  3. #903 deliberately preserved that fail-open rule for activity 1–5 seconds after comment or label synchronization. That was the correct conservative choice without durable provenance: a nearby human update could not safely be distinguished from GitHub publishing ClawSweeper's own mutation late. The PR explicitly identified an exact-operation receipt as the proper future solution.
  4. #940, #955, #958, and #959 increased scheduled feed capacity, per-cycle candidate volume, and hot/normal cadence. They did not create the false-positive condition, but they gave it enough cadence and capacity to repeatedly select the same unchanged items.

Why #970 and #992 were insufficient

  • #970 fixed a separate duplicate path: equivalent CI check runs no longer create different cache identities for an unchanged head. That prevents duplicate CI data -> false cache miss, but it does not address ClawSweeper's own GitHub write -> false scheduler wake.
  • #992 correctly suppressed a fresh completed hot-intake review only when the persisted exact snapshot still matched the live PR. It intentionally failed open when activity timestamps differed. In the production failure, the local comment sync was recorded at 14:53:28Z, then GitHub authoritatively advanced the PR to 14:53:29Z; the snapshots therefore never matched, so the guard could not prove that the update was bot-owned.

Why the revised PR closes the gap

The original PR head used exact timestamp equality as ownership evidence. Review identified that as unsafe because independent target activity can share GitHub's second-level timestamp.

Current head 84160ed710bb1dae8a14115a2babdeb823b81056 keeps the authoritative timestamp only as an observation. Suppression now requires a complete structural receipt: source revision, non-automation timeline revision, and—for pull requests—the reviewed head and review-activity cursor. Incomplete or truncated evidence fails open. Exact regressions cover both directions of the same-second boundary: new human activity forces review, while activity already included in the reviewed timeline remains covered.

So the attribution is:

This also explains why the system appeared healthy before the July scaling work: the false-positive edge existed, but the older scheduler did not have the cadence and throughput to hammer it repeatedly.

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 1, 2026
@PollyBot13
PollyBot13 force-pushed the fix/review-storm-self-activity branch from ca43c93 to 84160ed Compare August 2, 2026 12:32
@PollyBot13

Copy link
Copy Markdown
Contributor Author

@codex review

@PollyBot13

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 2, 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:

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@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. and removed proof: sufficient Contributor real behavior proof is sufficient. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 2, 2026
@PollyBot13

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@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. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 2, 2026
@brokemac79 brokemac79 self-assigned this Aug 3, 2026
@PollyBot13

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 3, 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:

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 3, 2026
@brokemac79

Copy link
Copy Markdown
Contributor

Thank you, @PollyBot13, for the careful semantic rebase and the current-head proof. The receipt-based fix is clear, conservative, and well-tested—much appreciated.

@brokemac79
brokemac79 merged commit 326104b into openclaw:main Aug 3, 2026
16 checks passed
@brokemac79

Copy link
Copy Markdown
Contributor

Merged successfully as squash commit 326104b08f93941c21ab7afd2cd57a60b51ff583 from reviewed head 614b40460164b02fe8082fbaa29923d9e9dac9c9. This automatically closed #1006. Thanks again, @PollyBot13, for the contribution and careful follow-through.

azaj01 pushed a commit to azaj01/clawsweeper that referenced this pull request Sep 21, 2026
…llyBot13

Fixes openclaw#1006.\n\nThank you to @PollyBot13 for the report, semantic rebase, focused regressions, and current-head proof.\n\nCo-authored-by: PollyBot13 <[email protected]>
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.

Scheduled hot intake re-reviews unchanged PRs after owned comment timestamps outrun sync metadata

2 participants