Skip to content

fix(queue): keep explicit requests answerable across deferred publication - #1984

Merged
steipete merged 6 commits into
mainfrom
fix/command-continuation-followups
Oct 14, 2026
Merged

steipete merged 6 commits into
mainfrom
fix/command-continuation-followups

Conversation

@steipete

@steipete steipete commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #1981, which landed as 9ac67f94 (its head 131383c7). This branch is rebased onto main; git range-diff shows both commits unchanged from the reviewed stacked version.

What Problem This Solves

Follow-ups found while reviewing #1981. Each one leaves an explicit command request without an answer: its status sticks at "Review in progress" or "Queued", or the wrong request gets answered. Five reported items were verified against the code; four are real and fixed here.

# Report Verdict
1 Deferred publication continuation loses the request (and two delivery-id formats) Real with #1981 applied. Fixed.
2 Publication refresh overwrites a newer pending command Real on main. Fixed.
3 Pending terminal finalizer lends its finalized command to an organic successor Real on main. Fixed.
4 Shed source-drift continuations are accepted as success Real on main. Fixed.
5 --refuse-terminal-state lets "Failed" through Intended. No change.

1. Deferred publication. When a review's publication is deferred, the publisher (sweep.yml "Queue fresh review after source drift", or the batch publisher) re-enqueues the claimed decision as source_drift_requeue while it still holds the publication item repo#N@publish:<run>:<attempt>. Nothing is queued at repo#N, so #1981's lifetime rule drops sourceCommentVerified, and a maintainer's open request is then skipped as automatic. The two publishers also used different delivery ids for the same producer generation: publisher-source-drift:<producer run>:<attempt> (sweep) and publisher-source-drift:<publication key>:<publication revision> (batch). A batch run that requeued and then lost its membership, or a re-claim by the other publisher, admitted a second requeue of the same generation.

2. Publication refresh. refreshExactReviewPublicationItem merged the refreshed producer decision into a pending or parked item at repo#N with {...current, ...next}. An older producer's command fields and artifact_retention_recovery overwrote a newer queued re_review without transitionCommandRevision. The newer request lost its status marker and its explicitness, and the older request was revived in its place.

3. Pending terminal finalizer. The /enqueue merge base for a pending finalizer at repo#N was the finalized producer decision. An organic successor (an issue edit, a push) inherited the finalized command's marker, status comment, and verified fields. That contradicts the comment above it, skips the debounce, reopens the old status comment, and admits the organic review as command-originated.

4. Shed continuations. A source-drift requeue that still carries command context is low-priority by source action, so it was shed under backpressure (EXACT_REVIEW_PENDING_SOFT_LIMIT) or during a GitHub throttle window. Both publishers accept .shed == true and record lifecycle requeue, which hands the status to a successor that never exists. docs/limits.md already promised that commands stay admitted, and the loop breaker already exempted command context.

