Skip to content

fix(queue): answer requests whose deferred requeue meets a queued review - #1989

Merged
steipete merged 5 commits into
mainfrom
fix/source-drift-command-onto-queued-item
Oct 14, 2026
Merged

steipete merged 5 commits into
mainfrom
fix/source-drift-command-onto-queued-item

Conversation

@steipete

@steipete steipete commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #1981 and #1984, which are both on main. This branch is rebased onto main 453d5712 and closes the follow-up named at the end of #1984.

What Problem This Solves

An explicit @clawsweeper re-review can still be left at "Review in progress" forever when its publication was deferred and another review was already queued for the item.

The sequence:

  1. The request's review finishes and hands its verdict to a deferred publication (repo#N@publish:<run>:<attempt>), so nothing is queued at repo#N.
  2. An organic event (for example edited or synchronize) queues an ordinary review at repo#N. That item carries no command.
  3. The publisher finds the item changed since the review and sends the source_drift_requeue (delivery publisher-source-drift:<producer run>:<attempt>).
  4. /enqueue treats the requeue as ignoredRecovery because it is low-priority by source action. The merge block is skipped, nothing carries the command, and the response still says queued: true.
  5. The publisher records lifecycle requeue for its publication. A requeue hands 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. On main, 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 organic edited item, then the publisher's claim, its exact sourceDriftRequeue body, and the sweep.yml completion with lifecycle_terminal_disposition: requeue. Results:

  • The queued item kept sourceAction: "edited" with no command fields, and the requeue answered {"ok":true,"queued":true}.
  • The publication's lifecycle projection ended in requeue, and no terminal-finalization:* driver existed.
  • The next claim returned a non-explicit decision without the command marker.

Why This Change Was Made

Answering the command terminally from /enqueue alone cannot work. The publisher records requeue right after its enqueue, and a requeue may 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 verified source_drift_requeue that finds an item at repo#N hands the request to that item only when all of these hold:

  • the item is pending (not dispatching, leased, or parked);
  • it is not a publication, a terminal finalizer, a low-priority recovery, or a manual-policy item;
  • it carries no command of its own;
  • 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. exactReviewDecisionWithCommand moves only the request's fields (the one shared list behind exactReviewDecisionWithoutCommand) and the source_drift_requeue action. It drops a failed-review retry's expectedSourceRevision pin.

The move goes through transitionCommandRevision with a new command revision. The admission uses held-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 now resetExactReviewAdmittedRetryState, 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 lifecycle requeue stands only if a review at the producer fence admitted the same command (sameCommandStatusAddress) after the producer revision. The new sameCommandAdmittedAfter is the sibling of #1984's otherCommandAdmittedAfter and shares its scan.

If no such admission exists, the queue records superseded instead. 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 reports published or superseded with lifecycle_terminal_disposition: requeue. Retryable, refresh, and requeued completions keep their behavior.
  • /lifecycle/terminal-disposition (batch post-effect): a retry of the same operation_id keeps 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 savedDirectRequeueFixture test 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 requeue stands 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 requeue then stands and the status stays "Review in progress".

  • The same happens without this PR, where requeue always stands. This guard does not make it worse.
  • A probe on the real queue confirms that a command generation completed as policy_noop gets no finalization driver: acknowledgement pending, no driver item.
  • The fix belongs in the skip path itself, so that every skipped command generation answers its status. That is fix(review): answer a maintainer request whose retry is skipped at admission #2001.

Rebase onto #1984's final version. #1984 landed with two commits made after this branch forked:

  • a held continuation is matched by the producer named in the requeue's publisher-source-drift:<run>:<attempt> delivery id;
  • command history is checked across repository casings.

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 producer passes the delivery id, so only the producer that still holds its own publication can hand its request to a queued review.
  • sameCommandAdmittedAfter already shares fix(queue): keep explicit requests answerable across deferred publication #1984's casing-aware commandAdmittedAfter scan.
  • A new test confirms that a requeue naming another producer leaves the pending review byte-for-byte unchanged. This was mutation-checked: when the handoff ignores the named producer, only that test fails.

