Skip to content

fix(workflow): prioritize superseded batch receipts - #990

Merged
brokemac79 merged 1 commit into
mainfrom
codex/csw-086-superseded-batch-terminal-precedence
Aug 1, 2026
Merged

brokemac79 merged 1 commit into
mainfrom
codex/csw-086-superseded-batch-terminal-precedence

Conversation

@brokemac79

@brokemac79 brokemac79 commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Corrects the batch post-effect precedence after #952: a canonical superseded receipt now wins before a stale artifact's terminal plan can enqueue a source-drift retry or select a conflicting terminal lifecycle disposition.

Problem

The batch finalizer accepted a canonical superseded receipt but evaluated artifact-owned requeue/terminal-plan conditions first. A stale artifact could therefore trigger post-effects that conflicted with the canonical outcome. Worker projection validation kept the durable lifecycle safe, but the workflow could retry those harmless post-effects indefinitely.

Implementation

  • Make receipt_outcome=superseded the first terminal decision after receipt validation.
  • Keep artifact-originated outcome_kind=superseded in its existing position, preserving the source-drift recovery path.
  • Add a focused workflow regression asserting that the canonical-receipt terminal branch precedes the stale requeue plan.

Validation

corepack pnpm install --frozen-lockfile
pnpm run build:all
pnpm run lint
pnpm exec oxfmt --check .github/workflows/exact-review-batch-publish.yml test/repair/exact-review-batch-workflow.test.ts
git diff --check origin/main...HEAD
git diff --check
  • All three TypeScript builds and all lint lanes passed.
  • Focused workflow test passed 11/11 in Docker-backed Crabbox local-container, including Linux Bash syntax checks.
  • actionlint is not installed on this Windows host. The focused Linux test parses the workflow and runs bash -n for every run: step.
  • Native Windows Bash smoke is a known baseline limitation: Docker Desktop's WSL relay lacks /bin/bash. This PR adds no Windows support, platform policy, or CI change.

Real Behavior Proof

  • Claim: a canonical superseded receipt terminalizes the batch item as superseded, without executing the stale artifact's source-drift requeue post-effect.
  • Surface: the exact Finalize healthy members under a fenced heartbeat post-effect loop in .github/workflows/exact-review-batch-publish.yml.
  • Scenario / fixture: an eligible artifact with requeueLatestExpected=true is paired with a matching canonical receipt whose outcome is superseded. The controlled endpoint rejects any stale /internal/exact-review/enqueue call and accepts only the terminal-disposition handoff.
  • Command / environment: Docker-backed Crabbox local-container, mcr.microsoft.com/playwright:v1.60.0-noble, --no-hydrate, executing the complete current finalizer run: block extracted from the workflow with controlled pnpm, jq, and HTTP seams.
  • Observed result: terminal payload was kind=superseded; no stale requeue endpoint was called; postEffectsRequired and postEffectsComplete were both written.
  • Artifact / trace: controlled local-container proof; it made no GitHub, queue, or production call.
  • Limits: controlled proof only -- no gate change, replay, or live item status acknowledgement was attempted.

Inspectable redacted finalizer trace

The following is the assertion transcript emitted after the controlled execution of the workflow's complete extracted finalizer run: block. The harness suppresses target, fence, HMAC/header, and local lease values; it prints only these fixed, safe assertions.

CSW-086 REDACTED FINALIZER TRACE
fixture.artifact.kind=eligible
fixture.artifact.requeueLatestExpected=true
fixture.receipt.outcome=superseded
endpoint.guard.stale_enqueue=fail_if_called
observed.terminal_disposition.kind=superseded
observed.stale_enqueue_calls=0
observed.postEffectsRequired=true
observed.postEffectsComplete=true
RESULT=PASS

This extract contains no credential material, HMAC/signature value, real target/fence key, lease ID, URL query token, or production endpoint.

Codex Review

  • codex review --uncommitted: clean; no accepted/actionable findings.
  • codex review --base origin/main: clean; no accepted/actionable findings.

Risks and rollout

This is an ordering-only workflow correction. It affects only canonical receipt supersession and leaves artifact-originated supersession/source-drift behavior unchanged.

Merge authorization

