Skip to content

Commit 5ea082a

Browse files
committed
docs(proof): record bounded remediation container proof
1 parent b46b579 commit 5ea082a

3 files changed

Lines changed: 133 additions & 26 deletions

File tree

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
# Stuck queued-run remediation proof
22

3-
This proof covers the read-only planning surface for the scheduled stuck-run remediation lane. The claim is intentionally narrow: a queued run is selected only after it is older than 90 minutes and at least three newer runs of the same GitHub Actions workflow have reached `in_progress` or `completed`. Known permanent zombies and the intentionally serialized repair-cluster workflow are excluded before history is fetched.
3+
The scheduled remediation lane now inspects at most eight distinct stale workflows per pass, oldest queued run first. It also has a two-minute total runtime cap. When the shared `EXACT_REVIEW_RECONCILE_DEADLINE_MS` is present, the effective remediation deadline is the earlier of that cap and the shared deadline minus eight minutes, preserving 480,000 ms for guard verification and both dead-letter stages. Every GitHub request uses the remaining total budget. A partial pass writes `deadline_reached` plus distinct, inspected, and skipped workflow counts to its artifact and step summary.
44

5-
`live-dry-run.json` was captured against `openclaw/clawsweeper` with:
5+
The timeout regression starts the production script against a loopback history provider that takes 20 seconds per call and exposes 20 distinct stale workflows. With the shared deadline constrained, the script stops after one attempted history request in about 1.5 seconds, reports one inspected and 19 skipped workflows (12 by the eight-workflow cap and seven by deadline), and retains the full eight-minute dead-letter reserve.
66

7-
```bash
8-
GH_TOKEN="$(gh auth token)" node scripts/stuck-queued-run-remediation.mjs \
9-
--repository openclaw/clawsweeper \
10-
--output docs/proof/stuck-queued-run-remediation/live-dry-run.json \
11-
--zombie-output .artifacts/exact-review-dlq/stuck-queued-zombies.json
12-
```
7+
`loopback-proof-receipt.json` records the production script's after-fix summary from the Docker-backed Crabbox proof. The loopback GitHub API exposed one two-hour-old queued run with three later same-workflow starts and one ten-minute-old queued run. The script selected and revalidated only the stranded run, posted exactly one regular cancellation, recorded `cancel_requested` with HTTP 202, and left the young run untouched.
138

14-
The 2026-08-12T03:39:23.031Z snapshot inspected all 18 queued runs returned by GitHub. One current run was younger than the threshold, the other 17 were the already-proven permanent zombies from the July and August incidents, and the cancellation plan was empty. The command made no mutation requests.
9+
The second scenario is recorded in the same receipt. Regular and force cancellation both returned HTTP 500, so the script persisted the run as a permanent zombie. A second production-script pass restored that state, classified the old run as `permanent_zombie`, made no cancellation request, and left the young run untouched. The receipt contains the redacted request traces and all three behavior assertions.
1510

16-
Unit tests exercise the positive stale-plus-three-starts case, a global capacity crunch with no newer starts, the strict age boundary, the expected-long-queue exclusion, the ten-run cap, and the 500→500 permanent-zombie path. `container-receipt.json` records the exit-zero Docker proof for committed revision `5091608743e1e82a3fc9050c700e66603241684f`: Crabbox provider `aws`, lease `cbx_ce4df34fd731`, run `run_ad000b26448d`, and image `node:24-bookworm`. All 69 focused tests, static checks, TypeScript builds, and lint lanes passed, and the lease stopped.
11+
`container-receipt.json` records the current-pushed-head Crabbox run for revision `b46b579b6d12d940cb068b32da20a23e8c39b000`: provider `local-container`, lease `cbx_821f20930574`, slug `amber-shrimp-5247`, and Docker image `node:24-bookworm`. All 71 focused tests, the loopback production-script proof, static policy and documentation checks, formatting, all TypeScript builds, and every lint lane passed. Crabbox stopped the lease automatically.
1712

