Repository navigation
ops: smooth audit and reconciliation load bursts - #1410
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs real behavior proof before merge. Reviewed September 4, 2026, 4:12 AM ET / 08:12 UTC. ClawSweeper reviewWhat this changesThe 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 Review scores
Verification
How this fits togetherClawSweeper 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]
Decision needed
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
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest 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. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
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 attempt123/2and claim generation7. 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; Node24.18.1; pnpm11.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-256cc26a5c9639a6a1212c6b7baad7beeaed02ae5bda46e1ed83780666e0d7cb15d). 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:
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, andpnpm run build:repair && node scripts/run-node-tests.mjs repair(1,407 passed, seven skipped). The completepnpm run checkalso 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.