Repository navigation
fix(reconcile): survive target-read throttling - #1146
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 12, 2026, 5:56 PM ET / 21:56 UTC. ClawSweeper reviewWhat this changesThe PR moves dead-letter target reads to scoped GitHub App credentials, adds bounded throttle handling, and records loopback recovery proof. Regression provenancePossible regression — probable (reviewed change; failure trace). No predecessor PR is attributed. Merge readinessKeep this PR open for normal landing review. The final branch addresses the prior per-owner negative-cache finding with repository-scoped installation-missing handling; no new discrete patch defect is evidenced, but the current failing Priority: P1 Review scores
Verification
How this fits togetherThe exact-review dead-letter operator reads target GitHub metadata before asking the queue service to recover review work. This change selects target credentials and classifies read failures before those recovery decisions. flowchart LR
A[Dead-letter inventory] --> B[Target owner lookup]
B --> C[GitHub App token]
C --> D[REST and GraphQL inspection]
D --> E[Throttle or authorization decision]
E --> F[Queue recovery]
F --> G[Reconciled review work]
Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Preserve explicit GitHub App target-read mode, repository-scoped installation-missing caching, and fail-closed authorization handling, then land after the current-head required check is green. Do we have a high-confidence way to reproduce the issue? Yes: the supplied proof defines a loopback CLI path for installation lookup, token minting, REST, and GraphQL throttling, including the same-owner selected-repositories case; this review did not rerun it locally. Is this the best way to solve the issue? Yes: reusing the existing GitHub App signing and installation-token primitives while caching only confirmed owner-wide outcomes is the narrowest maintainable repair. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 3d09c5f72ab2. LabelsLabel 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 (5 earlier review cycles)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
Accounting-only change: every skip path in the dead-letter operator now emits a stable reason class, and a tested invariant guarantees skip_reasons explains 100% of skipped_targets. Motivation: post-#1146 reconcile run 31646150689 reported inspected=3, recovered=0, skipped=125 with an EMPTY skip_reasons map - the stuck DLQ tail (191 open) could not be diagnosed from the summary. New classes: inventory_incomplete, discovery_failed, identity_not_actionable, blocked_alias, active_work, no_eligible_rows, inspection_cap, terminal_recheck_cap, closed_state_changed, head_mismatch, recovery_capacity, duplicate_resolution_partial, recovery_mutation_skipped; existing throttle/HTTP/installation classes unchanged. Bounded skip_samples for the interesting classes (head_mismatch, no_eligible_rows). Zero behavior change. Proof: Crabbox local-container receipt at this exact head (docs/proof/operator-skip-taxonomy/); mixed-scenario invariant sum(skip_reasons)==skipped_targets; operator suite 82/82; full gate 3395/0. Verdict clean (Findings: None) on 1cfe160.
Summary
The 2026-08-12T19:46Z dead-letter cycle around run 31634514031 completed successfully but recovered nothing:
inspected_targets=3,skipped_targets=125,recovered_targets=0, andskip_reasons={"http_403":1,"not_inspected_abort":2}. At the same time, therepository_actionsbucket was under sustained pressure while thetarget_appbucket was nearly idle.The root cause was a credential-boundary mismatch combined with conservative all-or-nothing discovery. Standard target REST checks, parked-review REST checks, and batched GraphQL canonical discovery all read
GITHUB_TOKEN; the scheduled workflow bound that variable to${{ github.token }}, so public target inspection competed with artifact and Actions API traffic onrepository_actions.This PR mints read-only contents, issues, and pull-request tokens from the existing ClawSweeper GitHub App installation for each target owner. The operator reuses the Worker's canonical App credential, signing, installation, and token plumbing; GraphQL batches remain owner-homogeneous. Artifact discovery/download, queued-run remediation, and signed Worker inventory/resolve/recover calls keep their prior credentials and ownership boundaries.
The owner decision is explicit: cross-owner recovery must be preserved. A genuinely absent or revoked target installation is a structured
installation_missingskip, never a cycle abort or a fallback to the repository Actions token. Successful installation tokens and confirmed setup-throttle rejections are cached per owner for the cycle. Installation-missing outcomes are cached per repository, so a missing repository in a selected-repositories installation cannot suppress a later accessible repository under the same owner. Per-repository REST/GraphQL reads still enforce the token/repository pairing and fail closed on authorization or missing-resource responses.Target reads default to explicit
github-appmode. Key-only, App-ID-only, and entirely absent App configuration are hard failures naming the missing field before any queue or GitHub request.GH_TOKEN/GITHUB_TOKENcan be used for target reads only through the explicitEXACT_REVIEW_TARGET_TOKEN_MODE=actionsopt-in. Both checked-in operator workflows selectgithub-appand pass the private-key secret.Nothing else changes: target-read throttles keep the existing bounded skip policy, ordinary target authorization failures keep the conservative abort, and all existing target, recovery, GraphQL batch, terminal-recheck, and inventory caps remain in force.
Review finding disposition
github_throttled scope=app_setupskips. A cached owner throttle counts once toward the three-call fuse; three distinct throttled owners still stop the phase.actionsmode.installation_missingpromises now use a normalized repository key until their outcome is known. Only a successful installation token or a confirmed setup throttle is promoted to the owner cache. The selected-repositories regression proves repo A can return an installation 404 while repo B under the same owner mints and recovers in the same cycle.Token routing before and after
repository_actionsvia${{ github.token }}target_appinstallation tokenrepository_actionsvia${{ github.token }}target_apptokenrepository_actionsrepository_actionsrepository_actionsrepository_actionsReal-behavior proof
Claim: App target-read mode fails at startup for every incomplete App credential pair and never silently uses the repository Actions token. With complete App credentials, successful installation tokens and setup throttles remain owner-scoped, while an installation-missing repository cannot hide an accessible sibling repository. Confirmed setup or target-read throttles remain bounded skips; genuine authorization failures remain fail-closed.
Exercised surface: the real
scripts/exact-review-dead-letter-operator.mjsCLI process, checked-in workflow YAML parsing, real App JWT signing with an ephemeral test key, and loopback HTTP selected throughGITHUB_API_URLfor queue, installation lookup, token mint, REST, and GraphQL traffic.Round-5 red/green: the new same-owner selected-repositories test failed before the cache fix with
recovered_targets=0instead of 1, while both existing owner-throttle cases passed. After the fix, all three focused cases passed. The complete operator file passed 80/80 on Node 24.Environment and receipt: Docker-backed Crabbox
provider=local-container, leasecbx_2c2320c8c201(crimson-hermit-97fb), imagenode:24-bookworm, Node 24.19.0, and pinned pnpm 11.10.0. The final run passed 27/27 focused real-process scenarios and stopped the lease automatically.docs/proof/reconcile-throttle-resilience/receipt.jsonbinds code head5a89572fa541de992d34afad7cf5d674208eccd0, the proof harness, executable inputs, and sanitized transcripts by SHA-256. Final branch head3ae7bf80a9afb742ecad8a118c5466aa2670ffe1adds only that refreshed proof receipt and transcript. TruffleHog 3.96.0 reported zero verified or unknown secrets.Full gate:
pnpm run checkpassed on Node 24, including static policy and documentation checks, formatting, all builds, type-aware lint, changed coverage, and the full coverage suite.Limits: GitHub installation, token, throttling, and queue responses are deterministic loopback fixtures. No production credential, live GitHub quota exhaustion, or production queue mutation was exercised. The receipt proves credential selection, cache behavior, classification, and bounded CLI/HTTP behavior, not live GitHub App issuance.
OpenClaw Bay
OpenClaw Bay is unaffected. This changes internal operator credential caching only; there is no observer data contract or action surface, and Bay remains observer-only.
Current head:
3ae7bf80a9afb742ecad8a118c5466aa2670ffe1.