Skip to content

ops: smooth audit and reconciliation load bursts - #1410

Merged
steipete merged 3 commits into
mainfrom
ops/smooth-audit-and-reconcile-load
Sep 4, 2026
Merged

steipete merged 3 commits into
mainfrom
ops/smooth-audit-and-reconcile-load

Conversation

@steipete

@steipete steipete commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

What changed

Addresses the audit and reconciliation load sources tracked in #1372 and all four accepted findings in this fix round.

Scheduled audit fanout keeps the same twelve-target selection, six-hour cadence, and three-child wave limit. The existing signed operational audit cursor now checkpoints remaining targets, outstanding exact run IDs, and an in-flight dispatch marker. A timeout or exhausted lookup retry leaves that state intact. The next invocation resumes the saved remainder and drains earlier children before dispatching another wave. Lookup errors receive two bounded retries with one- and two-second backoff. Missing dispatch receipts stay marked for operator investigation, and unavailable or older batch-unaware storage blocks audit admission before the cursor advances. Normal and hot fanout retain their existing cursor behavior.

The event reconciliation guard now has a 60-second aggregate history-read budget within its three-minute job timeout. Each command is bounded by the remaining budget, and exhaustion or any API error writes reconcile=true. Only a positively verified successful reconciliation still younger than five minutes skips repair. Per-run observations and the independent fifteen-minute terminal-attempt backstop remain unchanged.

Coverage stays after the audit waves to preserve the existing summary timing. Both owners' inventory tokens are freshly minted immediately before coverage collection, using the existing token action and permissions. The two standalone proof scripts were removed; their subprocess and signed loopback workflow-client scenarios now run in the normal suites.

OpenClaw Bay needs no change: the new audit batch field belongs to the authenticated internal operational cursor, and the observer-only API, queue item schemas, and telemetry projections are unchanged. The Worker must support audit batches before the updated fanout can run. No merge, deployment, live workflow dispatch, workflow pause, or changelog edit is part of this fix round.

pr-behavior-proof

Claim: interrupted audit batches preserve the remainder and occupied slots across invocations; history-read errors or deadline exhaustion cannot suppress lease recovery; coverage uses newly minted inventory tokens after the waves.

Surface and scenarios: the built scheduler dispatches twelve real synthetic Node subprocesses. A timeout after the first three persists nine targets and three outstanding IDs to disk; a second invocation reads that checkpoint while those children remain alive, drains them, and finishes all twelve with a peak of three. The actual guard CLI and extracted workflow shell clients run against synthetic Actions history and a signed loopback HTTP service. A separate storage round trip exercises the signed Worker cursor endpoint, owner reconstruction, revision conflicts, and batch clearing.

Observed: twelve audit children completed with a peak of three. Timeout persisted nine remaining targets and three outstanding IDs; resumed polling drained the earlier children before any new dispatch. Lookup retries used 1,000 ms and 2,000 ms backoff. API errors and deadline exhaustion wrote reconcile=true; fresh successful history skipped repair. Recent-success history caused zero queue writes; expired, observer-only, and unavailable history each admitted repair. The scheduled workflow preserved terminal attempt 123/2 and claim generation 7. A mutation replacing the guard's API-error fallback with a throw failed the normal guard test as expected.

Source: 746a16850addc3f36111c66346d2cf9d201daf2a. Provider: aws; lease: cbx_01126134292d; image: ami-0461d919be7deb53c; Linux instance: c7a.8xlarge; Node 24.18.1; pnpm 11.10.0. Full gate run: run_1dcb99779e2b, with Actions hydration disabled. A subsequent run compared hashes for every changed file against the local candidate (manifest SHA-256 cc26a5c9639a6a1212c6b7baad7beeaed02ae5bda46e1ed83780666e0d7cb15d). Captured gate output is retained in the task's local report artifacts; the checked-in normal tests provide the reproduction path.

{"audit":{"targets":12,"completed":12,"peak":3,"persistedRemainder":9,"persistedOutstanding":3},"reconcile":{"deadlineFailOpen":true,"apiErrorFailOpen":true,"freshSuccessSkips":true,"mutationRejected":true,"scheduledTerminalAttempt":"123/2","claimGeneration":7}}

Commands:

pnpm run build:all
node --test test/sweep-workflow.test.ts test/repair/exact-review-reconcile-workflow.test.ts test/repair/target-fanout.test.ts test/repair/fanout-hydration-routing.test.ts test/review-reliability-workflow.test.ts test/repair/workflow-utils.test.ts
node --test --test-name-pattern='audit cursor checkpoints' test/dashboard-worker-publication-lifecycle.test.ts
pnpm run build:repair && node scripts/run-node-tests.mjs repair