User Impact

  • A maintainer's request is now reviewed and answered when the item changed before publication and an ordinary review was already waiting for the item.
  • When the queued review is already running or held, or answers another request, the earlier request's status now ends as "Complete: superseded" instead of staying "Review in progress". Its review lease is no longer left blocking the next request.

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.md and README.md already state that a request stays open until it is answered, and they stay accurate.
  • Changelog fragment: changelog.d/source-drift-command-onto-queued-item.md.

Real Behavior Proof

  • Claim:
    • A deferred publisher's requeue hands a still-current request to a pending, request-less review queued for newer source. That review's claim is an explicit request with the queued source.
    • When no queued review can carry the request (active, held, answering another request, or the request is no longer current), the queued review is byte-for-byte unchanged and the request is answered as superseded.
    • A request already queued keeps the requeue handoff.
    • The batch publisher's post-effect behaves the same, idempotently under retry, through batch completion.
  • Exercised surfaces:
    1. The real queue Durable Object (ExactReviewQueue) via test/dashboard-worker-harness.ts createExactReviewAdmissionHarness, through /enqueue, alarm, /claim, /complete, /publication-batches/claim, /lifecycle/terminal-disposition, and /publication-batches/complete.
    2. The real lifecycle projection store and terminal-finalization drivers.
    3. The exact bodies the publishers send: the sourceDriftRequeue payload, the sweep.yml publication completion (superseded/live_terminal + lifecycle_terminal_disposition: requeue), and the batch-lifecycle terminal post-effect shape (checked against node src/repair/exact-review-queue-request.ts batch-lifecycle terminal output).
  • Scenarios:
    • Pending organic edited review under the production 90-second debounce.
    • The organic review claimed (active).
    • The organic review held by locked_conversation (parked).
    • A newer request queued.
    • A newer request answered, then an organic review pending (request no longer current).
    • A redelivery of the same request queued.
    • Batch claim with the organic review pending (carried) or dispatching (not carried), the post-effect sent twice with one operation_id, then batch completion.
  • Environment: macOS, Node 24.21.0, pnpm 12.4.1.
Scenario Before (37101de2) After
Pending organic review, requeue arrives item unchanged (edited, no command); response queued: true; publication lifecycle requeue; no driver; next claim not explicit item takes the request at a new command revision (source_drift_requeue, queued sourceUpdatedAt, request fields, held-publication-requeue:publisher-source-drift:<run>:1), dispatches immediately; publication lifecycle requeue stands; next claim explicit with the request marker
Active / held / newer request / answered request queued item unchanged; completion {ok, requeued:false}; lifecycle requeue; no driver (status orphaned) queued item unchanged; completion {ok, requeued:false, terminal_finalization:true}; lifecycle superseded; one driver for the request's marker and status comment
Same request already queued lifecycle requeue lifecycle requeue (guard passes both ways)
Batch post-effect, request carried the request is not carried requeue stands; no finalizer after batch completion
Batch post-effect, request not carried (sent twice) requeue; no finalizer superseded both times (no 409); exactly one superseded finalizer after batch completion
  • Final effects of the pending-review transfer (test/oversized-pr-close.test.ts exact-close-pending-*; fixture pendingTransferClaim in test/exact-review-deferred-publication-fixture.ts):
    • The real queue produces the decision. A request's review defers its publication, an organic review is pending under the production 90-second debounce, a publisher run claims the publication, the scenario step runs, and the publisher's exact enqueue source-drift body arrives. The pending review's next claim is the decision under test.
    • That decision then goes through the real apply owner (apply-decisions --exact-event-publication) on the OWNER-authored oversized PR fixture, with a recording gh.
Scenario before the requeue Claimed decision Apply actions Writes
nothing (request current) source_drift_requeue, verified, admitted as held-publication-requeue:publisher-source-drift:<run>:1 review_comment_synced, closed durable review POST, pr close, close-notice PATCH
publication finished organic edited, request not carried skipped_maintainer_authored none
publisher lease lost organic edited skipped_maintainer_authored none
newer request answered source_drift_requeue, verification dropped skipped_maintainer_authored none
newer request answered under another repository casing organic edited skipped_maintainer_authored none
older producer while a newer generation holds the request source_drift_requeue, verification dropped skipped_maintainer_authored none
requeue under another producer's delivery id organic edited skipped_maintainer_authored none