18-
Limits: this proof uses GitHub's live workflow-run inventory but deliberately does not manufacture or cancel a production candidate. The cancellation API behavior is covered with injected responses in the pure remediation tests; the two production incidents are the real-world evidence that regular cancellation is safe for this queue because `workflow_cancelled` is retryable and cleanly re-dispatched. Crabbox raw sync does not copy `.git`, so the full 3,343-test `pnpm run check` proof remains the clean host-checkout run; the Docker receipt covers the changed behavior plus every container-valid static, build, and lint gate.
13+
The earlier live read-only inventory remains in `live-dry-run.json`. It inspected all 18 queued runs returned by GitHub at 2026-08-12T03:39:23.031Z, found one young run plus the 17 seeded permanent zombies, selected nothing, and made no mutation request.
14+
15+
Limits: the after-fix transport is a loopback HTTP fixture rather than live GitHub mutation. It exercises the production CLI, request routing through `GITHUB_API_URL`, selection, live-status revalidation, regular and force cancellation endpoints, summary writing, and restored zombie-state behavior. The host Node 24 `pnpm run check` remains the broad repository gate: 3,345 tests, 3,336 passes, nine platform skips, and zero failures.
Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
11
{
22
"schema_version": 1,
3-
"tested_commit": "5091608743e1e82a3fc9050c700e66603241684f",
4-
"provider": "aws",
5-
"lease_id": "cbx_ce4df34fd731",
6-
"lease_slug": "blue-crayfish-6280",
7-
"run_id": "run_ad000b26448d",
8-
"machine_type": "c7a.8xlarge",
3+
"tested_commit": "b46b579b6d12d940cb068b32da20a23e8c39b000",
4+
"provider": "local-container",
5+
"lease_id": "cbx_821f20930574",
6+
"lease_slug": "amber-shrimp-5247",
7+
"run_id": null,
8+
"machine_type": "node_24-bookworm",
99
"container_image": "node:24-bookworm",
10-
"command": "corepack enable && pnpm install --frozen-lockfile && node --test test/stuck-queued-run-remediation.test.ts test/review-reliability-workflow.test.ts test/exact-review-dead-letter-operator.test.ts && pnpm run check:static && pnpm run build:all && pnpm run lint",
10+
"fresh_pr": "https://github.com/openclaw/clawsweeper/pull/1131",
11+
"command": "verify pushed HEAD; install with the pinned pnpm; run 71 focused tests; run the loopback production-script scenarios; run check:static, build:all, and lint",
1112
"result": {
1213
"status": "succeeded",
1314
"exit_code": 0,
1415
"focused_tests": {
15-
"total": 69,
16-
"passed": 69,
16+
"total": 71,
17+
"passed": 71,
1718
"failed": 0
1819
},
20+
"loopback_assertions": {
21+
"stranded_cancelled_exactly_once": true,
22+
"young_run_untouched": true,
23+
"zombie_500_500_persisted": true
24+
},
1925
"gates": [
2026
"dependency lockfile and supply-chain policy",
2127
"active-surface, dashboard-boundary, documentation, limits, and formatting checks",
@@ -24,14 +30,19 @@
2430
]
2531
},
2632
"timing_ms": {
27-
"sync": 23992,
28-
"command": 40345,
29-
"container_phase": 28825,
30-
"total": 65525
33+
"sync": 12395,
34+
"command": 18323,
35+
"total": 30800,
36+
"phases": {
37+
"install": 3571,
38+
"focused_tests": 10656,
39+
"loopback_proof": 251,
40+
"static_build_lint_gates": 3634
41+
}
3142
},
3243
"lease_stopped": true,
3344
"limits": [
34-
"Crabbox raw-workspace sync intentionally does not copy .git; the receipt binds the synced content to the clean local tested_commit.",
35-
"The full pnpm run check gate was run in the real Git checkout, where all 3343 tests completed with 3334 passes, 9 platform skips, and 0 failures. A diagnostic full-suite attempt inside the raw Docker workspace was not accepted as proof because 37 unrelated sweep-workflow tests require Git metadata."
45+
"The GitHub API was a loopback fixture; no production run was cancelled.",
46+
"The full pnpm run check gate ran in the clean host checkout: 3345 tests, 3336 passes, 9 platform skips, 0 failures."
3647
]
3748
}
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
{
2+
"schema_version": 1,
3+
"generated_at": "2026-08-12T04:33:21.696Z",
4+
"production_script": "scripts/stuck-queued-run-remediation.mjs",
5+
"transport": "loopback HTTP listener via GITHUB_API_URL",
6+
"assertions": {
7+
"stranded_cancelled_exactly_once": true,
8+
"young_run_untouched": true,
9+
"zombie_500_500_persisted": true
10+
},
11+
"scenarios": {
12+
"cancel": {
13+
"stranded_run_id": "910001",
14+
"young_run_id": "910002",
15+
"selected_run_ids": [
16+
"910001"
17+
],
18+
"actions": [
19+
{
20+
"run_id": "910001",
21+
"outcome": "cancel_requested",
22+
"cancel_status": 202,
23+
"force_cancel_status": null
24+
}
25+
],
26+
"deadline_reached": false,
27+
"request_trace": [
28+
{
29+
"method": "GET",
30+
"path": "/repos/openclaw/clawsweeper/actions/runs"
31+
},
32+
{
33+
"method": "GET",
34+
"path": "/repos/openclaw/clawsweeper/actions/workflows/7001/runs"
35+
},
36+
{
37+
"method": "GET",
38+
"path": "/repos/openclaw/clawsweeper/actions/runs/910001"
39+
},
40+
{
41+
"method": "POST",
42+
"path": "/repos/openclaw/clawsweeper/actions/runs/910001/cancel"
43+
}
44+
],
45+
"persisted_zombie_run_ids": []
46+
},
47+
"zombie_500_500": {
48+
"stranded_run_id": "920001",
49+
"young_run_id": "920002",
50+
"selected_run_ids": [
51+
"920001"
52+
],
53+
"actions": [
54+
{
55+
"run_id": "920001",
56+
"outcome": "permanent_zombie_recorded",
57+
"cancel_status": 500,
58+
"force_cancel_status": 500
59+
}
60+
],
61+
"deadline_reached": false,
62+
"request_trace": [
63+
{
64+
"method": "GET",
65+
"path": "/repos/openclaw/clawsweeper/actions/runs"
66+
},
67+
{
68+
"method": "GET",
69+
"path": "/repos/openclaw/clawsweeper/actions/workflows/7002/runs"
70+
},
71+
{
72+
"method": "GET",
73+
"path": "/repos/openclaw/clawsweeper/actions/runs/920001"
74+
},
75+
{
76+
"method": "POST",
77+
"path": "/repos/openclaw/clawsweeper/actions/runs/920001/cancel"
78+
},
79+
{
80+
"method": "POST",
81+
"path": "/repos/openclaw/clawsweeper/actions/runs/920001/force-cancel"
82+
}
83+
],
84+
"persisted_zombie_run_ids": [
85+
"920001"
86+
],
87+
"persisted_state_replay": {
88+
"actions": [],
89+
"stranded_reason": "permanent_zombie",
90+
"request_trace": [
91+
{
92+
"method": "GET",
93+
"path": "/repos/openclaw/clawsweeper/actions/runs"
94+
}
95+
]
96+
}
97+
}
98+
}
99+
}

0 commit comments

Comments
 (0)