Limits: subprocesses and loopback services replace live GitHub audits, history, and queue calls; polling is accelerated. The aggregate-deadline test advances an injected monotonic clock. The token refresh is validated from the workflow definition, without minting live credentials. These checks do not prove hosted Actions scheduling, production hydration cost, or multi-hour live execution. No live workflow was launched for proof.

Validation

Passed pnpm run format, pnpm run build:all, pnpm run lint, pnpm run check:docs, pnpm run check:limits, git diff --check, all six requested focused test files (245 passed), the durable cursor round-trip test, and pnpm run build:repair && node scripts/run-node-tests.mjs repair (1,407 passed, seven skipped). The complete pnpm run check also passed: 4,814 passed, 18 skipped, zero failed.

Final independent local review: clean through P2 for the final staged candidate. Exact-head checks: CI, CodeQL, and automerge E2E.

Validation found and corrected one stale source assertion, a shared-validator narrowing incompatibility with the dashboard compiler settings, and an unnecessary array copy flagged by lint. The complete gates were then rerun successfully. The isolated validator took about seven minutes to provision; no operational workflow or deployment was used.

@steipete
steipete requested a review from a team as a code owner September 4, 2026 07:20
@clawsweeper

clawsweeper Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@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. 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 Sep 4, 2026
@clawsweeper

clawsweeper Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed September 4, 2026, 4:12 AM ET / 08:12 UTC.

ClawSweeper review

What this changes

The PR limits scheduled repository audits to resumable three-target waves and adds a reconciliation cooldown while preserving individual run observations.

Merge readiness

⛔ Blocked before merge - 5 items remain

Both prior code findings are addressed, and this work remains distinct from current main. The audit proof still bypasses the production dispatch and polling clients, leaving the earlier proof gap unresolved.

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

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch addresses the prior findings and has substantial coverage, but incomplete audit transport and upgrade evidence limits readiness.
Proof confidence 🦐 gold shrimp (3/6) Needs stronger real behavior proof before merge: The captured AWS Crabbox evidence supports signed reconciliation clients and subprocess wave accounting, but the audit scenario substitutes command construction, gh dispatch/polling, and persistence. It therefore leaves the prior production-client proof gap unresolved; the cursor round trip additionally uses in-memory storage. 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) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: The captured AWS Crabbox evidence supports signed reconciliation clients and subprocess wave accounting, but the audit scenario substitutes command construction, gh dispatch/polling, and persistence. It therefore leaves the prior production-client proof gap unresolved; the cursor round trip additionally uses in-memory storage. 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 10 items Verified introduced scope: The merge-base-to-head comparison contains 20 changed files, with 1,281 additions and 113 deletions. Review ownership was based on this delta, not base-only changes or the stale test merge.
Current main still uses immediate fanout: Fetched main dispatches selected repositories in a loop and persists only the cursor afterward; it does not preserve outstanding audit children or drain bounded waves.
Release and related-work check: The latest release, v0.3.0, contains neither added audit-state nor reconciliation-guard file. The supplied open report #1372 describes broader queue overload; this PR addresses contributing load sources rather than establishing complete resolution.
Findings None None.
Security None None.

How this fits together

ClawSweeper schedules repository audits and reconciles completed review runs against its Worker-backed queue. These changes control audit load and recovery traffic without changing the public Bay data contract.

flowchart TD
  A[Scheduled audit batch] --> B[Signed audit checkpoint]
  B --> C[Three-target audit waves]
  C --> D[GitHub run completion]
  D --> B
  E[Completed review events] --> F[Reconciliation cooldown]
  F --> G[Queue lease recovery]
  E --> H[Individual run observations]
Loading

Decision needed

Question Recommendation
Should scheduled audits adopt the new stop-until-recovered behavior for unavailable batch storage and ambiguous dispatch receipts? Accept with a staged rollout: Approve the conservative stop behavior once Worker compatibility and receipt recovery are documented and demonstrated.

Why: This intentionally replaces best-effort audit dispatch with an operational dependency and potentially indefinite operator recovery; tests cannot decide whether that availability tradeoff is acceptable.

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: The captured AWS Crabbox evidence supports signed reconciliation clients and subprocess wave accounting, but the audit scenario substitutes command construction, gh dispatch/polling, and persistence. It therefore leaves the prior production-client proof gap unresolved; the cursor round trip additionally uses in-memory storage. 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.
  • Resolve merge risk (P1) - Scheduled fleet audits now stop against an older or unavailable Worker; the acknowledged Worker-first rollout lacks demonstrated compatibility with existing persisted cursors.
  • Resolve merge risk (P1) - An ambiguous dispatch receipt permanently blocks later fleet audit invocations until operator intervention; the documentation names investigation but does not establish a safe recovery procedure.
  • Complete next step (P2) - Add current-head production-client audit and cursor-upgrade evidence, document rollout/recovery, and obtain acceptance of the operational tradeoff. Redacted terminal output or logs are suitable; screenshots or recordings may show the same diagnostics. Update the PR body to trigger a fresh review; if it does not, ask a maintainer to comment @clawsweeper re-review.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production versus test growth Production +429 net lines, including workflows/config; tests +678 net lines Production growth has a stated purpose in durable audit recovery and reconciliation throttling, with substantial focused coverage.

