Repository navigation
fix(operator): classify every dead-letter reconcile skip - #1147
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 12, 2026, 6:51 PM ET / 22:51 UTC. ClawSweeper reviewWhat this changesThe PR assigns stable reason classes and bounded samples to every counted skip in dead-letter reconciliation, with regression coverage and a Docker-backed CLI/HTTP proof receipt. Regression provenancePossible regression — probable (failure trace; reviewed change). No predecessor PR is attributed. Merge readinessThis PR is still necessary and appears correct. It closes the deterministic accounting gaps in the dead-letter reconcile summary, resolves the prior mixed-path double-counting finding, and supplies current-head-bound process-boundary proof. Priority: P2 Review scores
Verification
How this fits togetherThe dead-letter reconcile operator reads queue inventory and GitHub target state, decides which records can safely be cleaned up or recovered, and emits an operator summary. This change makes each conservative skip in that summary explainable without changing selection, recovery, or mutation decisions. flowchart LR
A[Dead-letter inventory] --> B[Reconcile operator]
C[GitHub target reads] --> B
B --> D[Safety and eligibility decisions]
D --> E[Classified skip accounting]
E --> F[Operator reconcile summary]
F --> G[Observer status]
D --> H[Safe recovery or cleanup]
Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the narrowly scoped taxonomy with its invariant marker and focused regression suite, preserving the existing reconciliation and recovery decisions. Do we have a high-confidence way to reproduce the issue? Yes: the red phase against current main produced five empty-reason-map failures, and the repaired real CLI with deterministic loopback queue and GitHub endpoints passed all 82 operator scenarios. Is this the best way to solve the issue? Yes: classifying the existing counted-skip branches is the narrowest maintainable fix, and the patch preserves the recovery, selection, and mutation policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against c8a9737486d5. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
…h dead letters (#1148) DLQ endgame: head-mismatch dead letters resolve as superseded when - and only when - the durable state record proves a newer-head review completed. Evidence baseline: reconcile run 31648987909, the first with the #1147 skip taxonomy, showed the stuck tail is 121/125 head_mismatch - stale review artifacts whose recorded source head no longer matches the live PR head and which must never republish as-is. The new bounded reconcile stage queries the authoritative HMAC state record (/internal/state/records/<repo>/items/<n>) and requires matching repository, number, PR type, review_status complete, digest, and live pull_head_sha before resolving; lifecycle lanes are corroboration only. Without that proof the row stays open under head_mismatch_unproven with samples. Caps: 10 targets/cycle, 20 rows/target; live node/head revalidated immediately before mutation; dry-run honored; tuple_protocol_invalid and workflow_cancelled out of scope; superseded metrics recorded honestly. Proof: Crabbox local-container receipt (docs/proof/head-mismatch-supersede/); red 4 operator contract failures + 1 Worker metric failure -> green 224/224 focused; full gate 3391/0. Verdict clean (no actionable findings) on the final head.
What happened
Post-#1146 reconcile run https://github.com/openclaw/clawsweeper/actions/runs/31646150689 inspected three targets, recovered none, and counted 125 skipped targets while emitting
skip_reasons={}. With 191 open dead-letter rows still in the tail, the operator could not distinguish a stale source head from an active fence, an eligibility decision, a cap, or a conservative inventory/discovery exit.The root cause was accounting drift: most target branches incremented
skipped_targetsdirectly or calledaccountSkippedTarget(...)without recording a class. The GitHub failure paths already had the right shared classifier, but deterministic operator decisions were silent.What changed
This PR records a stable low-cardinality class at every existing reconcile skip decision without changing selection, inspection, cleanup, recovery, pressure, or mutation behavior. The new deterministic classes are
blocked_alias,active_work,no_eligible_rows,head_mismatch,terminal_recheck_cap,inspection_cap,closed_state_changed,duplicate_resolution_partial,inventory_incomplete,discovery_failed,identity_not_actionable,recovery_capacity, andrecovery_mutation_skipped.Existing
recovery_cap,recovery_deferred_pressure,github_throttled, HTTP, timeout, installation, and abort classes retain their current semantics. New samples use the existing bounded sanitizer and{ target, reason }shape; the head-mismatch and no-eligible-row paths are covered explicitly.Revalidation aborts deserve special mention. The operator still stops conservatively, but its existing bulk skip count is now split honestly across the target that changed, targets already inspected, and targets not reached. A non-throwing
reconcile_skip_accounting_inconsistentmarker is logged if the reason-count sum ever differs fromskipped_targets.Proof
The red phase on fresh
origin/mainproduced 77 passes and five failures, all showing empty reason maps. The green operator file passes all 82 scenarios. Every successful loopback reconcile scenario also asserts that the runtime consistency marker is absent, and the mixed invariant fixture asserts four classified reasons for exactly four skipped targets.The first ClawSweeper verdict found one valid P2: after a target inspection failure was already counted, the non-actionable-identity skip-all path added every original group again. The accepted fix restricts that accounting to targets present in the successful identity map. The new mixed regression combines one missing App installation with one non-actionable identity and requires exactly two skipped targets with
installation_missing: 1andidentity_not_actionable: 1. This resolves the actionable finding and applies both related rank-up moves.Full
pnpm run checkpassed on Node 24: 3,395 tests, 3,386 passed, 0 failed, and 9 skipped, with static checks, builds, lint, formatting, and coverage gates green.The repaired full
pnpm run checkpassed again with the same 3,395-test, zero-failure result. Docker-backed Crabboxprovider=local-containerleasecbx_d053a32ae64d(coral-crayfish-d152), imagenode:24-bookworm, passed all 82 operator scenarios against repaired committed head2d10e57a57b61dae2caf776c3f0004844366dca1and stopped automatically. The current PR head1cfe160d45c55b3f581f8d2c94ac4d36fb878dc8adds only the refreshed committed receipt/captures; the receipt binds the repaired production and test hashes, transcript hashes, zero-finding TruffleHog scan, and cleanup state indocs/proof/operator-skip-taxonomy/receipt.json.The pre-commit and committed-branch Codex reviews reported no accepted/actionable findings.
Boundaries
The container proof uses deterministic loopback GitHub and queue endpoints, so it proves the real CLI/HTTP behavior without consuming live GitHub quota or mutating the production queue. No
CHANGELOG.mdchange is included because this is operator accounting only.OpenClaw Bay is unaffected. It already consumes the dynamic observer-only
skip_reasonsmap; this PR changes neither the transport shape nor any queue, workflow, GitHub, recovery, deploy, or rollback action surface.