Skip to content

fix(apply): stop own acknowledgement edits from requeueing source drift - #1715

Merged
steipete merged 4 commits into
mainfrom
fix/source-drift-requeue-loop
Sep 30, 2026
Merged

steipete merged 4 commits into
mainfrom
fix/source-drift-requeue-loop

Conversation

@steipete

@steipete steipete commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Close-proposal PRs were being re-reviewed forever. Every exact review ended with skipped_changed_since_review ("updated_at changed", sourceDriftVerified: true), which requeued a fresh source_drift_requeue review that hit the same drift. openclaw/openclaw#126549 ran revisions 13 through 25 on one unchanged head (f96bfcce), and its durable review comment was last updated on 2026-09-22. openclaw/openclaw#158447 reached revision 160.

The drift came from ClawSweeper itself. Apply freshness now treats ClawSweeper's own review-acknowledgement progress edit as automation-only activity, but only when the review's complete activity receipt proves nothing else changed. Real external changes still block apply and requeue, exactly as before.

Root cause

For PRs with an acknowledgement comment (<!-- clawsweeper-pr-ack:… item=N -->), the exact-review workflow runs update-review-status twice. It first marks the comment "reviewing", just before the review snapshot. It then marks it "complete" after Codex finishes, which is before the direct-publication apply. GitHub moves the PR's updated_at when a comment is edited:

The review therefore stores item_updated_at as the time of the "reviewing" edit, and the "complete" edit always counts as post-snapshot activity.

For close proposals and guarded actions, createApplySourceFreshness().reviewedSourceFresh() accepts an updated_at change only through four automation witnesses:

  • the durable review comment
  • a recorded label sync
  • the issue-only report-owned lease comment
  • the command-status comment for retry_pr_close_coverage_proof

None of these matches the acknowledgement comment, so apply reports source drift. The run then gets a source_drift disposition, the lifecycle requeues, and the loop starts again.

Two details explain the pattern seen in production:

  • Only close proposals loop. Keep-open reviews never reach this gate.
  • #158447 escaped once. At rev 160 the apply read an updated_at that lagged the edit by 2 s. Replaying the edited state on main shows it drifts too.

Change

  • src/clawsweeper-apply-source-freshness.ts adds a fifth automation witness. It fires only when all of these hold:
    • the item's updated_at changed since the review;
    • the review has complete activity identity (source revision, timeline revision, PR head, review-activity cursor);
    • a ClawSweeper-authored comment carrying this item's clawsweeper-pr-ack marker has updated_at equal to the item's latest updated_at;
    • the live complete activity receipt still matches the review.
  • The witness reuses the apply's existing comment read (earlyLeaseState.comments), so it adds no GitHub request.
  • Anything the receipt covers still blocks apply: human or other-bot comments and edits, title/body or non-managed label edits, PR reviews and review comments, new heads, tuple-less legacy reviews, and truncated activity.
  • AGENTS.md, docs/scheduler.md, and CHANGELOG.md describe the narrowed allowance.
  • scripts/e2e/apply-source-drift-final-effect.mjs (with its -server.cjs) is a reusable real-transport proof harness; it is test-only and changes no production code.

Behavior proof

Real transport final-effect proof