5. Not a bug. "Failed" stays non-terminal for the fence on purpose (#1675: failed, interrupted, and waiting states stay retryable). The review-failure ladder and dead-letter recover-fresh rely on it to finish the original command. On maintainer items, artifact_retention_recovery is not an explicit request, so recover-fresh stops at admission and the status stays "Failed".

Why This Change Was Made

  • Held-publication continuation (continuesHeldCommandPublicationSync). A source_drift_requeue that finds no queued item keeps its verification only when all of these hold:

    • the requeue's delivery id publisher-source-drift:<producer run>:<attempt> names the producer, and the queue holds that producer's own publication under a live lease or an active batch lease. The publication is matched by its producer run and attempt, not by queue key, because same-lineage deduplication keeps a retained key while refreshing its producer. An older producer's requeue therefore cannot borrow a newer publication's authority;
    • that publication's producer carries the same verified command (marker, status comment, comment id and version, digest, origin);
    • it is the newest publication for the target (source revision at or above the publication head);
    • no different command was admitted at the item's review fence after that producer revision, under any repository casing (otherCommandAdmittedAfter). Every casing of an item shares one revision counter, and the query reads through the existing repository index (EXPLAIN QUERY PLAN: SEARCH … USING INDEX exact_review_lifecycle_projection_bay_repository_journey).

    Every other orphan requeue still loses verification, as in fix(review): keep explicit maintainer re-reviews through source-drift requeues #1981. A finished request (publication completed), a lost publisher lease, a newer answered request, and a newer publication all fail closed.

    fix(review): keep explicit maintainer re-reviews through source-drift requeues #1981 strips verification whenever the queue loads an item, unless admissionDeliveryId carries the in-place requeue prefix (3ce7e49d). An item admitted through this check is stamped with a second queue-owned prefix, held-publication-requeue:<delivery id>, which that load-time rule also honors. fix(review): keep explicit maintainer re-reviews through source-drift requeues #1981's 131383c7 reserves the in-place prefix at /enqueue. This PR extends that check to both queue-owned continuation prefixes (reserved_delivery_id), so a caller-chosen delivery id cannot keep a stale requeue's verification through either one.

  • One delivery id per review generation. The batch publisher now builds its body with the same enqueue source-drift CLI as the direct publisher, so both send publisher-source-drift:<producer run id>:<attempt>. This also removes the batch workflow's duplicated jq copy of the kept-action rule.

  • Refresh keeps a queued command. A pending or parked item that carries command context is left untouched, matching /enqueue, where a recovery never replaces queued work. When the refreshed producer's command differs, completion records lifecycle superseded instead of requeue in both /complete and batch completion. That command then gets its terminal answer ("A newer review tuple already exists"), instead of an orphaned "Review in progress".

  • Finalizer merge base. For a publication-shaped pending finalizer, the merge base drops command-scoped fields (exactReviewDecisionWithoutCommand). A non-publication finalizer decision can be a still-pending follow-up command, so it is kept as before.

  • Shedding. The new isSheddableExactReviewRecovery exempts command context from both shed paths: backpressure and the throttle token check.

User Impact

  • A maintainer's @clawsweeper re-review now also gets answered when its publication was deferred and the item changed before publication.
  • A command is no longer silently dropped while the queue is under load or throttled.
  • An artifact refresh can no longer replace a newer request with an older one.
  • Each status comment reaches a terminal state.

Automatic and scheduled work keeps its existing opt-in and shedding behavior.

Documentation Impact

  • docs/scheduler.md (maintainer opt-in paragraph): describes the held-publication continuation and removes fix(review): keep explicit maintainer re-reviews through source-drift requeues #1981's "batch publisher needs a new request" limitation.
  • docs/limits.md:
    • Command-bearing recovery and source-drift work is admitted under backpressure and during a throttle window.
    • Both publishers share one requeue delivery id.
  • AGENTS.md: the canonical request-lifetime line now names the deferred publisher's requeue next to the in-place one.

Changelog fragment: changelog.d/command-continuation-followups.md.

Real Behavior Proof

  • Claim:
    • A maintainer's verified request continues through a deferred publisher's source-drift requeue, and the claim hands the review job an explicit decision.
    • The same requeue fails closed once the request is answered or replaced.
    • Command continuations are not shed.
    • Both publishers send one body and delivery id per review generation.
    • A publication refresh keeps a queued newer request and answers the older one as superseded.
    • An organic successor of a finished request carries no command.
  • Exercised surfaces:
    1. The real queue Durable Object (ExactReviewQueue) through /enqueue, alarm, /claim, and /complete (review, publication, and refresh completions), plus /publication-batches/claim and /publication-batches/complete.
    2. The real lifecycle projection store and terminal-finalization drivers.
    3. The batch publisher's real "Finalize healthy members" branch from .github/workflows/exact-review-batch-publish.yml, run in bash with real jq and the real src/repair/exact-review-queue-request.ts enqueue source-drift CLI. Only pnpm (the post-effect HTTP call) is stubbed, to capture the body.
  • Scenarios:
    • A command review hands its verdict to a deferred publication (publisher:<run>:1), and a publisher run claims it.
    • The publisher then sends the exact sourceDriftRequeue body: as-is; after the publication finished; after its lease expired; after a newer request was answered; after a newer publication was admitted.
    • Refresh with a queued newer or same command, through both /complete and batch completion.
    • Pending direct-publication finalizer followed by an organic edited event.
    • Soft limit 1, and a seeded GitHub throttle window.
  • Environment: macOS, Node 24.21.0, pnpm 12.4.1.
Scenario Before (3ce7e49d) After
Deferred publisher's requeue of an open request verification dropped; claimed decision not explicit verification kept (stored as held-publication-requeue:publisher-source-drift:<run>:1); claimed decision explicit after the load-time rule
/enqueue with a caller delivery id held-publication-requeue:… or direct-lifecycle-requeue:… admitted 400 reserved_delivery_id
Same requeue after publication finished / lease lost / newer request answered / newer publication verification dropped verification dropped (each condition mutation-checked: removing it fails exactly its scenario)
Batch requeue body for producer run 7100 attempt 1 publisher-source-drift:openclaw/openclaw#710@publish:7100:1:3 publisher-source-drift:7100:1, byte-identical to the direct publisher's body
Command-bearing requeue at soft limit 1 {"ok":true,"shed":true,"reason":"backpressure"} queued: true, item pending
Command-bearing requeue in a throttle window shed scheduled_rate queued: true, item pending
Refresh /complete with a queued newer re_review pending item rewritten to the older command, artifact_retention_recovery; lifecycle requeue pending item unchanged; lifecycle superseded; finalization driver for the older marker; terminal_finalization: true
Refresh with a queued same command re_review downgraded to artifact_retention_recovery unchanged re_review; lifecycle requeue
Batch refresh with a queued newer command pending item rewritten to the older command pending item unchanged; older publication kept only as its superseded finalizer
Organic edited after a pending finalizer successor carries the finalized marker, status comment, verified fields, prompt successor has no command fields; admission commandOriginated: false; driver keeps the old marker

Final effects (authority chain through the real apply owner)

The decision the real queue hands the review job (deferredContinuationClaim in test/exact-review-deferred-publication-fixture.ts) goes through the real apply owner. The owner runs with --exact-event-publication on #1981's OWNER-authored oversized pull request fixture, openclaw/openclaw#141913 (test/oversized-pr-close.test.ts), with a recording gh. Artifact: docs/proof/deferred-request-continuation/final-effects.json.

Publisher requeue after Before (131383c7) After: apply actions After: recorded writes
Nothing (publication still held) skipped_maintainer_authored, no write (the scenario fails) review_comment_synced, closed POST issues/141913/comments (durable review), pr close 141913, PATCH issues/comments/150913 (close notice)
Publication finished skipped_maintainer_authored skipped_maintainer_authored none
Publisher lease lost skipped_maintainer_authored skipped_maintainer_authored none
Newer request answered (same status comment, new marker) skipped_maintainer_authored skipped_maintainer_authored none
Newer request answered under another repository casing (OpenClaw/OpenClaw#N) skipped_maintainer_authored (131383c7 has no held path) skipped_maintainer_authored none
Newer publication admitted skipped_maintainer_authored skipped_maintainer_authored none
Older producer's late requeue while a newer publication of the same request is held; that publication then answers skipped_maintainer_authored (131383c7 has no held path). The previous head 37101de2 kept the borrowed verification, and the queue claim was explicit (mutation check). skipped_maintainer_authored none

Upgrade from the deployed release (data-model compatibility)

docs/proof/deferred-request-continuation/upgrade.mjs: origin/main bc3ae1d960 persists real queue rows to file-backed SQLite through the real routes. Two releases then reopen those exact files: #1981's head 131383c7 and this branch. Artifact: upgrade-result.json.

Persisted row, next step #1981 head This branch
Held command publication; its publisher requeues stored as publisher-source-drift:…, verification dropped; claim not explicit stored as held-publication-requeue:publisher-source-drift:…, verified; claim explicit
Leased publication completes refresh_required with a newer request queued queued request rewritten to artifact_retention_recovery with the older marker; lifecycle requeue; newer request not explicit queued re_review unchanged and explicit; refreshed command superseded with a terminal finalization
Pending terminal finalizer; organic edited successor carries the finalized marker and verification successor has no command; the driver keeps the marker
Ordinary queued request claim explicit claim explicit

Every persisted row loads on both releases, and /stats answers 200. No schema or table changes: the only new persisted value is the held-publication-requeue: prefix on admissionDeliveryId, written only by the queue.

  • Limits:
    • This is controlled proof on the real queue, apply owner, and workflow shell, not a live GitHub run.
    • The 80-day publication expiry path still keeps a newer queued command intact but records no lifecycle for the expired older command. That path never records lifecycle today.
    • The review workflow runs from main, so this PR's own review does not exercise the change.

Evidence

  • New tests: test/exact-review-source-drift-loop.test.ts, test/dashboard-worker-publication-lifecycle.test.ts, test/exact-review-publication-batches.test.ts, test/repair/exact-review-batch-workflow.test.ts. On 3ce7e49d, every new positive test fails, and the guard tests pass both ways.
  • Existing coverage still passes: fix(review): keep explicit maintainer re-reviews through source-drift requeues #1981's finished, replaced, and previous-release upgrade tests; the finalizer split test; the recovery-path producer-context test.
  • Mutation check: without the held prefix in the load-time rule, the deferred continuation is stripped again.
  • Full runs on macOS, Node 24.21.0:
    • pnpm run test:unit: 4741 tests, 0 failures, 18 skipped. This ran before the two review fixes below; the affected files were rerun on the final code.
    • node scripts/run-node-tests.mjs repair: 896 tests, 0 failures, 12 skipped.
    • The 12 directly affected unit and repair files on the final code: 783 tests. One stale literal-string pin (source_drift_requeue in the batch workflow source, which now comes from the shared CLI) was updated to assert the shared CLI call.
  • pnpm run check:fast passes: static, docs, changelog, limits, format, three builds, lint.
  • Codex review (P2 threshold):
    • Pre-commit pass 1 found a P2: a newer request can reuse the status comment under a new marker (fix: reuse command review status comment #1675), and an OR comparison treated it as the same command. Fixed in the shared sameCommandStatusAddress: any conflicting part of the address means a different command.
    • Pass 2 found a P2: the refresh used exact address equality, so the same command whose queued address later gained a status comment id would be finalized as superseded. Fixed with the same helper, plus a test variant.
    • Pass 3 was scoped-clean.
    • The committed branch against a92b6dcb is scoped-clean.
    • After rebasing onto 3ce7e49d, the committed branch against 3ce7e49d is scoped-clean. The rebase changed only the integration with the load-time rule.
    • The later rebases onto 6af7d5ce (docs-only) and 131383c7 merged the scheduler paragraph and folded fix(review): keep explicit maintainer re-reviews through source-drift requeues #1981's in-place prefix reservation into this PR's prefix list. After the last rebase, the source-drift suite (17 tests) and check:fast pass.
    • Both fixes were mutation-checked: the old comparison fails the new scenarios.

ClawSweeper review dispositions (head 37101de2)

  • Bind held continuation authority to the originating producer (P2) / Producer-generation authority can be borrowed [medium] / missing overlapping-publication proof: fixed. The check now looks up the publication named by the requeue's delivery id instead of any held publication with the same command. New scenario older-producer-borrows-newer-publication:
    • The scenario lives in the shared fixture, so the queue tests and the final-effects tests both run it.
    • The older publication ends superseded, a newer generation of the same request holds its own publication, and the older producer's requeue arrives.
    • The newer publication then answers the request before the continuation reaches final effects.
    • Result: verification is dropped, the claim is not explicit, and the apply owner records skipped_maintainer_authored with zero writes.
    • Mutation check: with the previous scan, exactly this scenario fails (actual: true).
  • Codex connector P2, inline comment fix(queue): keep explicit requests answerable across deferred publication #1984 (comment): fixed, as above.
  • Pre-commit Codex review (P2): command history across repository casing aliases. Fixed: the history check compares fence keys case-insensitively through the repository index. New scenario newer-command-answered-under-other-casing; the exact match fails it.
  • Pre-commit Codex review of the binding (P2): a lookup by constructed queue key would wrongly reject a legitimate continuation after same-lineage deduplication refreshed the producer under a retained key. Fixed: the match uses producer metadata. A new test (a deferred continuation follows a publication refreshed under its retained key) covers it, and the key-lookup version fails it.
  • Codex connector P1, inline comment fix(queue): keep explicit requests answerable across deferred publication #1984 (comment) (merge a held-request requeue into an already queued organic item): deferred to its own change. This is the pre-existing ignoredRecovery gap listed under Follow-up, and the PR does not change that path. Carrying a command onto a queued organic item changes /enqueue merge semantics for every recovery, so it is being fixed and proven separately.

ClawSweeper review dispositions (head 4c60cc8c)

  • Add real behavior proof / Validate held-request authority at final effects [medium] / Resolve merge risk: resolved. See the final-effects table: the held continuation's claimed decision reaches the close and its writes through the real apply owner. The finished, lease-lost, replaced (newer request answered), and newer-publication controls stop at skipped_maintainer_authored with zero writes.
  • Resolve the conflict with the base: resolved. The branch is rebased onto fix(review): keep explicit maintainer re-reviews through source-drift requeues #1981's 131383c7. That commit reserves the in-place prefix itself; this PR's reservation list now covers both prefixes.
  • Data-model compatibility proof: resolved. See the upgrade table. Queued commands, a held publication, a refreshable publication, and a pending finalizer persisted by the deployed release all load and take the new paths.

Follow-up (not in this PR)

When an organic item is already queued at repo#N, a command-bearing source_drift_requeue is still dropped as low-priority recovery (ignoredRecovery), so that command's status can orphan. Fixing it changes /enqueue merge semantics and needs its own review.

@steipete
steipete requested a review from a team as a code owner October 14, 2026 05:24
@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-14T08:15:51.146001Z 635a9df 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.

@steipete
steipete force-pushed the fix/command-continuation-followups branch from a530111 to 4c60cc8 Compare October 14, 2026 05:32

@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: 4c60cc8c24

ℹ️ 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 thread dashboard/exact-review-queue.ts Outdated
Comment on lines +2268 to +2270
const continuesHeldRequest =
verifiedSourceDriftRequeue &&
this.continuesHeldCommandPublicationSync(state, decision, activeBatchItemKeys, now);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Merge held-request requeues into an existing review item

When an ordinary webhook revision is already queued for the item while the deferred publisher still holds the explicit request's publication, current is truthy, so this continuation check is never reached; the earlier existing-item path classifies every source_drift_requeue as an ignored low-priority recovery and returns a successful admission without merging its verified command context. The ordinary review can then run without authorization or command acknowledgement, leaving the explicit request unanswered even though the publisher still owns its newest publication. Apply the held-publication checks when an existing non-command item is present and merge the command obligation into that item.

AGENTS.md reference: AGENTS.md:L38-L46

Useful? React with 👍 / 👎.

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper review

Requested once for landing. Proof, before/after results, Codex review dispositions, and validation for head 4c60cc8 are in the PR body. This stacked follow-up also carries the reserved continuation-prefix guard that #1981 latest review asks for.

@clawsweeper

clawsweeper Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. 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 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 preserves explicit review requests through deferred publication, protects queued commands during refresh, and prevents finished commands from reaching organic successors.

Example: Producer run 7100, attempt 1, requeues an explicit request while its deferred publication remains held.

  • Before: Verification is dropped and the review is skipped as automatic.
  • After: The queue preserves verification for that producer’s current request and returns an explicit review decision.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A useful, focused repair with no open finding; confidence remains bounded by controlled harness execution rather than a deployed Worker and live GitHub run.
Proof confidence 🦐 gold shrimp (3/6) ✨ media proof bonus Sufficient (linked_artifact): The maintainer-supplied production-path harness follows real queue claims into the real apply owner with recorded GitHub calls: the current held request reaches effects, while finished, lease-lost, replaced, casing-alias, newer-publication, and borrowed-producer controls make zero writes; transport and review execution remain controlled doubles.
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 queued or in progress indefinitely, or a refresh can answer the wrong request.
Reason: The maintainer-directed repair restores the documented request lifetime while retaining finished-request and replacement boundaries.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: current main still needs these fixes, and the reviewed head resolves the earlier producer-authority finding without a new actionable defect.

Priority: P2
Reviewed head: 635a9df6aad87ea5e14820254f06cf8a368563b2

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Worker’s exact-review queue accepts command and publisher decisions, persists their lifecycle, and hands authorized decisions to review and publication workflows.

flowchart LR
  A[Explicit request] --> B[Exact review queue]
  B --> C[Review worker]
  C --> D[Deferred publication]
  D --> E[Producer bound continuation]
  E --> B
  B --> F[Apply and status owners]
Loading

Technical review

Best possible solution:

Preserve the producer-bound continuation and command lifecycle fixes here, with the existing queued-review collision handled by #1989.

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

Current-main source exposes the verification drop and command overwrite paths, and the supplied before/after scenarios exercise them; this read-only review ran no target code.

Is this the best way to solve the issue?

The patch repairs the existing queue, lifecycle, and shared publisher payload owners without introducing another authority store or configuration option.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 8ae8cba03403.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Review metrics

Metric Value Why it matters
Production and regression coverage Production/workflow +255/-44 lines; tests and shared fixture +834/-84 lines. The larger validation delta covers independent command-loss paths and allowed versus forbidden authority transitions.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Explicit review requests can lose their answer during deferred publication or queue recovery, with limited impact on the review automation surface.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp 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 (2 earlier review cycles)
  • reviewed 2026-10-14T06:07:54.003Z sha 4c60cc8 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-14T07:42:01.016Z sha 37101de :: needs real behavior proof before merge. :: [P2] Bind held continuation authority to the originating producer

Reviewed October 14, 2026, 4:47 AM ET / 08:47 UTC (Revision 3).

@steipete
steipete force-pushed the fix/command-continuation-followups branch from 4c60cc8 to 014bde0 Compare October 14, 2026 06:24
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Addressed the review on 4c60cc8 for head 014bde0: the held-publication continuation is now followed through the real apply owner to its final GitHub writes, with finished, lease-lost, replaced, and newer-publication controls making no write; an upgrade run reopens rows persisted by origin/main; and the branch is rebased onto the parent's current head. Proof tables, artifacts (docs/proof/deferred-request-continuation), and the finding dispositions are in the PR body.

@clawsweeper

clawsweeper Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

steipete added a commit that referenced this pull request Oct 14, 2026
… requeues (#1981)

An explicit `@clawsweeper re-review` on a maintainer-authored PR was silently lost when the PR changed while the review ran (on #1969 and again on this PR, another bot's PR review moved the review-activity cursor). Apply skipped publication for source drift, the queue requeued the generation in place as `source_drift_requeue`, and claim admission skipped that retry as an automatic maintainer review, leaving the command status at "Review in progress" and its review lease held for about an hour.

- `isExplicitReviewRequest` now accepts a `source_drift_requeue` that still carries the request's command status and verified command fields, so the queue's fenced in-place requeue continues the same request through claim admission and the hosted publication gate.
- The queue keeps request verification on a `source_drift_requeue` only when it requeued the generation in place (`direct-lifecycle-requeue:` admission provenance). The rule runs in the load-time normalizer and on `/enqueue`, so a finished or replaced request re-enqueued by a publisher, including rows persisted by the previous release, keeps its status but cannot authorize another review. `/enqueue` rejects caller delivery ids that use the queue-owned prefix (`reserved_delivery_id`).
- AGENTS.md, docs/scheduler.md, README, and a changelog fragment state the contract; deferred publications (batch publisher requeues) still need a new request and are tracked in the stacked #1984.

Proof: replay of #1969's real rev 2/rev 3 claim decisions through the compiled `live-item` admission step, real queue Durable Object lifetime and upgrade tests, final effects through the real apply owner on an owner-authored oversized PR (continuation writes; finished-request requeue zero writes), and a cross-version run where main persists an orphaned verified requeue and this change claims those bytes as non-explicit.
Base automatically changed from fix/maintainer-re-review-source-drift to main October 14, 2026 06:27

@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: 014bde0ba9

ℹ️ 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".

!item.terminalFinalization &&
publication?.itemKey === key &&
revision !== null &&
exactReviewSameVerifiedCommand(publication.producerDecision, 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 Bind the continuation to its originating publication

When two deferred publications for the same explicit request overlap at different source revisions, this search can authorize the older publisher’s requeue using the newer publisher’s held item: the command metadata matches, and the newer candidate satisfies the publication-head test, but nothing ties the candidate’s producerRunId/attempt to the incoming publisher-source-drift:<run>:<attempt> delivery. If the newer publisher then completes and answers the request, the stale queued continuation retains verified authority and may run the request again; require the held publication lineage to match the requeuing publisher.

AGENTS.md reference: AGENTS.md:L42-L46

Useful? React with 👍 / 👎.

…tion

Follow-ups to #1981, each of which left a command request unanswered:

- A deferred publisher's source-drift requeue keeps the request's
  verification while the publisher still holds the request's newest
  publication and no other command reached the item since. The admitted
  item carries a queue-owned `held-publication-requeue:` delivery prefix
  that the load-time verification rule honors; `/enqueue` rejects caller
  delivery ids with either continuation prefix. Any other orphan requeue
  still drops it.
- The batch publisher builds its requeue with the shared
  `enqueue source-drift` CLI, so both publishers send one delivery id per
  review generation (`publisher-source-drift:<producer run>:<attempt>`).
- Command-bearing recovery is no longer shed by backpressure or a GitHub
  throttle window.
- An artifact refresh leaves a queued command intact. A different, older
  producer command is answered as superseded instead of overwriting it.
- An organic successor of a pending terminal finalizer no longer inherits
  the finalized command.

The `--refuse-terminal-state` report is intended behavior (#1675) and is
unchanged.
…nd upgrade

ClawSweeper asked for the held-publication continuation to be followed to
the final GitHub effects and through an upgrade.

- test/exact-review-deferred-publication-fixture.ts drives the real queue
  from a verified request through a held deferred publication to the
  publisher's source-drift requeue and returns the decision the review job
  claims. The source-drift tests now share it.
- test/oversized-pr-close.test.ts feeds those claimed decisions to the real
  apply owner on the OWNER-authored oversized PR: the open continuation
  syncs the durable review and closes; finished, lease-lost, replaced, and
  newer-publication continuations stop at skipped_maintainer_authored with
  no write.
- docs/proof/deferred-request-continuation/upgrade.mjs reopens rows that
  origin/main persisted (held and refreshable publications, queued
  commands, a pending finalizer) with another release; the README and JSON
  artifacts record both the final effects and the upgrade.
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The previous request was lost, not answered. Its review (https://github.com/openclaw/clawsweeper/actions/runs/38522067648) was superseded at 06:28Z when #1981 merged and GitHub retargeted this PR's base to main. The next generation (https://github.com/openclaw/clawsweeper/actions/runs/38523668129) carried no command and was skipped as automatic. Its status still held review coordination until 07:29:53Z.

Requesting once more for head 37101de: the same two reviewed commits, rebased onto main after #1981 landed (git range-diff is identical). Proof, artifacts, and the finding dispositions are in the PR body.

@clawsweeper

clawsweeper Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Oct 14, 2026
ClawSweeper and the Codex connector noted that the held-publication check
accepted any held publication with the same verified command. An older
producer's late source-drift requeue could therefore borrow a newer
publication's authority, and keep it after that publication answered the
request.

The requeue's delivery id (publisher-source-drift:<producer run>:<attempt>,
shared by both publishers) names its producer, so the queue now looks up
exactly that publication and applies the held, newest, and no-other-command
checks to it alone. The shared fixture gains the overlapping-publication
scenario, which the queue tests and the apply-owner final-effects tests
both run; with the previous scan it fails.
Same-lineage publication deduplication keeps a retained queue key while
refreshing the item's producer to a newer run or attempt. The publisher then
requeues under the refreshed producer's delivery id, so a lookup by a
constructed queue key wrongly rejected that legitimate continuation.

The held-publication check now matches the publication's itemKey and
producer run and attempt, and keeps the held, newest, and no-other-command
checks. A regression test refreshes a deferred publication's producer under
its retained key; the key lookup fails it.
The "no other command since the producer" check matched the review fence
key case-sensitively, but queue keys keep repository casing verbatim. A
newer request admitted as OpenClaw/OpenClaw#N and answered without a
publication was invisible to an openclaw/openclaw#N continuation, which
then kept its verification.

Every casing of an item shares one revision counter, so the check now
compares fence keys case-insensitively. It reads through the existing
repository index (LOWER(repo), canonical_target_key, fence_key, revision),
which EXPLAIN QUERY PLAN confirms as an indexed search scoped to one
repository. The shared fixture gains the casing-alias scenario; the exact
match fails it.
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Addressed the review on 37101de for head 635a9df:

  • The held continuation is now bound to its originating producer. The requeue's delivery id names the producer, and the publication is matched by producer metadata, so a retained key with a refreshed producer still works.
  • The command-history check now covers repository casing aliases.

New scenarios are older-producer-borrows-newer-publication, newer-command-answered-under-other-casing, and a refreshed-provenance continuation. They run through the real queue and the real apply owner, and each fails under the previous code. Dispositions for the review findings and both inline Codex comments, with the updated proof tables, are in the PR body.

@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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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
steipete merged commit bb328b0 into main Oct 14, 2026
34 of 36 checks passed
@steipete
steipete deleted the fix/command-continuation-followups branch October 14, 2026 08:53
steipete added a commit that referenced this pull request Oct 14, 2026
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 added a commit that referenced this pull request Oct 14, 2026
…iew (#1989)

An explicit @clawsweeper re-review could still stay at "Review in progress" when its review's publication was deferred and an ordinary review was already queued for the item: the publisher's source-drift requeue was ignored as low-priority recovery, nothing carried the request, and the publication still recorded lifecycle requeue.

- A verified source_drift_requeue that meets a pending, request-less, non-publication review hands the still-current request to that review (new command revision, admission held-publication-requeue:<delivery id>), keeping the review's newer source. Currency comes from #1984's producer-bound continuesHeldCommandPublicationSync (the requeue's delivery id must name the producer that still holds its own newest publication, and no other command reached the item).
- A deferred publication's lifecycle requeue stands only if a review at the item admitted the same request after the producer revision (sameCommandAdmittedAfter, sharing #1984's casing-aware scan); otherwise the queue records superseded so the request gets a terminal answer, in /complete and idempotently in the batch post-effect. Direct-lifecycle receipts are excluded.
- Rebased onto main after #1981/#1984: the handoff passes the requeue's delivery id (producer binding), with a test that a requeue naming another producer leaves the pending review untouched.

Proof: real queue Durable Object scenarios; the transferred decision through the real apply owner on an owner-authored oversized PR (a current request publishes and closes; finished, lease-lost, replaced under either casing, older-producer, and wrong-producer requeues make zero writes); the real finalizer status CLI leaves a status comment reused by a newer request untouched. Live: #1981's in-place continuation was exercised in production on this PR (drift injected mid-review; the requeued revision was admitted, published, and the command status reached Complete).
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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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