The prior CSW-077 operational stability requirement is superseded and does not apply to this PR. This exact head/body is authorized for a manual squash merge after live preflight confirms all of the following:

  1. A clean exact-head ClawSweeper verdict with no P0/P1 or unresolved blocking finding.
  2. Required checks are terminal SUCCESS or SKIPPED.
  3. GitHub reports MERGEABLE / CLEAN, with no requested changes, blocking label/ruleset condition, or automerge request.

No gate, queue, Cloudflare/Bay, production, replay, automerge, or merge mutation is included in this PR.

Links

Follow-up to #952 and related lifecycle work for #898.

@brokemac79

Copy link
Copy Markdown
Contributor Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added 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. 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. labels Aug 1, 2026
@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 31, 2026, 11:03 PM ET / August 1, 2026, 03:03 UTC.

ClawSweeper review

What this changes

Moves canonical superseded receipt handling ahead of stale artifact requeue handling in the exact-review batch finalizer, with a focused ordering regression test.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open. Current main still evaluates the stale artifact requeue plan before a canonical superseded receipt, so the reported workflow behavior is not yet implemented. The patch is focused and has no blocking correctness finding, but it is intentionally a draft and needs a maintainer decision on the documented operational hold before manual merge.

Priority: P2
Reviewed head: ce61b4eeb1e4faf5164fba7085fffccee1b8d48d
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A narrow, source-aligned workflow repair with inspectable controlled terminal proof and no blocking correctness finding.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The PR body now includes a redacted terminal trace from a controlled Docker-backed execution of the complete extracted finalizer block, showing superseded terminal disposition, zero stale enqueue calls, and completed post-effects.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body now includes a redacted terminal trace from a controlled Docker-backed execution of the complete extracted finalizer block, showing superseded terminal disposition, zero stale enqueue calls, and completed post-effects.
Evidence reviewed 5 items Current-main ordering leaves the reported collision possible: Current main evaluates requeueLatestExpected before checking whether the canonical receipt outcome is superseded, so a stale artifact can enqueue the source-drift post-effect first.
Proposed branch gives canonical receipt precedence: The PR adds the receipt_outcome = superseded terminal branch before the stale artifact requeue condition and leaves artifact-originated supersession in its existing later branch.
Canonical receipt contract treats supersession as a first-class outcome: The Worker direct-publication contract declares superseded as a canonical acceptance outcome and returns it when a newer revision has already been published.
Findings None None.
Security None None.

How this fits together

The exact-review batch publisher reads per-item artifacts and canonical Worker receipts after a batch commit, then emits either a lifecycle terminal handoff, a router handoff, or a source-drift requeue. This change affects the decision that turns a confirmed canonical supersession into a terminal lifecycle result rather than retrying an artifact-owned post-effect.

flowchart LR
  A[Batch item artifact] --> B[Canonical receipt lookup]
  B --> C{Receipt is superseded?}
  C -->|Yes| D[Terminal lifecycle handoff]
  C -->|No| E{Artifact disposition}
  E -->|Source drift| F[Requeue post-effect]
  E -->|Other terminal state| D
  D --> G[Post-effects completed]
Loading

Decision needed

Question Recommendation
Should this draft remain held until the stated CSW-077 two-hour health window and cohort trace are available, or should maintainers accept the controlled proof and manually merge it earlier? Hold for the documented cohort evidence: Keep the PR draft until the required healthy-observation window and cohort trace show no lifecycle or queue regression.

Why: The code repair is narrow, but the remaining merge condition is an operational safety threshold for a live exact-review workflow rather than a mechanical code defect that automation can resolve.

Before merge

  • Resolve merge risk (P1) - This changes a live workflow's post-effect ordering; the PR body intentionally requires the CSW-077 health window and cohort evidence before a manual merge, and that operational evidence is not established in the supplied review context.
  • Complete next step (P2) - No mechanical repair remains; a maintainer must evaluate the PR's declared operational hold and decide when a manual merge is safe.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Patch scope 2 files affected; 18 added, 2 removed The branch narrowly changes one workflow decision and one focused regression assertion.

Merge-risk options

Maintainer options:

  1. Hold for the lifecycle observation window (recommended)
    Do not merge while the declared CSW-077 health-window and cohort conditions remain unproven for this workflow behavior change.
  2. Accept the operational risk explicitly
    A maintainer can choose an earlier manual merge only after acknowledging that the supplied proof is controlled rather than a live production workflow observation.

Technical review

Best possible solution:

