Skip to content

refactor: build exact-review lifecycle receipts with the typed queue request command - #1802

Merged
obviyus merged 1 commit into
mainfrom
exact-review-lifecycle-receipts
Oct 9, 2026
Merged

obviyus merged 1 commit into
mainfrom
exact-review-lifecycle-receipts

Conversation

@obviyus

@obviyus obviyus commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

What

Second lane for the typed queue request command (after #1796): exact-review lifecycle receipts built after checkout.

  • src/repair/exact-review-queue-request.ts gets lifecycle <router-receipt|canonical-receipt|terminal-disposition>. It reads TARGET_REPO, ITEM_NUMBER, FENCE_KEY and REVISION and validates them. It accepts only the values the queue accepts: router outcome durable|not_required (optional; the queue reads a missing outcome as durable), canonical outcome accepted|deduped|superseded, and the terminal kinds the workflow sends (requeue|target_missing|target_closed|guarded_open|policy_noop). A receipt id is --receipt-id-prefix + :<run id>:<run attempt>. Invalid input prints no body and exits 1. The heartbeat path now shares the same run-id/run-attempt reader.
  • Steps migrated (all run after checkout and setup-pnpm build:all):
    • event-review-apply / "Finalize direct exact review lifecycle": router receipt + terminal disposition. The receipt prefix choice (router-direct, -proof, -not-required) moved from the inline Node builder to three shell lines beside the call. The classifier is unchanged.
    • event-review-publish: "Record fallback canonical…", "Queue deferred exact verdict router", "Record deferred close-proof…", "Record no-router…".
  • scripts/e2e/manual-review-publication.mjs: the per-item work dir now links dist beside scripts, as a built checkout has them.
  • Not in this PR: "Replay committed direct lifecycle handoff" in event-review-publish runs before checkout (it sources $RUNNER_TEMP/control-plane-curl.sh), so it has no dist. It keeps its 2 inline builders until the pre-checkout bootstrap slice (audit finding 4). Every other lane (claim, complete, enqueue, terminal finalization) also has at least one pre-checkout step; this lane had the fewest.

Copy counts (inline lifecycle body builders in sweep.yml):

before after
post-checkout node -e lifecycle builders 6 0
pre-checkout replay builders 2 2 (needs bootstrap)
typed command subcommand 0 1

Why

agent://SlopWorkflows/report finding 2: the queue protocol is hand-copied in YAML. These six builders spelled the same lifecycle identity six times, two different ways (template literals in five, + concatenation in one), and checked only REVISION and FENCE_KEY.

Proof

  1. Body byte identity. Each old builder is extracted from origin/main:sweep.yml and executed as-is. The new body comes from the built command with the same env:
IDENTICAL  Finalize direct exact review lifecycle: router not_required
IDENTICAL  Finalize direct exact review lifecycle: router durable
IDENTICAL  Finalize direct exact review lifecycle: router durable, deferred close coverage
IDENTICAL  Finalize direct exact review lifecycle: terminal requeue
IDENTICAL  Finalize direct exact review lifecycle: terminal target_missing
IDENTICAL  Finalize direct exact review lifecycle: terminal target_closed
IDENTICAL  Finalize direct exact review lifecycle: terminal guarded_open
IDENTICAL  Finalize direct exact review lifecycle: terminal policy_noop
IDENTICAL  Record fallback canonical exact review lifecycle receipt
IDENTICAL  Queue deferred exact verdict router
IDENTICAL  Record deferred close-proof exact review lifecycle receipt
IDENTICAL  Record no-router exact review lifecycle receipt
12/12 lifecycle bodies byte-identical
  1. Step-level identity. I ran the whole handoff block of "Finalize direct exact review lifecycle" from origin/main and from this branch, with control_plane_signed_post stubbed to record URL + body. This covers the new shell prefix choice:
IDENTICAL  outcome=not_required deferred=false   → router-receipt …"receipt_id":"router-direct-not-required:4242:2"
IDENTICAL  outcome=durable deferred=false        → router-receipt …"receipt_id":"router-direct:4242:2"
IDENTICAL  outcome=durable deferred=true         → router-receipt …"receipt_id":"router-direct-proof:4242:2"
IDENTICAL  terminal=requeue|target_missing|target_closed|guarded_open|policy_noop → terminal-disposition
8/8 step requests identical
  1. Lane e2e in a Linux container (node:24-bookworm, Wrangler 4.107.0, stock gh 2.98.0, MANUAL_PUBLICATION_PROVIDER=local-smoke). scripts/e2e/manual-review-publication.mjs run <head> <source-id> runs the checked-in "Finalize direct exact review lifecycle" step against a local worker. I ran it on main (373cf3e) and on this branch (b2e0346). Both traces hold the same request, and both returned 200:
POST /queue/internal/exact-review/lifecycle/router-receipt {"canonical_target_key":"openclaw/openclaw#76","fence_key":"openclaw/openclaw#76","revision":1,"outcome":"not_required","receipt_id":"router-direct-not-required:1076:1"} → 200

The rest of the lifecycle checks in the driver (canonical record lines, the allowed PR effects, which assert this exact router-receipt body) pass on both. Both runs then fail later, at the same point, in the unrelated batch lane (prepare-exact-review-batch.mjs outage scenario: expected state_contention, got unknown_failure, manual-review-publication.mjs:1480/1482). That failure exists on main as well; this PR does not touch that lane.

  1. test/repair/exact-review-queue-request.test.ts runs the built command for every lifecycle body and every rejection. test/sweep-workflow.test.ts pins each migrated step to its command call.

  2. pnpm run check: 6966 pass, 2 fail. Both failures are the known command-proof-consumer 120s/180s timeouts under load; the file passes alone (29/29). codex review --base origin/main: "No actionable defects found." Saved real reports re-rendered with render-comments.mjs (prompt-rest, prompt-lean, prompt-dump, async-proof/{base,branch}, retire-proof/166090): 6/6 byte-identical.

Codex dispositions

  • codex review --base origin/main: no findings.

Merge Danger

  • Door: two-way. No stored data and no queue protocol change; the bodies are byte-identical. Revert restores the inline builders.
  • Blast radius: direct-publication lifecycle handoff in event-review-apply, and the four receipt steps after publication in event-review-publish. All of them run after setup-pnpm with build:all, so the command is present. If the command rejected input, the step would fail before any request, which matches what the old builders did on a bad REVISION/FENCE_KEY. The queue's lifecycle reconciliation is unchanged.

@obviyus
obviyus requested a review from a team as a code owner October 9, 2026 09:02
@clawsweeper

clawsweeper Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

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

View the workflow run.

@clawsweeper clawsweeper Bot added P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. 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. labels Oct 9, 2026
@clawsweeper

clawsweeper Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

The review workflow builds lifecycle receipts—records of publication and routing—with the existing typed command instead of six copied inline builders.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A useful consolidation with scoped production-path proof, preserved contracts, and no actionable finding.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): Recorded head-specific terminal output exercises the actual lifecycle workflow shell, typed command, signed HTTP transport, and local production Worker in node:24-bookworm: the router receipt receives HTTP 200 and matches the base. Body and step comparisons cover the remaining serialization variants. GitHub effects are synthetic, and the broader driver later fails an unchanged batch scenario; those limits do not invalidate the exercised handoff. No stored-data contract changes require migration.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes
Reason: Six copied protocol builders move into the existing command, reducing validation drift while preserving designed output. The maintenance benefit justifies the bounded growth.

