fix(publication): keep current review results moving during historical cleanup#827
Conversation
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed July 24, 2026, 5:45 AM ET / 09:45 UTC. ClawSweeper reviewWhat this changesThe PR reserves up to two positions in each eight-item exact-review publication batch for recent protocol-v2 results that still match the queue head, while leaving the remaining positions in historical FIFO order and rechecking source drift before preparation. Merge readinessThis is a focused, evidence-backed scheduler change with credible controlled-runtime proof, but it intentionally introduces a new production admission policy. Keep this PR open and draft until a maintainer confirms whether reserving two of eight batch positions for recent authoritative results, with a 15-minute recency bound, is the desired operational policy. Priority: P2 Review scores
Verification
How this fits togetherExact-review results enter a Durable Object publication queue before batch workers prepare artifacts and publish marker-backed review outcomes to GitHub and the state repository. The changed admission scheduler chooses which ready publications are claimed next while the existing ownership, revision, artifact, and mutation fences protect delivery. flowchart LR
A[Completed exact reviews] --> B[Durable publication queue]
B --> C[Admission scheduler]
C --> D[Recent authoritative reserve]
C --> E[Historical FIFO selection]
D --> F[Claimed publication batch]
E --> F
F --> G[Revalidate source revision]
G --> H[Prepare and publish results]
Decision needed
Why: The patch preserves existing safety fences and provides a rollback flag, but the chosen ratio and time window intentionally trade some historical FIFO latency for bounded current-result service; that is an operational product decision rather than a mechanical correctness question. Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Agree on the desired fairness policy, land one explicit and reversible configuration, then observe current-result latency, actual published outcomes, historical drain, retry behavior, and dead-letter safety in production before further tuning. Do we have a high-confidence way to reproduce the issue? Yes, at source level: current admission is historical FIFO and the supplied production telemetry plus controlled exact-head Worker run describe the starvation scenario and the proposed bounded-service result. A production deployment has not yet validated the chosen operating point. Is this the best way to solve the issue? Unclear; the admission design is narrow, reversible, and supported by deterministic and controlled-runtime evidence, but the specific two-of-eight and 15-minute policy requires maintainer acceptance before it can be called the best production solution. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 822608f7ec54. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
@clawsweeper automerge |
|
🦞👀 Command router queued. I will update this comment with the next step. |
20b7f32 to
031ab30
Compare
|
Maintainer policy approval recorded: enable the fresh-authority lane by default with exactly 2 reserved positions in each 8-member publication batch and a 15-minute freshness window. Preserve 6 historical FIFO positions and the documented immediate rollback via EXACT_REVIEW_PUBLICATION_FRESH_LANE_ENABLED=0. This product-decision gate is approved for landing and rollout. |
First submitted: July 24, 2026, 3:14 AM (US Eastern Time) / 07:14 UTC.
Last body edit: July 24, 2026, 5:41 AM (US Eastern Time) / 09:41 UTC.
Latest head commit: July 24, 2026, 4:14 AM (US Eastern Time) / 08:14 UTC.
Closes #826
What Problem This Solves
Fixes an issue where newly completed exact reviews could remain unpublished behind a large historical publication backlog when the oldest queued rows were later proven stale or superseded.
Production telemetry showed the queue shrinking without current results becoming visible: at
2026-07-24T06:20:22Z, publication pending was 802, the previous 60 minutes resolved 340 rows,publishedremained 0, and all 340 resolutions weresuperseded. The oldest publication was about 33 hours old and publication health remained critical.Why This Change Was Made
Publication batch admission was strict
createdAtFIFO. Increasing preparation concurrency made historical cleanup faster, but did not guarantee bounded service for a current authoritative result. This change adds a small, reversible fresh-authority reservation inside each existing batch while preserving historical FIFO and every existing mutation fence.User Impact
Maintainers should see current exact-review conclusions reach their marker-backed comments with bounded service even while historical cleanup continues. Historical work still receives at least six of eight production batch positions and can use all positions when the fresh lane is empty.
Summary
Breaking Changes
None. Queue request/response contracts remain additive and existing batch leases remain valid.
Implementation
dashboard/exact-review-queue.tsclassifies a candidate as fresh only when all of these are true:Age alone never establishes authority. Admission moves only the configured bounded fresh reserve ahead of historical candidates, preserves FIFO within both groups, retains one durable target per batch, and keeps owner-homogeneous token selection. Batch fetch checks the source head again after ownership; drift is terminalized as
supersededbefore publication work begins.Production configuration enables a two-item reserve with a 15-minute recency bound. Setting
EXACT_REVIEW_PUBLICATION_FRESH_LANE_ENABLED=0restores strict historical FIFO without cancelling active batches.Code-Path Analysis
dashboard/exact-review-queue.ts(alarm,scheduleNext,exactReviewPublicationBatchDeparture,claimPublicationBatch,exactReviewQueueAdmittedItems).dashboard/exact-review-publication-batches.ts..github/workflows/exact-review-batch-publish.yml.dashboard/wrangler.toml.test/exact-review-publication-batches.test.tsandtest/state-writer-workflow.test.ts.docs/state-publication-batching-plan.md.The existing active-batch exclusion, publication head table, immutable queue revision, claim generation, lease owner, one-durable-item-per-batch rule, owner-scoped token, artifact validation, live GitHub re-fetch, and single state-writer boundary are unchanged.
Mainline Comparison
openclaw/clawsweeper:main.822608f7ec5496791036f97d2d0c20a0a1656648.2026-07-24T05:33:34Z.2026-07-24T09:22Z; the officialmainhead was unchanged.Those changes improve cleanup, recovery, or capacity; none adds bounded fairness between current authority and historical cleanup.
Branch / Base Provenance
openclaw/clawsweeper:main@822608f7ec5496791036f97d2d0c20a0a1656648.snowzlmbot/clawsweeper:fix/fresh-authority-admission@20b7f32282a81aedc3a478be3b92ae6bc816fa7e.snowzlmbot/clawsweeper:evidence/issue-826-pr-827-runtime; it is not part of the PR head.Dependency / Contract Verification
No dependency or lockfile changes. The implementation uses existing queue state, publication tuple, head-revision, batch ownership, and telemetry contracts.
Labels Considered
bug,performance, andoperations. No contributor label permissions are assumed.Validation
git diff --checkpassed on exact head20b7f32282a81aedc3a478be3b92ae6bc816fa7e.pnpm checkand the repository smoke jobs on that head.Controlled Runtime Proof
The evidence workflow checks out the exact PR head by immutable SHA, starts the real Worker and SQLite-backed Durable Object under Wrangler/Workerd, and drives the signed queue HTTP endpoints. It uses ephemeral local storage and performs no production queue or external GitHub mutations.
To keep the bounded proof under two minutes, only the recency window is shortened from the production value of 900 seconds to the implementation's minimum of 60 seconds. The batch size and reservation remain the proposed production values: eight members with two fresh slots. The normal exact-head CI separately asserts the committed 900-second configuration.
Observed results:
1090,1091; historical items1001through1006;1092and historical items1007,1008;supersededand returned zero preparation items;0, published12, superseded1;0; production queue mutations0.Evidence
2026-07-24T06:20:22Z: publication pending 802; 60-minute published 0; superseded 340; oldest age 119,469 seconds; health critical.materialized=0andsuperseded=8, demonstrating that successful FIFO batches can spend all bounded slots on historical cleanup.20b7f32282a81aedc3a478be3b92ae6bc816fa7e.Evidence Source Map
exactReviewQueueAdmittedItemsandexactReviewPublicationBatchDepartureon the recorded base SHA.Sanitized Logs
Media Evidence
Not applicable to the scheduler behavior itself. The public status endpoint, exact-head CI, controlled runtime transcript, and artifact report are the authoritative evidence. No UI rendering behavior changes.
Risk
publishedoutcomes fromsupersededcleanup; queue-depth reduction alone remains insufficient for rollout success.Rollback
Set
EXACT_REVIEW_PUBLICATION_FRESH_LANE_ENABLED=0. This is admission-only: active leases complete under their existing immutable fences, no stored queue data is deleted or migrated, and subsequent admission returns to strict historical FIFO.Docs Updated
docs/state-publication-batching-plan.mddocuments authority classification, lane borrowing, preserved safety boundaries, telemetry, success criteria, and rollback.Related Issue / PR
Not Tested / Limitations
published > 0, continued historical drain, and unchanged retry/dead-letter safety.