Keep the canonical-receipt-first ordering, retain the artifact-originated source-drift path for non-canonical supersession, and manually merge only after the stated lifecycle-health observation criteria are evidenced.

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

Yes. Current main visibly checks the stale requeue disposition before the canonical superseded receipt, and the PR body provides a controlled full-finalizer trace showing the corrected terminal handoff with zero stale enqueue calls.

Is this the best way to solve the issue?

Yes. Giving a canonical superseded receipt precedence is the narrowest repair because it preserves artifact-originated supersession and source-drift recovery for cases without that canonical terminal result.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against b07ab751813c.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body now includes a redacted terminal trace from a controlled Docker-backed execution of the complete extracted finalizer block, showing superseded terminal disposition, zero stale enqueue calls, and completed post-effects.
  • 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. Sufficient (terminal): The PR body now includes a redacted terminal trace from a controlled Docker-backed execution of the complete extracted finalizer block, showing superseded terminal disposition, zero stale enqueue calls, and completed post-effects.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P2: The reported stale retry behavior is a bounded workflow correctness issue, with durable lifecycle validation described as preserving the underlying record state.
  • merge-risk: 🚨 automation: The PR changes the terminal-versus-requeue decision in a live GitHub Actions batch workflow, so incorrect precedence could alter automated retry behavior after merge.
  • 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. Sufficient (terminal): The PR body now includes a redacted terminal trace from a controlled Docker-backed execution of the complete extracted finalizer block, showing superseded terminal disposition, zero stale enqueue calls, and completed post-effects.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body now includes a redacted terminal trace from a controlled Docker-backed execution of the complete extracted finalizer block, showing superseded terminal disposition, zero stale enqueue calls, and completed post-effects.

Evidence

What I checked:

  • Current-main ordering leaves the reported collision possible: Current main evaluates requeueLatestExpected before checking whether the canonical receipt outcome is superseded, so a stale artifact can enqueue the source-drift post-effect first. (.github/workflows/exact-review-batch-publish.yml:205, b07ab751813c)
  • Proposed branch gives canonical receipt precedence: The PR adds the receipt_outcome = superseded terminal branch before the stale artifact requeue condition and leaves artifact-originated supersession in its existing later branch. (.github/workflows/exact-review-batch-publish.yml:205, ce61b4eeb1e4)
  • Canonical receipt contract treats supersession as a first-class outcome: The Worker direct-publication contract declares superseded as a canonical acceptance outcome and returns it when a newer revision has already been published. (dashboard/exact-review-direct-publication.ts:432, b07ab751813c)
  • Focused regression coverage: The added test asserts that the canonical superseded-receipt branch and its terminal assignment occur before the stale artifact requeue branch. (test/repair/exact-review-batch-workflow.test.ts:171, ce61b4eeb1e4)
  • Feature-history provenance: The current lifecycle projection entered main through the merged lifecycle PR, whose body explicitly retained this superseded-receipt precedence case as a separate follow-up; the PR head is a one-commit child of that main commit. (b07ab751813c)

Likely related people:

  • brokemac79: Authored the merged lifecycle-projection PR that documented this exact precedence gap as a follow-up, and authored this narrow repair. (role: lifecycle feature contributor; confidence: high; commits: b07ab751813c, ce61b4eeb1e4; files: .github/workflows/exact-review-batch-publish.yml, test/repair/exact-review-batch-workflow.test.ts)
  • Martin Cleary: Authored the current-main merge commit for the lifecycle projection that introduced the surrounding batch finalizer behavior. (role: recent area integrator; confidence: high; commits: b07ab751813c; files: .github/workflows/exact-review-batch-publish.yml, test/repair/exact-review-batch-workflow.test.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Keep the draft hold until the stated CSW-077 health-window and cohort evidence is available for maintainer review.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-01T02:37:01.720Z sha ce61b4e :: needs real behavior proof before merge. :: none

@brokemac79

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@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 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 Aug 1, 2026
@brokemac79
brokemac79 marked this pull request as ready for review August 1, 2026 03:07
@brokemac79
brokemac79 requested a review from a team as a code owner August 1, 2026 03:07
@brokemac79
brokemac79 merged commit 8e620fc into main Aug 1, 2026
33 checks passed
@brokemac79
brokemac79 deleted the codex/csw-086-superseded-batch-terminal-precedence branch August 1, 2026 03:08
azaj01 pushed a commit to azaj01/clawsweeper that referenced this pull request Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. 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