Repository navigation
fix(queue): answer requests whose deferred requeue meets a queued review - #1989
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2f64722c4d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| sameCommandAdmittedAfter(fenceKey: string, revision: number, command: CommandStatusAddress) { | ||
| return this.commandAdmittedAfter(fenceKey, revision, (admission) => | ||
| sameCommandStatusAddress(admission, command), | ||
| ); |
There was a problem hiding this comment.
Fail closed when successor admissions are unreadable
When any later lifecycle projection at this fence is malformed or from an unreadable legacy schema, the shared commandAdmittedAfter helper returns true before applying this same-command predicate. Both deferred completion paths therefore accept the publisher's requeue as though a successor had proven ownership of the request, canceling terminal finalization even though no same-command admission was verified; the status can remain at “Review in progress” indefinitely. Preserve the existing conservative result for otherCommandAdmittedAfter, but make unreadable rows fail this same-command proof so the publisher records superseded.
AGENTS.md reference: AGENTS.md:L42-L46
Useful? React with 👍 / 👎.
A deferred publisher's source-drift requeue that found a review already queued at the item was dropped as low-priority recovery, and the publisher's lifecycle requeue then cancelled terminal finalization, so the request's status stayed "Review in progress". A pending review without a request of its own now takes over a request that the held publication proves still current: it keeps its newer source, gains the request at a new command revision, and is admitted under the held-publication prefix so the request stays explicit. Active, parked, and request-bearing items stay untouched. The publisher's requeue now stands only when a review at the item admitted the same request after the producer revision. Otherwise the request is recorded as superseded and its status is answered. This applies to the direct publisher's completion and to the batch publisher's post-effect; a retried post-effect keeps its first answer. Direct-lifecycle receipts keep their requeue.
After #1984 landed, the held-continuation check matches the publication by the producer named in the requeue's publisher-source-drift delivery id. The queued-review handoff passes that delivery id too, so only the producer that still holds its own publication can hand its request to a pending review.
2f64722 to
29cad16
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 29cad16b5b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| !this.lifecycleProjectionStore.sameCommandAdmittedAfter( | ||
| publication.itemKey, | ||
| revision.sourceRevision, | ||
| exactReviewQueueCommandStatusAddress(decision), |
There was a problem hiding this comment.
Require an authorized admission before preserving requeue
When a same-command source-drift retry is admitted under a delivery that does not own the held publication, removeOrphanedRequestVerification deliberately strips its sourceCommentVerified, but its lifecycle row is still recorded as commandOriginated. This call therefore treats that unverified row as a valid successor, so the real publisher preserves requeue; on a maintainer item the successor is then held by maintainer_request_required and cannot answer the explicit request, leaving its status at “Review in progress.” The same-command proof needs to distinguish an authorized request continuation from a merely matching command address.
AGENTS.md reference: AGENTS.md:L46-L49
Useful? React with 👍 / 👎.
|
@clawsweeper re-review Rebased onto main after #1981 and #1984 landed (head 29cad16); the PR body records the rebase, the producer-binding fix and test, the Codex connector disposition, and current validation. This request also runs the live test described in the PR body: a labeled PR review comment will be posted while this review runs, to exercise the #1981 source-drift continuation in production. |
|
🦞👀 Re-review progress:
|
steipete
left a comment
There was a problem hiding this comment.
Live test of #1981 (requested by the maintainer): this PR review comment is intentional review activity posted while the requested ClawSweeper review runs. Expected: apply detects review-activity drift, the queue requeues the generation in place, the retry is admitted as the same explicit request, and the review still publishes. No action needed on this comment.
|
Codex review: needs maintainer review before merge. What this changesThis PR transfers a current deferred review request to an eligible pending review, or answers it as superseded when no successor carries it. Example: A deferred publisher requeues the request for openclaw/openclaw#97650 while an organic edited review is pending.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current queue handoff bug and merits landing consideration; the added final-effect evidence resolves the prior authority-chain concern, and no introduced blocking defect was found. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Worker’s ExactReviewQueue receives review admissions and publisher completions, persists command lifecycle ownership, and dispatches reviews or terminal status finalizers. flowchart TD
A[Deferred publisher] --> B[Source drift enqueue]
B --> C[Verify current request and producer]
C --> D[Eligible pending review]
D --> E[Review and apply owner]
C --> F[Superseded finalizer]
E --> G[GitHub effects]
F --> G
Technical reviewBest possible solution: Land the focused pending-review handoff and superseded-answer fix while retaining the separate admission-skip repair. Do we have a high-confidence way to reproduce the issue? Current-main control flow shows the ignored recovery and orphaned handoff; supplied before/after queue traces corroborate it, without a reviewer-run reproduction. Is this the best way to solve the issue? The change uses existing command revision, producer authority, lifecycle, and finalizer owners, preserving queued source and leaving active or request-bearing work untouched. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against dcd06a4cbee3. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
Review metrics
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed October 14, 2026, 1:31 PM ET / 17:31 UTC (Revision 2). |
A pendingTransferClaim fixture runs the deferred publisher's requeue against an organic review pending under the production debounce and returns that review's next claimed decision. The oversized-PR apply scenarios publish and close for a current request, and stop at skipped_maintainer_authored with zero writes after the publication finished, the lease was lost, a newer request was answered (also under another casing), an older producer arrived, or the requeue named another producer.
|
@clawsweeper re-review Added the requested final-effect proof for head c818206: the pending-review handoff now runs through the real apply owner (a current request publishes and closes; publication-finished, lease-lost, newer request answered under either casing, older producer, and wrong producer make zero writes), plus the real finalizer status CLI showing a stale request's superseded answer cannot rewrite a status comment a newer request reused. The PR body also records the production live test of #1981's continuation on this PR, and links #2001 for the Codex connector P2. |
|
🦞👀 Re-review progress:
|
…mission (#2001) On a maintainer-authored item, a review generation that still carries an explicit command but lacks request authority (for example a fail-closed source_drift_requeue whose verification the queue stripped) is skipped at claim admission. The skip path never created the review job's write token, so "Mark unsuccessful re-review" never ran and the command status stayed "Review in progress" forever, as on #1969; no terminal-finalization driver answers a review generation's policy_noop either. - "Create target write token" now also runs for exactly that case (semantic no-op, maintainer_request_required hold, command context). Every other token consumer stays gated on the review proceeding or on items without command context. - "Mark unsuccessful re-review" answers that case as "Waiting" with a request to re-review. Waiting is deliberately non-terminal, so a later continuation of the same request (#1989's handoff) is not refused. - Both existing queue fences stay: the step's lease heartbeat and the status CLI's authority fence before lookup and before write. Proof: the real step script, heartbeat builder, and update-command-status CLI against a controlled queue and recording gh. A current owner writes Waiting; a superseded step fence, an owner lost before or during comment lookup, and a queue error all make zero status writes. Docs (scheduler maintainer contract) and a changelog fragment updated.
Follow-up to #1981 and #1984, which are both on
main. This branch is rebased ontomain453d5712and closes the follow-up named at the end of #1984.What Problem This Solves
An explicit
@clawsweeper re-reviewcan still be left at "Review in progress" forever when its publication was deferred and another review was already queued for the item.The sequence:
repo#N@publish:<run>:<attempt>), so nothing is queued atrepo#N.editedorsynchronize) queues an ordinary review atrepo#N. That item carries no command.source_drift_requeue(deliverypublisher-source-drift:<producer run>:<attempt>)./enqueuetreats the requeue asignoredRecoverybecause it is low-priority by source action. The merge block is skipped, nothing carries the command, and the response still saysqueued: true.requeuefor its publication. Arequeuehands the request to a successor and cancels terminal finalization, but no successor carries the request.The status comment is never answered. On maintainer-authored items, the organic review is also skipped as automatic (scheduled offers, or maintainers whose public association is
CONTRIBUTOR), so the request is never reviewed. Onmain, a stuck status also keeps its review lease, which blocks the next request for about an hour (see #1981).Confirmed at #1984's head (
37101de2) with the real queue Durable Object, driven through/enqueue,alarm,/claim, and/complete. The flow was: command review, deferred publication, then an organicediteditem, then the publisher's claim, its exactsourceDriftRequeuebody, and the sweep.yml completion withlifecycle_terminal_disposition: requeue. Results:sourceAction: "edited"with no command fields, and the requeue answered{"ok":true,"queued":true}.requeue, and noterminal-finalization:*driver existed.Why This Change Was Made
Answering the command terminally from
/enqueuealone cannot work. The publisher recordsrequeueright after its enqueue, and arequeuemay transition any committed terminal fact (applyTerminalDisposition) and cancels its finalization drivers. So the fix has two parts.1. Carry the still-current request onto a pending review (
/enqueue). A verifiedsource_drift_requeuethat finds an item atrepo#Nhands the request to that item only when all of these hold:pending(not dispatching, leased, or parked);continuesHeldCommandPublicationSync(from fix(queue): keep explicit requests answerable across deferred publication #1984, unchanged) proves the request is still current: the publisher still holds its newest publication, and no other command reached the item after the request's review.The item keeps its own (newer) source.
exactReviewDecisionWithCommandmoves only the request's fields (the one shared list behindexactReviewDecisionWithoutCommand) and thesource_drift_requeueaction. It drops a failed-review retry'sexpectedSourceRevisionpin.The move goes through
transitionCommandRevisionwith a new command revision. The admission usesheld-publication-requeue:<delivery id>, so the load-time verification rule keeps the request explicit. The item then gets the same retry reset and immediate scheduling as any command joining a pending item. That reset block is nowresetExactReviewAdmittedRetryState, shared with the existing command merge.Active, parked, and command-bearing items are never modified. A recovery still never replaces a different queued command.
2. Guard the publisher's handoff (
deferredRequeueLeavesCommandSync). A deferred publication's lifecyclerequeuestands only if a review at the producer fence admitted the same command (sameCommandStatusAddress) after the producer revision. The newsameCommandAdmittedAfteris the sibling of #1984'sotherCommandAdmittedAfterand shares its scan.If no such admission exists, the queue records
supersededinstead. The terminal finalization driver then answers the request: "A newer review tuple already exists; this stale result was superseded." This is applied where each deferred publisher records the handoff:/complete(sweep.yml publisher): only for a finished, non-direct publication that reportspublishedorsupersededwithlifecycle_terminal_disposition: requeue. Retryable, refresh, and requeued completions keep their behavior./lifecycle/terminal-disposition(batch post-effect): a retry of the sameoperation_idkeeps the answer its first record got, so a retried post-effect cannot hit a terminal-operation conflict.Direct-lifecycle receipts are excluded, because the queue creates their successor itself, after the lifecycle record. The existing
savedDirectRequeueFixturetest fails if that exclusion is removed. Legacy tupleless publications (no lineage) are unchanged.The admission-based check never double-answers. If a successor admitted the request, including a fail-closed unverified requeue from #1984, a redelivery of the same request, or a pending follow-up revision, the
requeuestands and that successor answers.Known gap, pre-existing and not introduced here. On a maintainer-authored item, a same-command successor that lacks request authority, such as #1984's fail-closed unverified requeue, is skipped at admission. The skip path never creates the job's write token, so that successor cannot answer the status. The publication's
requeuethen stands and the status stays "Review in progress".requeuealways stands. This guard does not make it worse.policy_noopgets no finalization driver: acknowledgementpending, no driver item.Rebase onto #1984's final version. #1984 landed with two commits made after this branch forked:
publisher-source-drift:<run>:<attempt>delivery id;The rebase applied cleanly except for one docs paragraph. This branch's new handoff call still used the old four-argument
continuesHeldCommandPublicationSync, which no longer type-checks.bind the queued-review handoff to the requeue's producerpasses the delivery id, so only the producer that still holds its own publication can hand its request to a queued review.sameCommandAdmittedAfteralready shares fix(queue): keep explicit requests answerable across deferred publication #1984's casing-awarecommandAdmittedAfterscan.User Impact
Automatic, scheduled, and finished-request behavior is unchanged.
Documentation Impact
docs/scheduler.md(maintainer opt-in paragraph, which owns this contract) describes the takeover by a pending review and the superseded answer when no review carries the request.AGENTS.mdandREADME.mdalready state that a request stays open until it is answered, and they stay accurate.changelog.d/source-drift-command-onto-queued-item.md.Real Behavior Proof
requeuehandoff.ExactReviewQueue) viatest/dashboard-worker-harness.tscreateExactReviewAdmissionHarness, through/enqueue,alarm,/claim,/complete,/publication-batches/claim,/lifecycle/terminal-disposition, and/publication-batches/complete.sourceDriftRequeuepayload, the sweep.yml publication completion (superseded/live_terminal+lifecycle_terminal_disposition: requeue), and thebatch-lifecycle terminalpost-effect shape (checked againstnode src/repair/exact-review-queue-request.ts batch-lifecycle terminaloutput).editedreview under the production 90-second debounce.locked_conversation(parked).operation_id, then batch completion.37101de2(detached worktree with only the new test file copied in; the first run on the earlier head4c60cc8cgave the same results).2f64722c. All scenarios were re-run on the rebased head, on top ofmain453d5712, and pass unchanged, plus the new producer-binding case.37101de2)edited, no command); responsequeued: true; publication lifecyclerequeue; no driver; next claim not explicitsource_drift_requeue, queuedsourceUpdatedAt, request fields,held-publication-requeue:publisher-source-drift:<run>:1), dispatches immediately; publication lifecyclerequeuestands; next claim explicit with the request marker{ok, requeued:false}; lifecyclerequeue; no driver (status orphaned){ok, requeued:false, terminal_finalization:true}; lifecyclesuperseded; one driver for the request's marker and status commentrequeuerequeue(guard passes both ways)requeuestands; no finalizer after batch completionrequeue; no finalizersupersededboth times (no 409); exactly one superseded finalizer after batch completiontest/oversized-pr-close.test.tsexact-close-pending-*; fixturependingTransferClaimintest/exact-review-deferred-publication-fixture.ts):enqueue source-driftbody arrives. The pending review's next claim is the decision under test.apply-decisions --exact-event-publication) on the OWNER-authored oversized PR fixture, with a recordinggh.source_drift_requeue, verified, admitted asheld-publication-requeue:publisher-source-drift:<run>:1review_comment_synced,closedpr close, close-notice PATCHedited, request not carriedskipped_maintainer_authorededitedskipped_maintainer_authoredsource_drift_requeue, verification droppedskipped_maintainer_authorededitedskipped_maintainer_authoredsource_drift_requeue, verification droppedskipped_maintainer_authorededitedskipped_maintainer_authorednewer-publicationis not run here: its newer review generation would be the pending organic review itself. #1984's held scenarios cover it.update-command-statusinvocation (--require-mutation --locked-conversation-terminal-skip --verify-terminal-status-receipt) was run for the stale request against the shared status comment:State: Complete,terminal_status_verified=truemissing_status_comment=true: the acknowledgement completes as a skip and the newer request's status is untouchedcontinuesHeldCommandPublicationSync): "answered request" fails.pendingcondition: "active review" fails, and so does the batch test./completeguard: all four untouched scenarios fail.main, so this PR's own review does not exercise the change./enqueueresponse for an untouched queued review still saysqueued: true. The request is now answered at the handoff, so it no longer orphans, and the response shape stays stable for both publishers'jqchecks.failed_review_shard_recovery,artifact_retention_recovery) is still not carried onto a queued review. Its publication refresh path was handled in fix(queue): keep explicit requests answerable across deferred publication #1984.Review Findings
ClawSweeper on
29cad16basked for final-effect proof of the pending-review transfer: the current request succeeds, while finished, replaced, lease-lost, and wrong-producer requests cannot authorize publication or alter another request's status. Added: see the final-effects and status-isolation tables under Real Behavior Proof. The review reported no findings.Codex connector P2 (fix(queue): answer requests whose deferred requeue meets a queued review #1989 (comment)), "Require an authorized admission before preserving requeue": real; pre-existing; addressed by a separate follow-up.
maintainer_request_required" detail does not apply:exactReviewHoldAppliesnever holds command-context decisions.--refuse-terminal-statein-progress step would then refuse to review at all.Live Test
#1981's in-place continuation was run live in production on this PR (2026-10-14), with this head
29cad16b:@clawsweeper re-review(fix(queue): answer requests whose deferred requeue meets a queued review #1989 (comment)) started rev 10, https://github.com/openclaw/clawsweeper/actions/runs/38602676665 (source_action: re_review).skipped_changed_since_review(reviewed_pr_activity_cursor_drift, expected cursorv2:6:…), followed byDIRECT_LIFECYCLE_REQUEUE: true.source_action: source_drift_requeue: admitted, with no "maintainer review requires an explicit request" skip. It reviewed and published (review_comment_synced, 17:07:49).That is the exact sequence that lost the request on #1969 before #1981. It exercises #1981's path in production, not this PR's deferred-publication path. That path needs a deferred publication that drifts while an organic review is pending, which cannot be triggered on demand, so it is covered by the controlled final-effect proof above.
Evidence
Rebased head:
pnpm run check:fastpasses. The 18 affected files (source drift, publication lifecycle, queue policy and runtime, scanner hold, Bay routes, recovery publication, read-model equivalence, publication batches, maintainer policy, apply live state, oversized close, structural invariants, queue-request and batch-workflow CLIs, admission e2e, storage) pass 759/759 before the producer-binding test. The source-drift file passes 27/27 with it.New tests in
test/exact-review-source-drift-loop.test.ts, built on fix(queue): keep explicit requests answerable across deferred publication #1984's shared fixture: 4 tests, 8 cases (plus the producer-binding case added on rebase). On37101de2every positive case fails; the same-request guard passes both ways.All 22 affected unit and repair files (queue runtime, policy, publication lifecycle, publication batches, recovery publication, scanner hold, review hold, source drift, apply-live-state, oversized close, maintainer policy, sweep/batch workflows, queue-request and batch CLIs) on the final base: 1010 tests, 0 failures.
Full runs on macOS, Node 24.21.0, on the first base
4c60cc8c:pnpm run test:unit: 4751 tests, 0 failures, 18 skipped.node scripts/run-node-tests.mjs repair: 896 tests, 0 failures, 12 skipped.fix(queue): keep explicit requests answerable across deferred publication #1984 was then rebased onto
main(37101de2), and this branch rebased cleanly. One follow-up test commit gives the organic-claim scenarios local run ids, because fix(queue): keep explicit requests answerable across deferred publication #1984 moved its helpers intotest/exact-review-deferred-publication-fixture.ts. The queue code is byte-identical to the reviewed and mutation-checked version.fix(queue): keep explicit requests answerable across deferred publication #1984's upgrade proof (
docs/proof/deferred-request-continuation/upgrade.mjs, seeded withorigin/main9ac67f94and verified with this branch) reproduces its recordedverified_with.branchresult exactly.pnpm run check:fastpasses: static, docs, changelog, limits, format, three builds, lint.Codex review (P2 threshold):
37101de2was scoped-clean (0.88).Final-effect proof commit (
c8182068):pnpm run check:fastpasses.oversized-pr-close, the source-drift loop, publication lifecycle, and publication batches pass 295/295. Codex review (P2) is scoped-clean on the uncommitted change and on the committed branch.Codex review on the rebased branch (P2 threshold, against
main): scoped-clean on the committed branch29cad16bagainst merge base453d5712: "patch is correct" (0.82), with no findings.OpenClaw Bay
Not affected. There are no queue, lifecycle, telemetry, status, or projection schema changes. This only changes which existing queued review answers a still-current request, and when a deferred publication's existing
requeuedisposition is recorded assupersededinstead. Bay stays observer-only.