Merge-risk options

Maintainer options:

  1. Verify rollout and recovery (recommended)
    Demonstrate legacy-cursor upgrade and production-client resume behavior, then document deployment order and safe ambiguous-receipt recovery.
  2. Pause the audit-state portion
    Keep the new persistent audit scheduler out of the rollout until its operational recovery contract is accepted.

Technical review

Best possible solution:

Pair durable three-slot accounting with verified legacy-cursor compatibility, a Worker-first rollout, and explicit recovery that cannot forget outstanding audits.

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

Not applicable as a single reproducible defect: this PR adds scheduling controls for documented load bursts; this read-only review did not recreate production overload.

Is this the best way to solve the issue?

Yes, bounded waves and independently coalesced recovery are coherent, focused approaches; their production transport and persisted-state upgrade behavior remain incompletely demonstrated.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add merge-risk: 🚨 compatibility: The new scheduler requires a batch-aware Worker and changes the persisted operational-cursor contract.

Label justifications:

  • P2: This is a bounded operational improvement addressing audit and reconciliation load bursts.
  • merge-risk: 🚨 compatibility: The new scheduler requires a batch-aware Worker and changes the persisted operational-cursor contract.
  • merge-risk: 🚨 automation: An unresolved dispatch marker can stop all later scheduled fleet audit batches until an operator resolves it.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The captured AWS Crabbox evidence supports signed reconciliation clients and subprocess wave accounting, but the audit scenario substitutes command construction, gh dispatch/polling, and persistence. It therefore leaves the prior production-client proof gap unresolved; the cursor round trip additionally uses in-memory storage. 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

What I checked:

  • Verified introduced scope: The merge-base-to-head comparison contains 20 changed files, with 1,281 additions and 113 deletions. Review ownership was based on this delta, not base-only changes or the stale test merge. (746a16850add)
  • Current main still uses immediate fanout: Fetched main dispatches selected repositories in a loop and persists only the cursor afterward; it does not preserve outstanding audit children or drain bounded waves. (src/repair/target-fanout.ts:250, 238d7b531598)
  • Release and related-work check: The latest release, v0.3.0, contains neither added audit-state nor reconciliation-guard file. The supplied open report Exact-review queue Durable Object overloads on records/export; batch publications fail in bursts #1372 describes broader queue overload; this PR addresses contributing load sources rather than establishing complete resolution. (a3469c99f6a8)
  • Prior findings addressed: The guard now bounds all history commands by one 60-second deadline and allows reconciliation after read failures. The workflow also refreshes both inventory tokens after audit dispatch completes, addressing both findings retained from the previous review. (scripts/exact-review-reconcile-guard.mjs:52, 746a16850add)
  • Audit proof retains substituted transport: The captured PR body identifies source 746a168, AWS lease cbx_01126134292d, image ami-0461d919be7deb53c, and run run_1dcb99779e2b. Its subprocess scenario replaces command construction, dispatch/polling, and persistence with callbacks and files; production wiring instead calls workflowDispatchArgs, runGh, and putDurableCursor. Real subprocess completion therefore supports wave accounting but does not prove the changed GitHub transport boundary. (test/repair/target-fanout.test.ts:1181, 746a16850add)
  • Useful reconciliation evidence preserved: The captured body reports successful signed loopback requests through the extracted event and scheduled workflow clients, including terminal attempt 123/2 and claim generation 7. The checked-in scenario executes those shell clients against an HTTP server; Actions history is substituted. (test/repair/exact-review-reconcile-workflow.test.ts:121, 746a16850add)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Martin Cleary: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

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

  • Provide head-matched after-fix evidence through the actual audit dispatch, polling, and signed cursor clients, including interrupted-batch recovery.
  • Demonstrate an existing cursor upgrade and document Worker-first rollout plus safe resolution of ambiguous dispatch receipts.

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-09-04T07:27:00.550Z sha e9aaf71 :: needs real behavior proof before merge. :: [P2] Refresh inventory credentials after the audit-wave wait | [P2] Bound the complete history scan below the job timeout

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: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P2 Normal priority bug or improvement with limited blast radius. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant