Skip to content

Commit 1ee5843

Browse files
authored
refactor(repair): four duplication merges — hook client, gitcrawl store, fingerprints, command-ack (#1114)
Four repair-side duplication merges, each its own commit: - notify-merge adopts the shared OpenClaw hook client used by its three sibling notifiers, deleting its local config/URL/posting/timeout stack. Intentional behavior adoption: transient failures now retry with the same idempotency key instead of giving up one-shot. Proven on a real loopback socket: pre-change code makes one request against a scripted 503 and fails; this head retries the identical idempotency key and succeeds on 503-then-200. - The Gitcrawl store resolver (repo normalization, env override, portable-store priority, legacy fallback) is extracted once from both importers; the intentionally different sqliteJson buffer limits stay local. Proven against real on-disk SQLite fixtures across portable, fallback, and override modes, old and new resolving identical paths. - Both error-fingerprint helpers share one digest primitive under two pinned wire-format wrappers (bare hex and sha256:-prefixed are separate wire contracts and remain byte-identical). - Command-ack marker parsing, status scoring, ordering, and tie-breaking exist once in command-ack-convergence.ts, consumed by all three former copies. Net -130 production lines. Proof committed in docs/proof/repair-duplication-merges with Docker-backed Crabbox provenance; the container full suite reproduces only the three known blob-hydration environmental failures, identical on the merge base.
1 parent 7656448 commit 1ee5843

29 files changed

Lines changed: 1978 additions & 316 deletions
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Repair duplication merges proof
2+
3+
The four numbered directories contain the old-versus-new equivalence harnesses
4+
and JSON artifacts. Merge 1 proves the intentional one-shot-to-retry change by
5+
running the old CLI and current production notifier function over a real
6+
loopback HTTP socket with an unchanged idempotency key. Merge 2 proves resolver
7+
equivalence with real SQLite files and both production importer entry points.
8+
Merges 3–4 prove byte-identical behavior.
9+
10+
Docker proof used Crabbox 0.41.1, `provider=local-container`, lease
11+
`cbx_5b0de8cbba98` (`silver-barnacle-695f`), `node:24-bookworm`, and Docker
12+
29.4.0. A clean `--fresh-pr openclaw/clawsweeper#1114` checkout at
13+
`e94c0fbfe043545bebae5c3bf11fb961ef98a72a` built all targets, ran all four
14+
proof scripts with `PROOF_RC=0`, and passed `format:check`. The final
15+
provenance-only follow-up changes this README and its machine-readable
16+
provenance artifact, not the exercised harnesses.
17+
18+
Corepack installed pinned pnpm 11.10.0. jq 1.8.1 was installed under
19+
`$HOME/.local/bin`; its `jq-linux-arm64` SHA-256
20+
`6bc62f25981328edd3cfcfe6fe51b073f2d7e7710d7ef7fcdac28d4e384fc3d4` was
21+
verified against the release's published checksum file before execution.
22+
Fresh-PR timings were 14,128 ms sync, 9,870 ms command, and 24,023 ms total.
23+
The lease stopped automatically. The full `test:no-build` gate ran locally on
24+
Node 24.19.0: 3,307 tests, 3,298 passed, 9 skipped, and 0 failed. The container
25+
run did not repeat the full suite, so no blob-hydration baseline was needed.
26+
27+
Machine-readable provenance is in `container-provenance.json`. OpenClaw Bay is
28+
unaffected because no lifecycle, queue, telemetry, or dashboard contract
29+
changed.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"schema": "clawsweeper-real-boundary-proof-provenance/v1",
3+
"claim": "The committed repair-duplication proof harnesses pass over real loopback HTTP sockets and real SQLite files in a clean Docker-backed Crabbox checkout of PR 1114.",
4+
"reviewed_head": "e94c0fbfe043545bebae5c3bf11fb961ef98a72a",
5+
"crabbox": {
6+
"cli_version": "0.41.1",
7+
"provider": "local-container",
8+
"lease_id": "cbx_5b0de8cbba98",
9+
"slug": "silver-barnacle-695f",
10+
"run_id": "run_535154e728dc",
11+
"machine_type": "node_24-bookworm",
12+
"image": "node:24-bookworm",
13+
"container_engine": "Docker 29.4.0",
14+
"checkout": "--fresh-pr openclaw/clawsweeper#1114 --no-hydrate",
15+
"sync_ms": 14128,
16+
"command_ms": 9870,
17+
"total_ms": 24023,
18+
"exit_code": 0,
19+
"run_status": "succeeded",
20+
"lease_stopped": true
21+
},
22+
"runtime": {
23+
"node": "v24.19.0",
24+
"pnpm": "11.10.0",
25+
"jq": "jq-1.8.1",
26+
"jq_asset": "jq-linux-arm64",
27+
"jq_sha256": "6bc62f25981328edd3cfcfe6fe51b073f2d7e7710d7ef7fcdac28d4e384fc3d4",
28+
"jq_checksum_source": "https://github.com/jqlang/jq/releases/download/jq-1.8.1/sha256sum.txt",
29+
"jq_checksum_verified": true
30+
},
31+
"result": {
32+
"proof_rc": 0,
33+
"proof_scripts": 4,
34+
"build_all": "passed",
35+
"format_check": "passed"
36+
},
37+
"local_gate": {
38+
"proof_rc": 0,
39+
"test_no_build": {
40+
"tests": 3307,
41+
"passed": 3298,
42+
"skipped": 9,
43+
"failed": 0
44+
}
45+
},
46+
"discarded_attempt": {
47+
"lease_id": "cbx_862ce6fd7912",
48+
"slug": "amber-crab-c0bb",
49+
"image": "ubuntu:26.04",
50+
"exit_code": 127,
51+
"reason": "generic image had no Node/Corepack; no proof command ran",
52+
"lease_stopped": true
53+
},
54+
"limits": [
55+
"The loopback hook listener uses a disposable local token and does not contact OpenClaw or Discord.",
56+
"The SQLite fixtures and node:sqlite CLI adapter are disposable local files and do not contact Gitcrawl or production storage.",
57+
"The container run did not repeat the full test:no-build suite; that gate passed locally with zero failures."
58+
]
59+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Merge notifier hook-client proof
2+
3+
This proof builds the complete pre-change tree from `origin/main` and runs its
4+
production `dist/repair/notify-merge.js` entry point. It invokes the current
5+
built `runMergeNotifier` function with the same arguments used by that CLI's
6+
`main`. Both receive their normal hook configuration through the
7+
`CLAWSWEEPER_OPENCLAW_*` environment variables and post through Node's real
8+
`fetch` implementation to one HTTP server bound to an ephemeral
9+
`127.0.0.1:<port>` socket.
10+
11+
The listener returns `503` to the first request for each path and `200` to a
12+
second request. The old process makes one request, records a failed delivery,
13+
and exits 1 under `--strict`. The current process retries over the socket,
14+
receives `200`, records a sent delivery, and exits 0. The transport trace
15+
captures a timestamp, socket addresses, response status, and the identical
16+
idempotency-key header and JSON field for every request. The proof also verifies
17+
the three existing sibling notifiers that already use the shared client: `notify-events.ts`,
18+
`notify-github-activity.ts`, and `notify-maintainer-report.ts`.
19+
20+
Run after `pnpm run build:repair`:
21+
22+
```sh
23+
node docs/proof/repair-duplication-merges/merge-1/run-proof.mjs
24+
```
25+
26+
The checked-in result is in `artifacts/retry-adoption.json`. This is a local,
27+
credential-free real-transport proof. It uses a disposable token and a
28+
loopback-only listener; it does not contact OpenClaw, Discord, GitHub, or any
29+
production service.
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
{
2+
"base_ref": "origin/main",
3+
"base_sha": "765644804756d5f6b1dc1e940d62c50711e398d8",
4+
"source": {
5+
"baseline": {
6+
"path": "src/repair/notify-merge.ts",
7+
"sha256": "d9869572aca5538f5814412b95756087f768aaa3682080deb54956ec518d8574",
8+
"cli_sha256": "9ab0c94991e801c5a6f3d2ef95d8bfa2d457ac41969459fc17168f281ca4d4ec"
9+
},
10+
"current": {
11+
"path": "src/repair/notify-merge.ts",
12+
"sha256": "90ab3b4a0e9df39551d6ea7f3fd49a2e2a2146954dd310d573024f28d7129065",
13+
"cli_sha256": "c3471fff7ac23c60f8d6246a4cb6c4ec1f91a4167c0922cc8094246b038861b1"
14+
}
15+
},
16+
"transport": {
17+
"kind": "real loopback HTTP socket",
18+
"bound_address": "127.0.0.1:50840",
19+
"requests": [
20+
{
21+
"scenario": "old",
22+
"attempt": 1,
23+
"received_at": "2026-08-11T01:08:59.863Z",
24+
"method": "POST",
25+
"pathname": "/old/agent",
26+
"idempotency_key": "merge:openclaw/openclaw#123:merge_canonical:abc123",
27+
"body_idempotency_key": "merge:openclaw/openclaw#123:merge_canonical:abc123",
28+
"local_address": "127.0.0.1",
29+
"remote_address": "127.0.0.1",
30+
"response_status": 503
31+
},
32+
{
33+
"scenario": "new",
34+
"attempt": 1,
35+
"received_at": "2026-08-11T01:08:59.881Z",
36+
"method": "POST",
37+
"pathname": "/new/agent",
38+
"idempotency_key": "merge:openclaw/openclaw#123:merge_canonical:abc123",
39+
"body_idempotency_key": "merge:openclaw/openclaw#123:merge_canonical:abc123",
40+
"local_address": "127.0.0.1",
41+
"remote_address": "127.0.0.1",
42+
"response_status": 503
43+
},
44+
{
45+
"scenario": "new",
46+
"attempt": 2,
47+
"received_at": "2026-08-11T01:09:00.887Z",
48+
"method": "POST",
49+
"pathname": "/new/agent",
50+
"idempotency_key": "merge:openclaw/openclaw#123:merge_canonical:abc123",
51+
"body_idempotency_key": "merge:openclaw/openclaw#123:merge_canonical:abc123",
52+
"local_address": "127.0.0.1",
53+
"remote_address": "127.0.0.1",
54+
"response_status": 200
55+
}
56+
]
57+
},
58+
"old": {
59+
"entrypoint": "baseline dist/repair/notify-merge.js",
60+
"exit_code": 1,
61+
"outcome": "failed after one HTTP 503",
62+
"requests": 1,
63+
"stdout": "{\n \"status\": \"ok\",\n \"considered\": 1,\n \"pending\": 1,\n \"sent\": 0,\n \"failed\": 1,\n \"skipped\": 0,\n \"exitCode\": 1,\n \"reason\": null\n}",
64+
"stderr": ""
65+
},
66+
"new": {
67+
"entrypoint": "runMergeNotifier (the function invoked by dist/repair/notify-merge.js main)",
68+
"exit_code": 0,
69+
"outcome": "succeeded after HTTP 503 then HTTP 200",
70+
"requests": 2,
71+
"stdout": "{\n \"status\": \"ok\",\n \"considered\": 1,\n \"pending\": 1,\n \"sent\": 1,\n \"failed\": 0,\n \"skipped\": 0,\n \"exitCode\": 0,\n \"reason\": null\n}",
72+
"stderr": ""
73+
},
74+
"sibling_notifier_precedent": [
75+
"src/repair/notify-events.ts",
76+
"src/repair/notify-github-activity.ts",
77+
"src/repair/notify-maintainer-report.ts"
78+
]
79+
}

0 commit comments

Comments
 (0)