Skip to content

fix(operator): classify every dead-letter reconcile skip - #1147

Merged
steipete merged 5 commits into
mainfrom
steipete/operator-skip-taxonomy
Aug 12, 2026
Merged

steipete merged 5 commits into
mainfrom
steipete/operator-skip-taxonomy

Conversation

@steipete

@steipete steipete commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

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_targets directly or called accountSkippedTarget(...) 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, and recovery_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_inconsistent marker is logged if the reason-count sum ever differs from skipped_targets.

Proof

The red phase on fresh origin/main produced 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: 1 and identity_not_actionable: 1. This resolves the actionable finding and applies both related rank-up moves.

Full pnpm run check passed 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 check passed again with the same 3,395-test, zero-failure result. Docker-backed Crabbox provider=local-container lease cbx_d053a32ae64d (coral-crayfish-d152), image node:24-bookworm, passed all 82 operator scenarios against repaired committed head 2d10e57a57b61dae2caf776c3f0004844366dca1 and stopped automatically. The current PR head 1cfe160d45c55b3f581f8d2c94ac4d36fb878dc8 adds only the refreshed committed receipt/captures; the receipt binds the repaired production and test hashes, transcript hashes, zero-finding TruffleHog scan, and cleanup state in docs/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.md change is included because this is operator accounting only.

OpenClaw Bay is unaffected. It already consumes the dynamic observer-only skip_reasons map; this PR changes neither the transport shape nor any queue, workflow, GitHub, recovery, deploy, or rollback action surface.

@clawsweeper

clawsweeper Bot commented Aug 12, 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 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. 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 Aug 12, 2026
@clawsweeper

clawsweeper Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 12, 2026, 6:51 PM ET / 22:51 UTC.

ClawSweeper review

What this changes

The 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 provenance

Possible regression — probable (failure trace; reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

This 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
Reviewed head: 1cfe160d45c55b3f581f8d2c94ac4d36fb878dc8

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is focused, resolves the earlier review finding, and has current content-bound process-boundary evidence.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): A Docker-backed local-container receipt shows the real operator CLI exercising loopback queue and GitHub HTTP boundaries after the fix; the final head preserves the tested production and test blobs by recorded hash.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): A Docker-backed local-container receipt shows the real operator CLI exercising loopback queue and GitHub HTTP boundaries after the fix; the final head preserves the tested production and test blobs by recorded hash.
Evidence reviewed 6 items Current-main gap: Current main increments skipped-target totals through unclassified branches, including the shared per-target accounting helper, so it can emit an empty reason map for deterministic skips.
Current-head implementation: The reviewed PR-head blob records stable reason classes at existing deterministic skip branches and sends reconcile output through a non-throwing accounting-consistency check.
Mixed-path regression coverage: The test combines an installation-missing target with a non-actionable identity and asserts exactly two classified skips; separate coverage checks the mixed invariant and every deterministic branch.
Findings None None.
Security None None.

How this fits together

The 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]
Loading

Before merge

  • Resolve merge risk (P1) - This changes a safety-sensitive operator summary; an unclassified future exit would mislead operators, although the new runtime marker and exhaustive loopback scenarios make that observable.
  • Complete next step (P2) - No actionable repair remains; this PR is ready for normal maintainer merge review once the current status evidence is complete.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production versus test delta production +224/-45, tests +316/-12 The focused regression coverage exceeds the operator-path growth and exercises the newly classified branches.
Proof package 6 proof files added, 82 focused scenarios passed The receipt binds a real CLI and loopback HTTP run to the repaired production and test content.

Merge-risk options

Maintainer options:

  1. Retain the invariant guard and proof (recommended)
    Merge the current implementation with its classified-count invariant and Docker-backed CLI/HTTP receipt as the safeguard for future operator-path changes.

Technical review

Best 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.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. A Docker-backed local-container receipt shows the real operator CLI exercising loopback queue and GitHub HTTP boundaries after the fix; the final head preserves the tested production and test blobs by recorded hash.
  • 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): A Docker-backed local-container receipt shows the real operator CLI exercising loopback queue and GitHub HTTP boundaries after the fix; the final head preserves the tested production and test blobs by recorded hash.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P2: The PR repairs bounded operator diagnostics without evidence of a user-facing outage or unsafe mutation behavior.
  • merge-risk: 🚨 automation: The patch changes the dead-letter reconciliation automation’s emitted accounting and operator-facing status summary.
  • 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): A Docker-backed local-container receipt shows the real operator CLI exercising loopback queue and GitHub HTTP boundaries after the fix; the final head preserves the tested production and test blobs by recorded hash.
  • proof: sufficient: Contributor real behavior proof is sufficient. A Docker-backed local-container receipt shows the real operator CLI exercising loopback queue and GitHub HTTP boundaries after the fix; the final head preserves the tested production and test blobs by recorded hash.

Evidence

What I checked:

Likely related people:

  • steipete: Git history attributes the initial per-target skip-reason work, recovery-cap follow-up, recent throttle work, and this PR’s repaired implementation to the same contributor. (role: introduced and recently maintained skip-accounting behavior; confidence: high; commits: ae04c61896ef, 88fbe4aab561, c8a9737486d5; files: scripts/exact-review-dead-letter-operator.mjs, test/exact-review-dead-letter-operator.test.ts)

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-12T22:37:53.646Z sha acf286e :: needs real behavior proof before merge. :: [P2] Exclude failed targets from identity-not-actionable accounting

@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 status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 12, 2026
@steipete
steipete merged commit 9a25790 into main Aug 12, 2026
18 of 19 checks passed
@steipete
steipete deleted the steipete/operator-skip-taxonomy branch August 12, 2026 22:53
steipete added a commit that referenced this pull request Aug 12, 2026
…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.
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