newer-publication is not run here: its newer review generation would be the pending organic review itself. #1984's held scenarios cover it.

  • Status isolation for the superseded answer. When no review carries the request, the queue answers it as superseded. The terminal-finalization job's real update-command-status invocation (--require-mutation --locked-conversation-terminal-skip --verify-terminal-status-receipt) was run for the stale request against the shared status comment:
Shared status comment currently carries Result
the stale request's own marker (control) PATCH to State: Complete, terminal_status_verified=true
a newer request's marker (the newer request reused the comment) no PATCH, exit 0, missing_status_comment=true: the acknowledgement completes as a skip and the newer request's status is untouched
  • Mutation checks, each removing one condition from the final code. Each fails exactly its scenario:
    • Without the currency check (continuesHeldCommandPublicationSync): "answered request" fails.
    • Without the no-own-command condition: "same request already queued" fails.
    • Without the pending condition: "active review" fails, and so does the batch test.
    • Without the /complete guard: all four untouched scenarios fail.
    • Without the operation replay: the batch retry fails.
    • Without the direct-receipt exclusion: the existing "active pull request supersession preserves the command without its publication receipt" test fails.
  • Limits:
    • This is controlled proof on the real queue, not a live GitHub run. The review workflow runs from main, so this PR's own review does not exercise the change.
    • The /enqueue response for an untouched queued review still says queued: true. The request is now answered at the handoff, so it no longer orphans, and the response shape stays stable for both publishers' jq checks.
    • A non-source-drift recovery that carries command context (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 29cad16b asked 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.

    • Its "held by maintainer_request_required" detail does not apply: exactReviewHoldApplies never holds command-context decisions.
    • The underlying gap is real, though. An unverified same-command successor skipped at admission leaves the status unanswered, as described above.
    • Narrowing this guard to "authorized" admissions would not fix it safely. The publication would then answer "superseded", and on non-maintainer items the queued successor's --refuse-terminal-state in-progress step would then refuse to review at all.
    • The fix that preserves both is to let the admission-skip path answer the command status. That is fix(review): answer a maintainer request whose retry is skipped at admission #2001: the skipped generation answers "Waiting" with a re-review request.

Live Test

#1981's in-place continuation was run live in production on this PR (2026-10-14), with this head 29cad16b:

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:fast passes. 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). On 37101de2 every 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 into test/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 with origin/main 9ac67f94 and verified with this branch) reproduces its recorded verified_with.branch result exactly.

  • pnpm run check:fast passes: static, docs, changelog, limits, format, three builds, lint.

  • Codex review (P2 threshold):

  • Final-effect proof commit (c8182068): pnpm run check:fast passes. 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 branch 29cad16b against merge base 453d5712: "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 requeue disposition is recorded as superseded instead. Bay stays observer-only.

@clawsweeper