Merge readiness

✅ Ready for maintainer review

Keep open: this is a useful, bounded consolidation that current main does not contain. No actionable correctness or security defect was identified.

Priority: P3
Reviewed head: b2e034625a0d5ede805e0b08fc40375f76842aee

Before merge

None.

Findings

None.

Agent review details

How this fits together

ClawSweeper’s review workflow sends publication, routing, and terminal outcomes to its durable review queue. These receipts let the queue track completion and subsequent finalization.

flowchart TD
  A[Review publication result] --> B[Workflow selects lifecycle outcome]
  B --> C[Typed request command]
  D[Target revision and workflow run] --> C
  C --> E[Signed HTTP transport]
  E --> F[Durable review queue]
  F --> G[Lifecycle completion and finalization]
Loading

Technical review

Best possible solution:

Keep lifecycle serialization in the existing typed command while retaining the queue and signed transport as their current owners.

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

Not applicable: this PR consolidates existing behavior rather than reporting a runtime bug; supplied base/head comparisons exercise the lifecycle handoff.

Is this the best way to solve the issue?

Yes: extending the existing serializer removes copied request construction without introducing a parallel transport or changing lifecycle ownership.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Repository policy: Read the complete root AGENTS.md. No nested AGENTS.md or maintainer-notes directory was found; applied narrow-change, runtime-proof, build-availability, and changelog guidance. (AGENTS.md:1, b2e034625a0d)
  • Introduced implementation: The pinned introduced diff replaces six lifecycle body builders while preserving request routes, receipt prefixes, outcome selection, transport, and response handling. The command shares existing run identity validation with heartbeats. (src/repair/exact-review-queue-request.ts:142, b2e034625a0d)
  • Queue contract and upgrade safety: The existing queue accepts canonical outcomes accepted/deduped/superseded and router outcomes durable/not_required, defaulting omitted router outcome to durable. The patch changes neither storage schemas nor receipt formats, authorization, settings, or migration behavior. Bay receives the same lifecycle data, so no Bay implementation change is needed. (dashboard/exact-review-queue.ts:10240, b2e034625a0d)
  • Build availability: Both affected jobs run setup-pnpm with build:all before the migrated receipt steps; the pre-checkout replay remains inline. The proof driver now supplies dist beside scripts to match the built workflow checkout. (.github/workflows/sweep.yml:765, b2e034625a0d)
  • Recorded runtime proof: The fully supplied PR body, captured source revision f2d1808e8eb187f7e734667d34d61364fe19b99d5ee2e0dd676eea70f5d09e36, records node:24-bookworm, Wrangler 4.107.0, stock gh 2.98.0, and provider local-smoke. At head b2e0346, the actual lifecycle workflow step sent router-direct-not-required:1076:1 for Bug: Telegram cron job delivery fails with "TELEGRAM_BOT_TOKEN is required" even when token is configured openclaw#76 and received HTTP 200, matching the base run. Twelve serialized-body comparisons and eight step-request comparisons also matched. The later batch-outage assertion failed on both revisions; the complete driver did not pass. (b2e034625a0d)
  • Proof exercises production boundaries: The driver extracts and executes the checked-in lifecycle shell step, forwards queue requests over HTTP to the local production Worker/Durable Object implementation, and asserts the exact router receipt and canonical record. GitHub responses are synthetic; this proves the changed serialization and queue handoff rather than deployed GitHub Actions. (scripts/e2e/manual-review-publication.mjs:1276, b2e034625a0d)

Likely related people:

  • Ayaan Zaidi: Raw commit 373cf3e adds src/repair/exact-review-queue-request.ts:4 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 373cf3e3a1a7; files: src/repair/exact-review-queue-request.ts)
  • Martin Cleary: Raw commit 746186d adds .github/workflows/sweep.yml:1357 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: .github/workflows/sweep.yml)

Review metrics

Metric Value Why it matters
Lifecycle builder consolidation 6 post-checkout builders replaced; 2 pre-checkout builders retained The migrated lane gains one serializer without requiring a new bootstrap path.
Production versus test changes Production +130/-78; tests and proof driver +107/-10 The modest production growth centralizes validation and replaces repeated workflow serialization.

Labels

Label changes:

  • add P3: This is bounded maintenance that preserves existing review publication behavior.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: This is bounded maintenance that preserves existing review publication behavior.
  • 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 need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

Reviewed October 9, 2026, 5:05 AM ET / 09:05 UTC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. 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