Contract

  • Claim: On the production write path, with native gh as the transport, origin/main turns ClawSweeper's own acknowledgement "complete" edit into source drift and requeues without publishing anything. This branch publishes instead: durable comment sync, label reconciliation, and, for a close-capable record, the close request. On both builds, a human comment, a new PR head, or a title edit after the snapshot is rejected before any close, durable-comment or label effect.

  • Exercised surface:

    • the compiled apply-decisions CLI in non-dry-run mode, with the exact argument set of src/repair/publish-event-result.ts runApplyDecisions;
    • ClawSweeper's own acknowledgement edits, made by the compiled dist/repair/update-review-status.js (--state reviewing before the snapshot, --state complete after it), as the workflow does;
    • exactEventApplyProof / eventApplyRequeueLatestExpected from the same build, applied to the apply report to get the requeue decision.
    • Transport: both CLIs spawn native gh 2.101.0 from PATH, with no GH_BIN override, no stand-in client and no production-code hook. gh reaches a stateful synthetic GitHub API over its documented http_unix_socket option, the same pattern as docs/proof/paired-close-drift. Proxies point at an unreachable port.
  • Fixture:

    • Seeds are captured live state of fix(chat): restore active turns after cursor reconnects openclaw#126549 and fix(updater): identify the config-read child by env, not by import query openclaw#158447, taken with read-only native gh GETs plus the production review-activity GraphQL query on 2026-09-30.
    • Each seed is rewound to its looping run's exact-review snapshot:
      • the lease comment and owner come from the run log (#126549 rev 23 / run 36365080254; #158447 rev 160 / run 36361287813);
      • comments and timeline are filtered to entries before the snapshot;
      • the durable comment body is the loop-window recording;
      • labels are the at-apply set.
    • The API reproduces GitHub's side effects for comment, label, title and close writes (updated_at bumps and timeline events). A push is modelled as a head-SHA change plus a head_ref_force_pushed event. Every request is recorded with method, path, status, actor, GraphQL operation and effect.
    • Three records:
      • #126549 as reviewed (implemented_on_main);
      • #158447 as reviewed (implemented_on_main);
      • a close-capable #126549 variant (stalled_unproven_pr). Its live guards are all met by the captured state: rating D, needs-proof label since 2026-08-20, no head activity since 2026-08-20, no human engagement. This variant proves the fresh path reaches gh pr close, and that the stale scenarios never do.
  • Sequence per scenario:

    1. ack → reviewing
    2. snapshot and record
    3. scenario write
    4. ack → complete
    5. apply

    The scenario write uses the PR author's token, or a synthetic push. It comes before the ack "complete" edit, so the ClawSweeper edit is the latest update: exactly the case the new allowance must not mask.

  • Command and environment:

    • Capture: node scripts/e2e/apply-source-drift-final-effect.mjs capture --gh gh --out .artifacts/lane-a/real-transport/seeds.
    • Run: node scripts/e2e/apply-source-drift-final-effect.mjs run --seed-dir .artifacts/lane-a/real-transport/seeds --baseline <origin/main checkout> --candidate <branch checkout> --out .artifacts/lane-a/real-transport/run.
    • Environment: Node v24.21.0, native gh 2.101.0, macOS, local.
    • Baseline 0f5162431a (origin/main); candidate caa9e1eb3e (this branch). HEAD 2004c55fee adds only the harness, and its SHA-256 matches run.log.
    • 24 runs, all exit 0, 0 synthetic-API errors, 7m51s.
  • Artifacts: under .artifacts/lane-a/real-transport/:

    • run/summary.json;
    • per run run/<item>-<record>-<scenario>-<build>/, containing requests.tsv (every request: method, path, status, actor, GraphQL operation, effect), http-trace.jsonl, apply-report.json, apply.stdout.log / apply.stderr.log, report-before.md, report-after*.md and final-state.json;
    • run.log, which records the Node and gh versions, both heads, and the harness and seed SHA-256s.

Observed final effects (apply phase, writes only)

Scenario Record origin/main 0f5162431a branch caa9e1eb3e
(a) ack "complete" edit only #126549 as reviewed skipped_changed_since_review (updated_at changed), requeue. Writes: apply-lease create/delete only. 0 durable comment, 0 labels, 0 close no requeue: durable comment PATCH …/comments/5351817173 200, then kept_open by the paired-closeout gate. 0 close
(a) #158447 as reviewed drift, requeue. Lease only no requeue: removeLabelsFromLabelable [status: 👀 ready for maintainer look], durable PATCH …/comments/5841242718 200, kept_open (paired closeout). This matches what production rev 160 did when its stale read avoided drift
(a) #126549 close-capable drift, requeue. Lease only. 0 close requests no requeue: durable PATCH 200, closeout note POST 201, gh pr close → GraphQL PullRequestByNumber + PullRequestClose 200 (1 close request), then lease DELETE
(b) human comment after the snapshot all three records drift (updated_at changed), requeue. Lease create/delete only. 0 close, 0 durable, 0 labels identical to main: 0 close, 0 durable, 0 labels
(c) new PR head after the snapshot all three records drift (live PR head 3333… differs from reviewed head …), requeue. No writes at all: rejected before lease acquisition identical: no writes
(d) title edit after the snapshot all three records drift (updated_at changed), requeue. Lease only. 0 close, 0 durable, 0 labels identical: 0 close, 0 durable, 0 labels

Across the 24 runs there was exactly one close request: the close-capable (a) scenario on the branch. For pull requests the production close path is gh pr close, so the close request is the GraphQL closePullRequest mutation, not a REST PATCH state=closed. The server records both forms. The apply-lease comment create/delete is ClawSweeper's own coordination write, made before classification on both builds; this change does not touch it.

Limits

  • Synthetic API, not GitHub. It models the REST and GraphQL response shapes that native gh parses, plus GitHub's updated_at and timeline effects. No real GitHub object is mutated. Transport is a Unix socket, not TLS.
  • Reconstructed records. The review records are reconstructed from durable markers and run logs, as in the replay below. The close-capable variant's close reason is synthetic; the real verdict on #126549 was implemented_on_main, which the paired-closeout gate keeps open.
  • Lifecycle not executed. The apply CLI is invoked directly with publish-event-result's arguments. That wrapper's Worker record store and the sweep.yml Finalize requeue are not run; the requeue decision comes from the production proof functions.
  • Not in this matrix: a submitted PR review (the receipt's review-activity cursor covers it), and a human change after the ack edit (covered by the offline replay and the unit tests).

Offline replay (dry-run)

Contract

  • Claim: For a PR close proposal whose only post-snapshot change is ClawSweeper's own acknowledgement progress edit, the direct-publication apply no longer reports source drift, so the lifecycle does not requeue source_drift_requeue. A human comment, title edit, label edit, or new head in the same window still reports drift and requeues.
  • Exercised surface:
    • the built apply-decisions CLI, run with the argument set from src/repair/publish-event-result.ts runApplyDecisions plus --dry-run;
    • exactEventApplyProof / eventApplyRequeueLatestExpected applied to its report to get the requeue decision.
  • Fixture:
    • Data comes from the real fix(chat): restore active turns after cursor reconnects openclaw#126549 (rev 23, run 36365080254) and fix(updater): identify the config-read child by env, not by import query openclaw#158447 (rev 160, run 36361287813). It was recorded once with read-only GitHub GETs and one GraphQL query: the item, comments, timeline, pull, files, commits, review-activity cursor, and linked items.
    • The data is rewound to the state at apply time: the lease comment is present, the ack comment and the item share updated_at = T_complete, and the stored item_updated_at is T_review.
    • The report's activity identity is recomputed with the production digests. Its source revision matches the production durable markers exactly: 9e5dbde8… for #126549 and 1240e8a6… for #158447 rev 160.
    • The replay gh refuses all non-read calls, and in replay mode it refuses any unrecorded read.
  • Command and environment: run-proof.sh <worktree> <dist@8d659e7cb9> <dist@c8aa82b6aa> <out>, run offline with Node v24.21.0 on macOS (local, no container).
  • Artifacts: .artifacts/lane-a/proof/summary.json, per-run apply.log, gh-calls.jsonl and report-before.md, plus the harness and fixture hashes in the handoff.

Observed (22 runs, all exit 0, no missing recordings)

item scenario main 8d659e7 branch c8aa82b
#126549 review-time control (updated_at unchanged) applied, no requeue applied, no requeue
#126549 ack "complete" edit only source_drift, requeue (updated_at changed) applied, no requeue (synced + kept_open by paired-closeout gate)
#126549 human comment under the ack edit source_drift, requeue source_drift, requeue
#126549 human comment after the ack edit source_drift, requeue source_drift, requeue
#126549 human title edit under the ack edit source_drift, requeue source_drift, requeue
#126549 maintainer label under the ack edit source_drift, requeue source_drift, requeue
#126549 new head source_drift, requeue source_drift, requeue
#158447 review-time control applied, no requeue applied, no requeue
#158447 ack "complete" edit only source_drift, requeue applied, no requeue
#158447 human comment under the ack edit source_drift, requeue source_drift, requeue
#158447 new head source_drift, requeue source_drift, requeue

The main result for the ack-only scenario matches the production apply output for #126549 in run 36361785207 exactly: skipped #126549: updated_at changed, sourceDriftVerified: true.

Limits

  • Runs use dry-run apply, so no GitHub writes happen. A record/replay stand-in replaces the stock gh HTTP transport.
  • The report bodies and sections are reconstructed. The close reason, fixed PR, lease, and timestamps come from the durable markers and run logs.
  • The PR-review scenario is covered by the receipt's review-activity cursor, not by a separate replay.
  • There is no post-deploy production confirmation yet. After deploy, #126549 should publish its durable comment on its next review instead of reaching rev 26+.

Validation

  • test/apply-source-freshness.test.ts (new) holds unit tests for the witness with its six negative cases, plus two apply-decisions CLI regressions in the real #126549 shape.
    • Against the origin/main build, 2 of 4 fail with skipped_changed_since_review / updated_at changed / sourceDriftVerified.
    • On this branch, 4/4 pass at the merged head.
  • Real-transport matrix, as above: 24/24 runs exit 0, with 0 synthetic-API errors.
  • PATH=/opt/homebrew/bin:$PATH CLAWSWEEPER_TEST_CONCURRENCY=6 pnpm run check on 2004c55fee, under Node v26.10.0 from that PATH and bash 5.3, on a host at load average 65–98 from parallel lanes:
    • Static checks pass: format (including the new harness), docs, limits, dashboard boundary and strict checks.
    • build:all, lint (including lint:scripts) and changed coverage (13/13) pass.
    • The full suite ran 7094 tests: 7043 passed, 37 skipped, 14 failed. All 14 are timeout- or process-group-sensitive tests in untouched files: codex process/process-group, codex review runner, local-range, Windows git acquisition, target checkout, setup-openclaw-codex-source, and the repair command-proof-consumer, proof-command and execute-fix-fast-rebase e2e tests.
    • Rerun alone with the same PATH and Node, those 10 files pass 179/179 (.artifacts/lane-a/check3-isolated-rerun.log).
    • None of the failing files touch apply freshness. On the earlier head, c8aa82b6aa, the same families timed out under load and passed in isolation.

OpenClaw Bay: not affected. The change narrows the apply-time source-drift classification. It adds no queue or lifecycle field, published schema, status value, route, or control. Bay continues to show the same lifecycle outcomes: after this change these items show up as publications instead of source-drift requeues.

Risks / rollback

  • The witness trusts one more ClawSweeper-authored comment as the explanation for an updated_at bump. The trust boundary is the same one used by the existing durable-comment and owned-lease witnesses: GitHub-verified bot authorship and exact updated_at equality. It also requires the complete source, timeline, head, and review-activity receipt to match, which is stricter than the lease witness's legacy fallback. Human edits to ClawSweeper-managed labels (status:, rating:, P*, proof: except proof: override) remain outside the receipt, as they already are for the existing witnesses.
  • The apply-proof post-proof freshness gate is unchanged. In normal flows it compares against receipts recorded after ClawSweeper's own later durable-comment sync.
  • Rollback is a revert of c8aa82b6aa; the harness commit is test-only. The loop behavior returns, but nothing is persisted differently.

Live impact on 2026-09-30

The loop is still burning review capacity in production. Each item below receives a full exact review about every 8 minutes, and every one ends in skipped #N: updated_at changed → requeue_latest=true → source_drift_requeue.

Item Revision Sample run
openclaw/openclaw#97616 546 —
openclaw/openclaw#123774 284 https://github.com/openclaw/clawsweeper/actions/runs/36649664981
openclaw/openclaw#151012 77 https://github.com/openclaw/clawsweeper/actions/runs/36649521353
openclaw/openclaw#139260 59 https://github.com/openclaw/clawsweeper/actions/runs/36649295810
openclaw/openclaw#143911 52 https://github.com/openclaw/clawsweeper/actions/runs/36649176048

These five items alone consume about 35 full reviews/hour, while seven-day coverage has fallen to 35.3%. After merge, the verification is that these items publish (review_comment_synced or their close proposal) and stop receiving source_drift_requeue generations.

Review

Codex /review (autoreview, branch mode against current origin/main, P0–P1 threshold):

  • clean on 72447ed127 (0.88);
  • clean again on head 2004c55fee after the real-transport harness and main merge (0.86). It confirmed that the acknowledgement exception requires bot ownership, a matching latest-update timestamp and a complete matching activity receipt.

ClawSweeper's P1 on 72447ed127 (no final-effect proof) is addressed by the "Real transport final-effect proof" subsection above. The real gh client ran against a stateful synthetic GitHub API:

  • the acknowledgement-only case publishes on this branch, including exactly one close request for a close-capable record;
  • a human comment, new head or title edit after the snapshot is rejected with zero close, durable-comment or label writes on both builds.

The local full check timed out 14 load-sensitive tests in untouched files on an overloaded host (they pass 179/179 when rerun alone). CI on this head is the clean full-check gate.

Note: this PR also updates the AGENTS.md Safety Rules drift line, so the documented policy names the owned acknowledgement-progress edit, conditioned on a matching receipt.

Exact PR review marks ClawSweeper's acknowledgement comment
(clawsweeper-pr-ack) complete after the review snapshot and before direct
publication. GitHub moves the PR updated_at for that edit, so close
proposals failed apply freshness with skipped_changed_since_review
("updated_at changed", sourceDriftVerified) and requeued another
source_drift_requeue review, which repeated the same edit forever
(openclaw/openclaw#126549 reached revision 25 on one head; #158447 revision
160 escaped only through a stale item read).

Apply freshness now accepts that edit as automation-only when a
ClawSweeper-authored acknowledgement for this item carries the item's
latest updated_at and the review's complete source, timeline, PR head, and
review-activity receipt still matches. Human comments, title/body and
non-managed label edits, PR reviews, new heads, other bots' comment edits,
and tuple-less legacy reviews still block apply and requeue as before.
@clawsweeper

clawsweeper Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P1 Urgent regression or broken agent/channel workflow affecting real users now. merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 30, 2026
@clawsweeper

clawsweeper Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 29, 2026, 11:41 PM ET / September 30, 2026, 03:41 UTC (Revision 2).

ClawSweeper review

What this changes

The branch lets apply accept a ClawSweeper-authored PR acknowledgement edit when the complete review activity receipt still matches, and adds regression tests, a transport proof harness, and operator documentation.

Merge readiness

✅ Ready for maintainer review

Keep open. Current main still rejects the bot’s acknowledgement edit as source drift. The new final-effect evidence addresses the prior review’s proof request, and this review found no blocking patch defect.

Priority: P1
Reviewed head: 2004c55fee41a4654f585c708a92b0d1f85c39cf

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The narrow guard and final-effect scenario results provide solid review confidence, with raw trace artifacts remaining local to the author’s run.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The PR reports a non-dry-run production apply CLI using native gh against a stateful synthetic GitHub API: acknowledgement-only activity reached publication and one eligible close, while a human comment, title edit, and changed head produced no close, durable-comment, or label effect. The local raw trace files were not attached, but the PR body records the relevant request results. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR reports a non-dry-run production apply CLI using native gh against a stateful synthetic GitHub API: acknowledgement-only activity reached publication and one eligible close, while a human comment, title edit, and changed head produced no close, durable-comment, or label effect. The local raw trace files were not attached, but the PR body records the relevant request results. No stored-data contract changes.
Evidence reviewed 8 items Current main: Main's automation-only witnesses do not include PR acknowledgement edits, so an acknowledgement-driven updated_at change reaches the source-drift path.
Introduced guard: The new witness requires an updated item, complete review identity, a matching bot-authored acknowledgement marker and timestamp, and a matching complete activity receipt.
Receipt boundary: Apply compares reviewed source and timeline revisions, the PR head, and the review activity cursor against a complete live context.
Findings None None.
Security None None.

How this fits together

Exact review records a snapshot before ClawSweeper marks its acknowledgement complete. The apply lane compares that snapshot with live GitHub activity before publishing the durable review, syncing labels, or closing an item.

flowchart LR
A[Exact review snapshot] --> B[Acknowledgement edit]
B --> C[Apply freshness check]
D[Live activity receipt] --> C
C -->|Matches| E[Publish review and eligible close]
C -->|Changed| F[Requeue review]
Loading

Before merge

None.

Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Code growth production +22 lines; tests and proof harness +1,581 lines The small production exception is supported by extensive regression and final-effect coverage.

Technical review

Best possible solution:

An exact review should publish after ClawSweeper’s own acknowledgement edit while any changed human activity, title, or PR head still forces a fresh review.

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

Yes. The PR documents a controlled current-main apply run in which an acknowledgement-only edit yields source drift and requeue, while the candidate proceeds to publication.

Is this the best way to solve the issue?

Yes. The exception is confined to a bot-authored acknowledgement with matching item identity, latest timestamp, and complete live receipt; the documented outside-activity cases remain rejected.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 0f5162431a34.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR reports a non-dry-run production apply CLI using native gh against a stateful synthetic GitHub API: acknowledgement-only activity reached publication and one eligible close, while a human comment, title edit, and changed head produced no close, durable-comment, or label effect. The local raw trace files were not attached, but the PR body records the relevant request results. No stored-data contract changes.
  • 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 reports a non-dry-run production apply CLI using native gh against a stateful synthetic GitHub API: acknowledgement-only activity reached publication and one eligible close, while a human comment, title edit, and changed head produced no close, durable-comment, or label effect. The local raw trace files were not attached, but the PR body records the relevant request results. No stored-data contract changes.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P1: The live source-drift loop repeatedly consumes exact-review capacity and delays publication for affected PRs.
  • merge-risk: 🚨 automation: The changed freshness decision controls whether exact reviews publish or enter another requeue cycle.
  • merge-risk: 🚨 security-boundary: The new bot-activity witness can admit a close-capable apply path, making rejection before the final close effect important.
  • 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 reports a non-dry-run production apply CLI using native gh against a stateful synthetic GitHub API: acknowledgement-only activity reached publication and one eligible close, while a human comment, title edit, and changed head produced no close, durable-comment, or label effect. The local raw trace files were not attached, but the PR body records the relevant request results. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR reports a non-dry-run production apply CLI using native gh against a stateful synthetic GitHub API: acknowledgement-only activity reached publication and one eligible close, while a human comment, title edit, and changed head produced no close, durable-comment, or label effect. The local raw trace files were not attached, but the PR body records the relevant request results. No stored-data contract changes.

Evidence

What I checked:

  • Current main: Main's automation-only witnesses do not include PR acknowledgement edits, so an acknowledgement-driven updated_at change reaches the source-drift path. (src/clawsweeper-apply-source-freshness.ts:269, 0f5162431a34)
  • Introduced guard: The new witness requires an updated item, complete review identity, a matching bot-authored acknowledgement marker and timestamp, and a matching complete activity receipt. (src/clawsweeper-apply-source-freshness.ts:277, 2004c55fee41)
  • Receipt boundary: Apply compares reviewed source and timeline revisions, the PR head, and the review activity cursor against a complete live context. (src/clawsweeper-apply-decision-workflow.ts:1119, 2004c55fee41)
  • Final-effect harness: The added harness invokes compiled acknowledgement and non-dry-run apply CLIs through native gh, records HTTP effects, and includes acknowledgement-only, human-comment, title-edit, and changed-head scenarios. (scripts/e2e/apply-source-drift-final-effect.mjs:478, 2004c55fee41)
  • After-fix observations: The PR body reports 24 baseline/candidate runs: the candidate reached one close request in the eligible acknowledgement-only case and made no close, durable-comment, or label writes for the human-comment, title-edit, or changed-head cases. The underlying local trace files were not attached to the reviewed snapshot.
  • Prior review disposition: The prior completed ClawSweeper review requested final-effect proof for a human comment and changed head; the current PR body supplies those scenarios. Its prior finding list was empty.

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Goutam Adwant: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 (1 earlier review cycle)
  • reviewed 2026-09-30T00:37:43.616Z sha 72447ed :: needs real behavior proof before merge. :: none

Drive the compiled non-dry-run apply-decisions CLI (exact-event publication
arguments) and ClawSweeper's own update-review-status acknowledgement edits
through native gh over http_unix_socket to a stateful synthetic GitHub API
seeded from a captured PR and rewound to its exact-review snapshot. The API
models updated_at and timeline effects of comment, label, title, push and
close writes and traces every request, so each scenario records the final
GitHub effects (close request, durable comment sync, label edits, lease
writes) for a baseline and a candidate build without mutating GitHub.
@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 status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Sep 30, 2026
@steipete
steipete merged commit 3be6719 into main Sep 30, 2026
26 of 28 checks passed
@steipete
steipete deleted the fix/source-drift-requeue-loop branch September 30, 2026 04:22
steipete added a commit that referenced this pull request Oct 1, 2026
…shness (#1734)

* fix(apply): accept receipt-backed own writes in deferred re-apply freshness

A close proposal that its exact-review producer kept open (durable comment
synced, close gate kept_open) ends with the producer releasing its review
lease, which deletes the lease comment and moves the PR updated_at. When
direct publication was deferred, the batch publisher re-applied the same
review, saw that bump as source drift, recorded skipped_changed_since_review,
and requeued a full source_drift_requeue review about every 23 minutes
(openclaw/openclaw#143911 runs 36671559049 -> 36672608523 -> 36673368897,
openclaw/openclaw#139260 run 36673226845).

Apply freshness now generalizes the acknowledgement witness from #1715 into
one receipt check for ClawSweeper's own writes. An update after the review
snapshot is automation-only when a ClawSweeper-recorded receipt for the item
accounts for the latest updated_at: a live ClawSweeper item-marker comment or
a ClawSweeper-actor timeline event (managed label edit) with exactly that
time, or the review generation's own lease comment is gone while the durable
review comment carries that generation's review-version marker (item,
reviewed_at, source revision, lease owner, lease comment id), was synced after
the snapshot, and the update follows the generation's last recorded write by
at most the five-minute apply-lease hold. Every receipt also requires the
complete source, timeline, head, and review-activity receipt to match and no
non-automation comment, review comment, or timeline event after the snapshot.
Human comments, title/body or label edits, PR reviews, and new heads still
block and requeue.

The real-transport e2e harness gains the #143911 producer-then-batch shape and
external-change controls.

* docs(changelog): add receipt-based freshness fragment

* fix(apply): match every ClawSweeper item marker kind in freshness receipts

* docs(proof): record receipt-based freshness batch re-apply proof

* docs(agents): describe receipt-based apply drift allowance

* test(e2e): restore the durable comment's snapshot body from its edit history

* docs(proof): add #1715 regression rerun to receipt-based freshness proof
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. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. P1 Urgent regression or broken agent/channel workflow affecting real users now. 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