Skip to content

fix(repair): cut over durable cluster intake publication (rework of #873) - #901

Merged
steipete merged 6 commits into
mainfrom
rework/cluster-intake-cutover
Jul 27, 2026
Merged

fix(repair): cut over durable cluster intake publication (rework of #873)#901
steipete merged 6 commits into
mainfrom
rework/cluster-intake-cutover

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Summary

Rework of #873 by @RomneyDa — the 5/5 cutover layer of the cluster-fixer reliability stack, re-applied on top of #900 (the reworked #884 dispatch layer) and reconciled with what #879/#899/#900 changed on main. RomneyDa's original commit is cherry-picked with authorship preserved; a maintainer fix commit addresses the review findings. #873 stays open for its audit and review history; this PR supersedes it.

What the cutover does (unchanged from #873 in intent):

  • Cuts the production intake workflow from broad repair:publish-main publication to the durable cluster-intake append/materializer contract.
  • Dispatches through durable materialization instead of directly from an intake checkout — now specifically through the feat(repair): dispatch durable cluster jobs (rework of #884) #900 receipt-verified path: the materializer verifies the HMAC accepted-intent receipt, publishes the dispatch claim before the workflow side effect, and git ledger/job files are never dispatch authority.
  • Publishes worker results by exact changed paths, with bounded priority and automatic self-heal retry.
  • Preserves deterministic mutation, security gates, fail-closed behavior, allow_merge: false, and all existing production gate settings.

Changes vs original #873 (review findings)

  1. Target-read tokens are minted for the validated target (was: hard-coded openclaw/openclaw). New repair:resolve-result-targets resolves the target repositories from the downloaded worker artifacts (result.repo), fails closed on any repository outside the allowed owner or a malformed identity, falls back to the configured default when no result is present, and the reader token is minted for exactly those repositories after artifact download. Regression tests cover the non-default-target path.
  2. Intake uses a read-only, non-persisted state credential. create-state-token now takes permission inputs; intake requests contents: read / actions: read and hydrates with persist-credentials: "false". Intake's central token and workflow permissions drop to contents-read — intake never publishes from its checkout. Result publication narrows its ClawSweeper app token and workflow permissions to read; state writes go through the state credential and the durable append only.
  3. Publisher-rerun failures are non-blocking. A failed gh run rerun in self-heal logs a warning per run and continues, so one transient API failure cannot suppress the remaining publisher retries or the cluster self-heal step.
  4. Docs state the accurate guarantee: at-least-once workflow creation with exactly-once worker execution intent (receipt-gated worker-side dedupe), matching feat(repair): dispatch durable cluster jobs (rework of #884) #900; also fixed the concurrency description — the worker group is keyed by job path only, not job path + mode.
  5. Rebase-reconciled with fix(state): route all record tuple writes through the canonical DO store #879/feat(state): R2-backed ledger/v1 + assets blob transport, migration workflow, and opt-in dual-read (phase 3 foundation) #899/feat(repair): dispatch durable cluster jobs (rework of #884) #900: canonical-first record writes and blob transport are untouched by the cutover (cluster paths stay under jobs/**/results/**), and the intake wake (state-materializer.yml -f intake_priority=true) drives the feat(repair): dispatch durable cluster jobs (rework of #884) #900 receipt-verified dispatch with claim-before-side-effect ordering.

Validation

  • pnpm run build:all, pnpm run lint, pnpm run check:static (includes format check) — clean.
  • Focused suites: resolve-result-targets, state-delta-paths, cluster-workflow-security, gitcrawl-store, cluster-intake-state, state-materializer, dispatch-receipt-owner, state-writer-workflow, actions-checkout-v7, clawsweeper — all pass.
  • Full test:repair category: only the two known environment-sensitive macOS failures (process-tree-containment Linux symbols, state-publication-batching-proof /private/var aliasing), both untouched by this diff and pre-existing on the base.
  • Codex autoreview (branch diff vs base): clean, "patch is correct (0.98)".

Pre-merge live proof checklist (design only — not yet executed)

One real durable cluster intake → receipt-verified dispatch → worker execution → result publication on a low-traffic allowed-owner target (not openclaw/openclaw), with all production gates preserved and no automerge.

  • Dispatch one real intake against a low-traffic target:
    gh workflow run repair-cluster-intake.yml --repo openclaw/clawsweeper --ref main \
      -f enabled=1 -f target_repo=openclaw/<low-traffic-repo> -f limit=2 -f force_store=true
    Expect: intake log shows durable cluster intake accepted: N job(s), delivery cluster-intake:<slug>:<store-sha>; no state push from the intake run; the state token grant is read-only; a state-materializer.yml run starts with intake_priority=true.
  • Receipt-verified dispatch: materializer log shows accepted-intent receipt verification and the dispatch claim published before workflow_dispatch; exactly one repair-cluster-worker run per stable dispatch key; the state ledger entry carries accepted_intent_receipt; only the accepted job and results/cluster-repair-intake/<slug>.json paths are projected — record unrelated job/ledger blob hashes before and after and verify they are unchanged.
  • Worker execution: one successful "Plan and review cluster" job for the dispatch key; the dispatch receipt is recorded; record append-to-publication and intake-to-dispatch latency.
  • Result publication for a non-default target: the Resolve result target repositories step resolves the actual target from the artifact, the reader token is minted for that repository, and the publish/finalize steps succeed — this is the live proof for finding 1.
  • Crash-window recovery: cancel the materializer run in the window after the dispatch claim is published and before the run receipt is observed, then re-run the materializer. Expect: recovery verifies the accepted-intent receipt and may create a second workflow run (at-least-once creation), and the worker-side receipt gate skips the duplicate planning pass — assert exactly one planning execution in the ledger and no duplicated GitHub side effects.
  • Publisher-rerun non-blocking: with at least one failed repair-publish-results run (< 3 attempts) present, trigger repair-self-heal.yml with execute=false; if a rerun fails, expect the per-run warning and the Self-heal failed cluster runs step still executing.
  • Idempotent replay: re-dispatch intake for the same store snapshot (force_store=true); expect already accepted dedupe and no additional worker run.
  • Do not enable automerge and do not merge generated production PRs as part of this proof. If the selector rejects the batch, retain the rejection report as the correct outcome and re-run against a store snapshot with an eligible cluster.

Credits

Original implementation and stack design by @RomneyDa (#873, on top of #881#884). Maintainer rework applies the review findings from the #873 review thread.

RomneyDa and others added 2 commits July 27, 2026 12:56
Rework of the #873 cutover layer on top of the #900 dispatch rework:

- Result publication resolves the validated target repositories from the
  downloaded worker artifacts (result.repo, fail-closed against the
  allowed owner) and mints its target-read token for those repositories
  instead of hard-coding openclaw/openclaw.
- Intake hydrates state with a read-only, non-persisted credential and
  drops its contents-write grants; it never publishes from its checkout.
- Result publication narrows the ClawSweeper app token and workflow
  permissions to read (state writes use the state credential).
- A failed publisher rerun in self-heal is reported per run and never
  aborts subsequent publisher retries or cluster self-heal work.
- Docs state the accurate guarantee: at-least-once workflow creation
  with exactly-once worker execution intent, receipt-gated worker-side
  dedupe, and job-path-only worker concurrency.
@steipete
steipete requested a review from a team as a code owner July 27, 2026 19:57
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. 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: 🚨 availability 🚨 Merging this PR could cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. labels Jul 27, 2026
@clawsweeper

clawsweeper Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 27, 2026, 6:19 PM ET / 22:19 UTC.

ClawSweeper review

What this changes

This PR routes cluster-repair intake and result publication through the durable state-materializer path, narrows workflow credentials, validates artifact-derived target repositories, and adds recovery-focused tests and operator documentation.

Merge readiness

Blocked until real behavior proof is added - 4 items remain

Keep open: this is a substantial production repair-workflow cutover, and its own checklist says the live durable-intake, non-default-target publication, recovery, and replay proof has not yet run. The remaining code finding is low-risk, but real behavior proof is required before merge. Likely related people: RomneyDa appears to own the original cutover design; steipete is the recent contributor for the merged dispatch substrate and this rework.

Priority: P2
Reviewed head: 2daf71e5d6bc3d03b31fe1024cc8afed4eb9abd7

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The patch has focused implementation and test coverage, but it is not merge-ready because the required real production-like workflow proof is absent.
Proof confidence 🧂 unranked krab (1/6) Needs real behavior proof before merge: The PR explicitly says its complete durable intake, dispatch, publication, recovery, and replay checklist has not yet been executed; attach redacted live logs, terminal output, or recordings showing the after-fix path before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR explicitly says its complete durable intake, dispatch, publication, recovery, and replay checklist has not yet been executed; attach redacted live logs, terminal output, or recordings showing the after-fix path before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 5 items Release-owned changelog entry remains in the branch: The PR still adds a release-note entry even though the repository policy assigns CHANGELOG.md to release ownership and directs normal PRs not to edit it.
Live proof is explicitly outstanding: The PR body marks its durable intake, receipt-verified dispatch, non-default-target result publication, crash recovery, publisher retry, and idempotent replay checklist as design-only and not yet executed.
Focused safety coverage accompanies the workflow cutover: The branch adds target-resolution and exact-state-delta tests, plus workflow security assertions, covering the new artifact target validation and publication boundary.
Findings 1 actionable finding [P3] Remove the release-owned changelog entry
Security None None.

How this fits together

Cluster repair turns grouped GitHub reports into repair-worker jobs. This PR changes the handoff from intake through durable state materialization and then result publication, affecting production workflow dispatch, recovery, and the generated state ledger.

flowchart LR
  A[GitCrawl cluster snapshot] --> B[Cluster intake workflow]
  B --> C[Authenticated durable intake]
  C --> D[State materializer]
  D --> E[Receipt-verified repair worker]
  E --> F[Worker result artifacts]
  F --> G[Validated target result publication]
  G --> H[State ledger and self-heal]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR explicitly says its complete durable intake, dispatch, publication, recovery, and replay checklist has not yet been executed; attach redacted live logs, terminal output, or recordings showing the after-fix path before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Remove the release-owned changelog entry (P3) - Remove this entry from the PR. Repository policy reserves CHANGELOG.md for release ownership, so normal contributor and repair work should retain release context in the PR body or commit message instead.
  • Resolve merge risk (P1) - Merging changes the production intake, dispatch, publication, and recovery path without a completed live durable-cycle proof, so a non-default target, crash-window recovery, or replay failure could stop repair work or leave it unrecoverable.
  • Resolve merge risk (P1) - The workflow changes alter automation credentials and dispatch sequencing; focused tests help, but only a redacted real run can confirm the complete GitHub Actions and durable-state integration.

Findings

  • [P3] Remove the release-owned changelog entry — CHANGELOG.md:12
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Change surface 25 files affected; 798 added, 104 removed The change spans production workflows, repair utilities, tests, and operator docs, so end-to-end proof matters more than unit coverage alone.
Production workflow surface 4 workflow files changed Intake, publication, self-heal, and materialization sequencing jointly determine repair availability.

Merge-risk options

Maintainer options:

  1. Complete the live durable-cycle proof (recommended)
    Run the documented low-traffic allowed-owner intake through receipt-verified dispatch, result publication, recovery, and replay, then post redacted logs or terminal output before merge.
  2. Pause until a safe live target is available
    Keep the branch open rather than merge an unproven production workflow cutover if the required controlled run cannot be performed safely.

Technical review

Best possible solution:

Remove the release-owned changelog entry, then attach redacted live evidence for one allowed non-default target covering intake acceptance, receipt-verified dispatch, result publication, crash recovery, and idempotent replay before merging.

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

No high-confidence current-main reproduction was established in this review. The supplied history identifies prior live failures that motivated the branch, but the branch's full production-like validation checklist remains unexecuted.

Is this the best way to solve the issue?

Unclear until the live proof runs: the durable materializer integration is consistent with the merged dispatch substrate, but this production workflow cutover needs observed end-to-end behavior before it is the confirmed best solution.

Full review comments:

  • [P3] Remove the release-owned changelog entry — CHANGELOG.md:12
    Remove this entry from the PR. Repository policy reserves CHANGELOG.md for release ownership, so normal contributor and repair work should retain release context in the PR body or commit message instead.
    Confidence: 0.99

Overall correctness: patch is correct
Overall confidence: 0.94

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is a normal-priority production repair reliability change with bounded but meaningful workflow blast radius.
  • merge-risk: 🚨 availability: The PR changes intake-to-worker dispatch, recovery, and result publication, so an integration defect can stall repair processing.
  • merge-risk: 🚨 automation: The PR changes GitHub Actions permissions, token wiring, manual publication behavior, and self-heal reruns.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR explicitly says its complete durable intake, dispatch, publication, recovery, and replay checklist has not yet been executed; attach redacted live logs, terminal output, or recordings showing the after-fix path before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

Acceptance criteria:

  • [P1] pnpm run check.

What I checked:

  • Release-owned changelog entry remains in the branch: The PR still adds a release-note entry even though the repository policy assigns CHANGELOG.md to release ownership and directs normal PRs not to edit it. (CHANGELOG.md:12, 2daf71e5d6bc)
  • Live proof is explicitly outstanding: The PR body marks its durable intake, receipt-verified dispatch, non-default-target result publication, crash recovery, publisher retry, and idempotent replay checklist as design-only and not yet executed. (2daf71e5d6bc)
  • Focused safety coverage accompanies the workflow cutover: The branch adds target-resolution and exact-state-delta tests, plus workflow security assertions, covering the new artifact target validation and publication boundary. (test/repair/resolve-result-targets.test.ts:1, 2daf71e5d6bc)
  • Feature-history provenance: The original durable cluster-intake cutover was introduced in commit 3026d39; the current head includes follow-up fixes for allowed-owner parsing, pnpm argument handling, intake candidate admission, and trusted-ref publication. (.github/workflows/repair-cluster-intake.yml:1, 3026d3960b3c)
  • Merged substrate on current main: The current main SHA is the merge commit for feat(repair): dispatch durable cluster jobs (rework of #884) #900, which supplies the receipt-verified materializer dispatch contract this branch integrates with. (src/repair/state-materializer.ts:1, be805237adc2)

Likely related people:

Rank-up moves

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

  • Remove the release-owned CHANGELOG.md entry.
  • Post redacted live proof for an allowed non-default target, including receipt-verified dispatch and result publication.
  • Include recovery and idempotent-replay evidence; updating the PR body should trigger a fresh review, or a maintainer can comment @clawsweeper re-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 (3 earlier review cycles)
  • reviewed 2026-07-27T20:01:01.678Z sha 68b30d3 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-27T20:43:59.209Z sha 8419954 :: needs real behavior proof before merge. :: [P3] Remove the release-owned changelog entry
  • reviewed 2026-07-27T20:57:57.625Z sha 96a6941 :: needs real behavior proof before merge. :: [P3] Remove the release-owned changelog entry

…across the cluster cutover lanes

The production CLAWSWEEPER_ALLOWED_OWNER variable is a comma-separated owner
list (openclaw,steipete; issue #604 / allowedRepairOwners), but three cutover
gates treated it as a single owner and failed closed on every dispatch:

- repair-cluster-intake.yml 'Resolve target repository' rejected the list
  outright (live proof run 30302458881 failed here).
- resolve-result-targets rejected the list before minting the reader token;
  it now validates every result owner against the parsed list and fails
  closed when results span multiple owners, since one publication mints one
  reader token.
- restore-cluster-intake-job compared the job-path owner against the raw
  list string, which could never match.

Proof enablement, no-op on main: the intake wake and worker dispatch now run
on the invoking revision (GITHUB_REF_NAME / CLAWSWEEPER_DISPATCH_REF), and
repair-publish-results gains a validated workflow_dispatch lane for a
completed worker run while workflow_run events stay pinned to trusted
default-branch code.
steipete added 3 commits July 27, 2026 13:39
…r-intake

The hosted runner's pnpm forwards the literal -- from
'pnpm run repair:publish-cluster-intake -- <intent>', so the CLI read '--'
as the intent path and durable acceptance failed with
ENOENT '.../--' (live proof run 30303202343). Use the first real
positional and cover the separator in a CLI regression test.
…contract

The cluster-intake acceptance policy (#900) requires at least two candidate
references, but the importer offered single-open-member clusters and the
selector could choose one, failing the whole intake run at durable
acceptance with 'cluster intake job reference policy mismatch' (live proof
run 30304188033). Filter selection to clusters with >= 2 open members and
skip single-candidate clusters defensively in the job loop.
…a hard main pin

The mid-job 'git checkout -B main origin/main' pin mixed main's package.json
with a branch-built dist/ on the manual publication lane, so
repair:state-delta-paths was missing at 'Commit result ledger' (live proof
run 30308450188). workflow_run events keep publishing default-branch code;
a workflow_dispatch publishes its own write-gated ref.
@steipete
steipete merged commit 83956dd into main Jul 27, 2026
13 checks passed
@steipete
steipete deleted the rework/cluster-intake-cutover branch July 27, 2026 22:40
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. merge-risk: 🚨 availability 🚨 Merging this PR could cause crashes, hangs, restart loops, stalls, or process outages. P2 Normal priority bug or improvement with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants