Skip to content

Commit ae04c61

Browse files
authored
fix(operator): reconciliation surfaces per-target skip reasons (#1117)
The reconciliation operator swallowed target-inspection errors: tonight's production run 31449984643 inspected 20 parked reviews and reported only skipped_targets: 20, with the causes discarded by bare catch blocks. A personal-token replay classified the same rows as 19 open + 1 terminal with zero skips, proving the failures are specific to the workflow token's context -- but the artifact could not say which failure class. Skip diagnostics are now first-class: bounded skip_reasons counters (http_403, http_429, http_5xx, missing_from_existing_repository, invalid_identity, timeout, other) plus up to three sanitized skip_samples, on both the parked and standard reconcile paths. Per review, inspection errors attribute only to the target that threw; targets never reached by an aborted loop get their own not_inspected class rather than inheriting the error. Classification, recovery, and resolution behavior are unchanged -- the same skips now explain themselves. Proof (docs/proof/parked-reconcile-skip-reasons): the current-head operator run read-only against the production inventory with GITHUB_API_URL pointed at a real loopback listener -- an all-403 scenario yields skip_reasons.http_403: 20 with samples, and a mixed scenario proves exact per-target attribution (2 open, 18 http_403). Verified in a Crabbox container with checksum-pinned tooling. The next scheduled reconcile pass will name the workflow-token failure class outright, turning the remaining 20-item parked plateau into a specified fix.
1 parent c145b45 commit ae04c61

13 files changed

Lines changed: 1031 additions & 16 deletions
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Parked reconciliation skip-reason proof
2+
3+
## Claim
4+
5+
Parked-review reconciliation now reports bounded, sanitized, per-target inspection-failure reason
6+
classes and samples. The 20 skipped rows in scheduled production run
7+
https://github.com/openclaw/clawsweeper/actions/runs/31449984643 were caused by the workflow GitHub
8+
token's target-read boundary: replaying that run's immutable 20-row inventory through the unchanged
9+
read-only operator with Peter's personal `gh` token classified every target.
10+
11+
The after-fix trace also proves the error path through a real loopback HTTP listener: 20 issue-read
12+
403s produce exactly 20 `http_403` skips, while a mixed run with two open targets produces exactly 18
13+
`http_403` skips and preserves the two successful targets.
14+
15+
## Exercised surface
16+
17+
- Production artifact `exact-review-dlq-reconcile-31449984643-1` (artifact id `9085971968`)
18+
- Built `scripts/exact-review-dead-letter-operator.mjs --action reconcile-parked` without `--execute`
19+
- Peter's personal GitHub token from `gh auth token`
20+
- The live public queue-pressure payload (`idle`, capacity 128, active 7)
21+
- Node 24.19.0 and pnpm 11.10.0 on macOS
22+
23+
The production environment-scoped `EXACT_REVIEW_OPERATOR_SECRET` is intentionally non-retrievable.
24+
The signed inventory request was therefore replayed over loopback from the immutable production
25+
artifact. Null `excluded_reason` fields added by artifact sanitization were omitted to restore the
26+
signed list route's wire shape. GitHub target inspection and classification remained live and used
27+
the personal token. No queue mutation route was available from the loopback replay, and the operator
28+
was not passed `--execute`.
29+
30+
## Diagnosis record: base-SHA replay
31+
32+
This section is the original diagnosis record, not the after-fix error-path proof. Its replay used
33+
base SHA `c145b4599285969b43e40d0816071893d5090501`; full provenance remains in
34+
`production-provenance.json`.
35+
36+
The scheduled workflow-token run emitted:
37+
38+
```json
39+
{"action":"reconcile-parked","dry_run":false,"inventory_complete":true,"queue_pressure":"idle","inspected_targets":20,"terminal_targets":0,"repository_gone_targets":0,"resolved_targets":0,"open_targets":0,"recovered_targets":0,"skipped_targets":20}
40+
```
41+
42+
The personal-token read-only replay emitted the exact contents of `read-only-summary.json`: all 20
43+
targets were inspected, 1 was terminal, 19 were open, 5 fit the bounded recovery preview, and the
44+
remaining 14 were skipped only by the recovery budget. There were no inspection failures, so
45+
`skip_reasons` is empty.
46+
47+
## After-fix error-path trace
48+
49+
`run-error-trace.mjs` read the same immutable artifact (SHA-256
50+
`1187c6042803b5ba98048d64157cb98a5399c1cbde76b69ce25f18dffe23b88f`), bound a real Node HTTP
51+
listener to `127.0.0.1` on an ephemeral port, and launched the current source-tree operator as a
52+
separate process with `GITHUB_API_URL` pointing at that listener. Both runs omitted `--execute`,
53+
unset `GITHUB_TOKEN`, exposed no mutation route, and recorded only redacted request metadata.
54+
55+
All 20 issue lookups returned 403. `all-403-summary.json` contains this verbatim summary:
56+
57+
```json
58+
{"action":"reconcile-parked","dry_run":true,"inventory_complete":true,"queue_pressure":"idle","inspected_targets":20,"terminal_targets":0,"repository_gone_targets":0,"resolved_targets":0,"open_targets":0,"recovered_targets":0,"skipped_targets":20,"skip_reasons":{"http_403":20},"skip_samples":[{"target":"steipete/codexbar#2367","reason":"parked review target check failed for steipete/codexbar#2367 with 403"},{"target":"steipete/codexbar#2407","reason":"parked review target check failed for steipete/codexbar#2407 with 403"},{"target":"steipete/codexbar#2469","reason":"parked review target check failed for steipete/codexbar#2469 with 403"}]}
59+
```
60+
61+
The mixed scenario returned 200-open for the first two targets and 403 for the remaining 18.
62+
Because the dry-run recovery preview rechecks open targets, the socket trace contains four 200 issue
63+
responses for two unique targets. `mixed-summary.json` contains this verbatim summary:
64+
65+
```json
66+
{"action":"reconcile-parked","dry_run":true,"inventory_complete":true,"queue_pressure":"idle","inspected_targets":20,"terminal_targets":0,"repository_gone_targets":0,"resolved_targets":0,"open_targets":2,"recovered_targets":2,"skipped_targets":18,"skip_reasons":{"http_403":18},"skip_samples":[{"target":"steipete/codexbar#2469","reason":"parked review target check failed for steipete/codexbar#2469 with 403"},{"target":"steipete/codexbar#2471","reason":"parked review target check failed for steipete/codexbar#2471 with 403"},{"target":"steipete/codexbar#2473","reason":"parked review target check failed for steipete/codexbar#2473 with 403"}]}
67+
```
68+
69+
`after-fix-error-trace.jsonl` records the 46 loopback requests and response statuses.
70+
`after-fix-error-trace-provenance.json` records the artifact identity, exact operator content hash,
71+
command, transport, response mix, and proof limits.
72+
73+
## Gates
74+
75+
- `pnpm run build:all`: passed
76+
- `pnpm run test:no-build`: 3,318 tests; 3,309 passed, 9 skipped, 0 failed
77+
- `pnpm run lint`: passed
78+
- `pnpm run format:check`: passed
79+
- `pnpm run check:active-surface`: passed
80+
81+
Fresh-PR container proof used Crabbox `provider=aws`, lease `cbx_0fc9d2f49c92`
82+
(`pearl-prawn-4739`), and run `run_2f53d8d972e6`. The clean PR 1117 checkout at
83+
`8dd3a55bb774ec30fdc5a39fbf7957f53810863f` ran inside `node:24-bookworm` on Docker 29.7.1.
84+
Corepack installed pinned pnpm 11.10.0. jq 1.8.1 was installed under `$HOME/.local/bin` only after
85+
`jq-linux-amd64` verified against the official release checksum
86+
`020468de7539ce70ef1bceaf7cde2e8c4f2ca6c3afb84642aabc5c97d9fc2a0d`. All 57 focused operator
87+
tests passed in 11.2 seconds for that diagnosis-round head; Crabbox reported exit 0 and stopped the
88+
lease automatically. Full machine-readable details are in `container-provenance.json`. The final
89+
after-fix head receives a separate fresh-PR container run after push.
90+
91+
## Limits and Bay impact
92+
93+
This production observation proves the token-boundary diagnosis and the successful-target summary.
94+
The focused operator tests cover per-target standard-reconcile discovery and recovery-revalidation
95+
attribution, reason classification, bounded samples, credential and control-byte sanitization, and
96+
output truncation. The replay did not mutate production queue state and cannot prove the production
97+
Worker's signed list route beyond the immutable uploaded artifact.
98+
99+
OpenClaw Bay is unaffected. The change adds diagnostic fields to an operator-only JSON summary; it
100+
does not change lifecycle publication, dashboard data, or the observer-only Bay surface.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"schema": "clawsweeper-real-boundary-proof-provenance/v1",
3+
"claim": "The current source-tree operator attributes loopback GitHub issue lookup failures per parked target while replaying the immutable 20-row production inventory read-only.",
4+
"generated_at": "2026-08-11T03:36:07.839Z",
5+
"source": {
6+
"run_id": 31449984643,
7+
"run_url": "https://github.com/openclaw/clawsweeper/actions/runs/31449984643",
8+
"artifact_id": 9085971968,
9+
"artifact_name": "exact-review-dlq-reconcile-31449984643-1",
10+
"artifact_file": "parked-reviews.json",
11+
"artifact_sha256": "1187c6042803b5ba98048d64157cb98a5399c1cbde76b69ce25f18dffe23b88f",
12+
"rows": 20
13+
},
14+
"execution": {
15+
"operator": "scripts/exact-review-dead-letter-operator.mjs",
16+
"operator_sha256": "65142cf590de47947dd9dd6c6086f51883f7cc68c6b7397141e6afcbe7957930",
17+
"command": "node scripts/exact-review-dead-letter-operator.mjs --action reconcile-parked --max-targets 100 --max-recoveries 5 --output <temporary-path>",
18+
"execute": false,
19+
"transport": "real Node HTTP listener bound to 127.0.0.1 on an ephemeral port",
20+
"github_api_url": "http://127.0.0.1:<ephemeral-port>",
21+
"github_token": "unset",
22+
"node": "v24.19.0"
23+
},
24+
"scenarios": {
25+
"all_403": {
26+
"github_issue_responses": {
27+
"http_403": 20
28+
},
29+
"request_count": 22,
30+
"summary_artifact": "all-403-summary.json"
31+
},
32+
"mixed": {
33+
"github_issue_responses": {
34+
"http_200_open": 4,
35+
"http_403": 18
36+
},
37+
"unique_open_targets": 2,
38+
"request_count": 24,
39+
"summary_artifact": "mixed-summary.json"
40+
}
41+
},
42+
"trace_artifact": "after-fix-error-trace.jsonl",
43+
"limits": [
44+
"The production artifact supplies inventory rows; queue pressure and GitHub responses are deterministic loopback HTTP responses.",
45+
"The artifact's explicit excluded_reason null values are omitted when replayed because the Worker wire payload omits that optional field; all substantive row values are unchanged.",
46+
"The operator ran without --execute, and the listener implemented no mutation endpoint.",
47+
"The trace records method, pathname, scenario, and response status only; request headers and local signing material are omitted."
48+
]
49+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{"scenario":"all-403","method":"POST","pathname":"/internal/exact-review/parked-reviews/list","response_status":200}
2+
{"scenario":"all-403","method":"GET","pathname":"/api/exact-review-queue","response_status":200}
3+
{"scenario":"all-403","method":"GET","pathname":"/repos/steipete/codexbar/issues/2367","response_status":403}
4+
{"scenario":"all-403","method":"GET","pathname":"/repos/steipete/codexbar/issues/2407","response_status":403}
5+
{"scenario":"all-403","method":"GET","pathname":"/repos/steipete/codexbar/issues/2469","response_status":403}
6+
{"scenario":"all-403","method":"GET","pathname":"/repos/steipete/codexbar/issues/2471","response_status":403}
7+
{"scenario":"all-403","method":"GET","pathname":"/repos/steipete/codexbar/issues/2473","response_status":403}
8+
{"scenario":"all-403","method":"GET","pathname":"/repos/steipete/codexbar/issues/2495","response_status":403}
9+
{"scenario":"all-403","method":"GET","pathname":"/repos/steipete/codexbar/issues/2502","response_status":403}
10+
{"scenario":"all-403","method":"GET","pathname":"/repos/steipete/codexbar/issues/2512","response_status":403}
11+
{"scenario":"all-403","method":"GET","pathname":"/repos/steipete/codexbar/issues/2522","response_status":403}
12+
{"scenario":"all-403","method":"GET","pathname":"/repos/steipete/codexbar/issues/2578","response_status":403}
13+
{"scenario":"all-403","method":"GET","pathname":"/repos/steipete/codexbar/issues/2580","response_status":403}
14+
{"scenario":"all-403","method":"GET","pathname":"/repos/steipete/codexbar/issues/2582","response_status":403}
15+
{"scenario":"all-403","method":"GET","pathname":"/repos/steipete/codexbar/issues/2591","response_status":403}
16+
{"scenario":"all-403","method":"GET","pathname":"/repos/steipete/codexbar/issues/2598","response_status":403}
17+
{"scenario":"all-403","method":"GET","pathname":"/repos/steipete/codexbar/issues/2609","response_status":403}
18+
{"scenario":"all-403","method":"GET","pathname":"/repos/steipete/codexbar/issues/2610","response_status":403}
19+
{"scenario":"all-403","method":"GET","pathname":"/repos/steipete/codexbar/issues/2614","response_status":403}
20+
{"scenario":"all-403","method":"GET","pathname":"/repos/steipete/codexbar/issues/2616","response_status":403}
21+
{"scenario":"all-403","method":"GET","pathname":"/repos/steipete/oracle/issues/336","response_status":403}
22+
{"scenario":"all-403","method":"GET","pathname":"/repos/steipete/oracle/issues/341","response_status":403}
23+
{"scenario":"mixed","method":"POST","pathname":"/internal/exact-review/parked-reviews/list","response_status":200}
24+
{"scenario":"mixed","method":"GET","pathname":"/api/exact-review-queue","response_status":200}
25+
{"scenario":"mixed","method":"GET","pathname":"/repos/steipete/codexbar/issues/2367","response_status":200}
26+
{"scenario":"mixed","method":"GET","pathname":"/repos/steipete/codexbar/issues/2407","response_status":200}
27+
{"scenario":"mixed","method":"GET","pathname":"/repos/steipete/codexbar/issues/2469","response_status":403}
28+
{"scenario":"mixed","method":"GET","pathname":"/repos/steipete/codexbar/issues/2471","response_status":403}
29+
{"scenario":"mixed","method":"GET","pathname":"/repos/steipete/codexbar/issues/2473","response_status":403}
30+
{"scenario":"mixed","method":"GET","pathname":"/repos/steipete/codexbar/issues/2495","response_status":403}
31+
{"scenario":"mixed","method":"GET","pathname":"/repos/steipete/codexbar/issues/2502","response_status":403}
32+
{"scenario":"mixed","method":"GET","pathname":"/repos/steipete/codexbar/issues/2512","response_status":403}
33+
{"scenario":"mixed","method":"GET","pathname":"/repos/steipete/codexbar/issues/2522","response_status":403}
34+
{"scenario":"mixed","method":"GET","pathname":"/repos/steipete/codexbar/issues/2578","response_status":403}
35+
{"scenario":"mixed","method":"GET","pathname":"/repos/steipete/codexbar/issues/2580","response_status":403}
36+
{"scenario":"mixed","method":"GET","pathname":"/repos/steipete/codexbar/issues/2582","response_status":403}
37+
{"scenario":"mixed","method":"GET","pathname":"/repos/steipete/codexbar/issues/2591","response_status":403}
38+
{"scenario":"mixed","method":"GET","pathname":"/repos/steipete/codexbar/issues/2598","response_status":403}
39+
{"scenario":"mixed","method":"GET","pathname":"/repos/steipete/codexbar/issues/2609","response_status":403}
40+
{"scenario":"mixed","method":"GET","pathname":"/repos/steipete/codexbar/issues/2610","response_status":403}
41+
{"scenario":"mixed","method":"GET","pathname":"/repos/steipete/codexbar/issues/2614","response_status":403}
42+
{"scenario":"mixed","method":"GET","pathname":"/repos/steipete/codexbar/issues/2616","response_status":403}
43+
{"scenario":"mixed","method":"GET","pathname":"/repos/steipete/oracle/issues/336","response_status":403}
44+
{"scenario":"mixed","method":"GET","pathname":"/repos/steipete/oracle/issues/341","response_status":403}
45+
{"scenario":"mixed","method":"GET","pathname":"/repos/steipete/codexbar/issues/2367","response_status":200}
46+
{"scenario":"mixed","method":"GET","pathname":"/repos/steipete/codexbar/issues/2407","response_status":200}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"action": "reconcile-parked",
3+
"dry_run": true,
4+
"inventory_complete": true,
5+
"queue_pressure": "idle",
6+
"inspected_targets": 20,
7+
"terminal_targets": 0,
8+
"repository_gone_targets": 0,
9+
"resolved_targets": 0,
10+
"open_targets": 0,
11+
"recovered_targets": 0,
12+
"skipped_targets": 20,
13+
"skip_reasons": {
14+
"http_403": 20
15+
},
16+
"skip_samples": [
17+
{
18+
"target": "steipete/codexbar#2367",
19+
"reason": "parked review target check failed for steipete/codexbar#2367 with 403"
20+
},
21+
{
22+
"target": "steipete/codexbar#2407",
23+
"reason": "parked review target check failed for steipete/codexbar#2407 with 403"
24+
},
25+
{
26+
"target": "steipete/codexbar#2469",
27+
"reason": "parked review target check failed for steipete/codexbar#2469 with 403"
28+
}
29+
]
30+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Parked reconciliation skip-reason behavior contract
2+
3+
## User-visible goal
4+
5+
A maintainer running parked reconciliation can distinguish GitHub inspection failures from ordinary
6+
capacity skips without leaking credentials or unbounded error text.
7+
8+
## Target
9+
10+
- Type: CLI
11+
- Access: `node scripts/exact-review-dead-letter-operator.mjs --action reconcile-parked`
12+
- Allowed fixture: the immutable 20-row production artifact from run 31449984643
13+
- Allowed credential source: `GITHUB_TOKEN` from Peter's authenticated `gh` session
14+
- Allowed error-path transport: a real loopback HTTP listener selected through `GITHUB_API_URL`
15+
16+
## User tasks
17+
18+
1. Run reconciliation without `--execute` against the production inventory.
19+
2. Read the terminal JSON summary and identify classified targets and inspection failures.
20+
3. Contrast all-403 and mixed 200-open/403 GitHub issue responses through the real HTTP path.
21+
22+
## Expected observable behavior
23+
24+
- The command remains read-only and reports `dry_run: true`.
25+
- Every production row is accounted for by terminal, open, excluded, capacity-skipped, or
26+
inspection-failed outcomes.
27+
- Inspection failures populate bounded `skip_reasons` counts and at most three sanitized
28+
`skip_samples`; a run without inspection failures emits empty containers.
29+
- Each target receives only its own inspection result: all-403 reports 20 failures, while the mixed
30+
run retains two open targets and reports 18 failures.
31+
- Summary text does not expose credentials or control bytes, and individual reasons are at most 240
32+
characters.
33+
34+
## Anti-cheat probes
35+
36+
- Contrast the same 20-row inventory under the scheduled workflow token and Peter's personal token.
37+
- Replay the same inventory through real loopback HTTP with all-403 and mixed response policies.
38+
- Require the personal-token counts to account for all 20 rows.
39+
- Run focused fixtures containing multiple status classes, credential-shaped text, control bytes,
40+
and overlong messages.
41+
42+
## Evidence required
43+
44+
- Exact terminal summary
45+
- Immutable production run and artifact identity plus SHA-256 hashes
46+
- Focused test and full gate results
47+
- Fresh PR container result and lease identity
48+
49+
## Out of scope
50+
51+
Queue mutations, production secret retrieval, dashboard rendering, and OpenClaw Bay.

0 commit comments

Comments
 (0)