clawsweeper Bot commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-14T17:23:07.002745Z c818206 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +905 to +908
sameCommandAdmittedAfter(fenceKey: string, revision: number, command: CommandStatusAddress) {
return this.commandAdmittedAfter(fenceKey, revision, (admission) =>
sameCommandStatusAddress(admission, command),
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Base automatically changed from fix/command-continuation-followups to main October 14, 2026 08:53
@steipete
steipete requested a review from a team as a code owner October 14, 2026 08:53
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.
@steipete
steipete force-pushed the fix/source-drift-command-onto-queued-item branch from 2f64722 to 29cad16 Compare October 14, 2026 16:45

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +9539 to +9542
!this.lifecycleProjectionStore.sameCommandAdmittedAfter(
publication.itemKey,
revision.sourceRevision,
exactReviewQueueCommandStatusAddress(decision),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@steipete

Copy link
Copy Markdown
Contributor Author

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

@clawsweeper

clawsweeper Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@steipete steipete left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. 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 Oct 14, 2026
@clawsweeper

clawsweeper Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

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

  • Before: The recovery is ignored, the publication records requeue, and the request remains at Review in progress.
  • After: The pending review retains its newer source, receives the verified request, and becomes eligible to answer it.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, worthwhile fix with production-owner final-effect proof, meaningful negative controls, and no introduced blocking findings; external effects remain controlled rather than live.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): Current-head controlled proof follows the real queue’s pending-transfer decision through the apply CLI: the allowed request publishes and closes, while finished, lease-lost, replaced, casing-alias, older-producer, and wrong-producer cases make zero writes; the real status CLI also leaves a newer marker untouched, and batch operation replay preserves its first disposition. This addresses the prior rank-up request; recording GitHub transport and controlled queue fixtures limit the claim to these production-owner paths.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: An explicit review request can remain at Review in progress indefinitely after deferred publication encounters another queued review.
Reason: The maintainer-authored direction restores the documented request-answering contract with focused changes and meaningful rejection controls.

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
Reviewed head: c818206844b22c30bec75137385755e60bdf5f4d

Before merge

None.

Findings

None.

Agent review details

How this fits together

The 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
Loading

Technical review

Best 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

  • Recovery admission and held-publication continuation changes intended behavior with a stated reason (bb328b0: Preserve request authority only for the producer still holding the newest publication, without allowing recoveries to replace unrelated queued work.)
  • Command fields and lifecycle history scan keeps the original intent (bb328b0: Keep command identity together, distinguish conflicting status markers, and check intervening commands across repository casing aliases.)
  • Terminal-disposition recording and replay changes intended behavior with a stated reason (de42571: Record safe terminal lifecycle outcomes for stale command publications while retaining acknowledgement obligations; the PR adds a justified superseded outcome when no successor carries the request.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Current-main bug remains: Current main skips the command merge for low-priority recoveries when another review already occupies the item; the introduced pending-transfer branch addresses that specific path. (dashboard/exact-review-queue.ts:2088, dcd06a4cbee3)
  • Producer-bound transfer: The new transfer requires a pending request-less review and reuses the existing held-publication check, including producer identity, live ownership, newest publication, and intervening-command history. (dashboard/exact-review-queue.ts:2087, c818206844b2)
  • Final-effect proof supplied: The complete PR body and requested re-review describe the pending-transfer decision reaching the real apply CLI: the current request publishes and closes, while finished, lease-lost, replaced, differently cased, older-producer, and wrong-producer controls make zero writes; the added fixture and apply assertions implement those scenarios. (test/oversized-pr-close.test.ts:144, c818206844b2)
  • Finalizer status isolation: The supplied finalizer CLI trace reports a successful control PATCH and zero PATCHes when a newer request reused the status comment; current status lookup rejects a conflicting marker. (src/repair/update-command-status.ts:394, c818206844b2)
  • Batch replay and direct-receipt coverage: Added queue scenarios cover carried and uncarried batch handoffs, repeated operation IDs, and terminal finalizer creation; direct lifecycle receipts remain excluded from the deferred handoff guard. (test/exact-review-source-drift-loop.test.ts:813, c818206844b2)
  • Separate remaining admission-skip defect: fix(review): answer a maintainer request whose retry is skipped at admission #2001 owns answering request-carrying retries skipped by maintainer admission policy; that failure also occurs before this PR and is distinct from transferring a request to an already pending review.

Likely related people:

  • Peter Steinberger: Raw commit bb328b0 adds dashboard/exact-review-queue.ts:9269 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: bb328b089054; files: dashboard/exact-review-queue.ts)
  • Martin Cleary: Raw commit 746186d adds dashboard/exact-review-queue.ts:6688 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 746186da68f0; files: dashboard/exact-review-queue.ts)

Review metrics

Metric Value Why it matters
Patch distribution Production +190/-35; tests and fixtures +400/-1; documentation +9/-1 Most growth exercises command transfer, rejection controls, batch replay, and final apply effects; the production change stays within existing queue owners.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: A specific deferred-publication race strands explicit review requests and can retain their review lease, but does not disable the whole queue.
  • 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.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-14T17:06:32.196Z sha 29cad16 :: needs real behavior proof before merge. :: none

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.
@steipete

Copy link
Copy Markdown
Contributor Author

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

@clawsweeper

clawsweeper Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@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. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Oct 14, 2026
steipete added a commit that referenced this pull request Oct 14, 2026
…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.
@steipete
steipete merged commit d074305 into main Oct 14, 2026
31 of 34 checks passed
@steipete
steipete deleted the fix/source-drift-command-onto-queued-item branch October 14, 2026 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant