Repository navigation
refactor(infra): deslop infra fifth pass - #159759
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
|
Codex review: blocked before merge. Reviewed September 28, 2026, 5:23 PM ET / 21:23 UTC (Revision 21). ClawSweeper reviewWhat this changesThe branch consolidates Gateway pairing, approvals, outbound delivery, migration, update, and diagnostic code, and fixes permission-map comparison during node pairing. Merge readiness⛔ Blocked before merge - 2 items remain The branch still has a distinct pairing fix absent from current main. The previous review’s upgrade-proof request is addressed by current-head published-updater and legacy rollback results, and this review found no supported blocking defect. Priority: P3 Review scores
Verification
How this fits togetherGateway infrastructure accepts device requests and agent output, then authorizes pairing and routes replies to channels. Its update and migration paths carry existing operator state into the next running Gateway. flowchart LR
A[Device requests] --> B[Pairing and approvals]
C[Agent replies] --> D[Outbound routing and queue]
D --> E[Channel delivery]
F[Installed updater and state] --> G[Migration and recovery]
G --> H[Running Gateway]
B --> H
Before merge
Agent review detailsSecurityNone. PR surfacePR surface statistics unavailable: the file list is incomplete. Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Retain the existing infrastructure owners and exact pairing-permission comparison, with the recorded published-driver update and rollback results available for landing review. Do we have a high-confidence way to reproduce the issue? Yes, by source inspection: current main locale-sorts distinct Unicode permission keys that can collate equally, and the branch adds the reversed-order pairing case. I did not execute that regression in this read-only review. Is this the best way to solve the issue? Yes. Exact own-key and value comparison repairs the pairing case, while the cleanup reuses existing owners without adding a competing capability. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d5b11b54afc0. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (20 earlier review cycles; latest 8 shown)
|
9d54beb to
ba1057b
Compare
6f0213c to
9ac158e
Compare
|
@clawsweeper re-review The PR body now records completed proof for the current head |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review The rollback-specific evidence requested in the last review is now complete on the same head and recorded in the PR body. The published |
|
🦞👀 Re-review progress:
|
Infra fifth-pass coverage (1/2)Complete read coverage for the infra fifth pass after integration with the fourth pass and required upstream fixes. This size-sorted log covers all 407 production files over 200 lines (406 TypeScript files and the security-policy JSON), plus two explicitly identified supplemental test-fixture/baseline files. Rows 1–199 of 409.
|
Infra fifth-pass coverage (2/2)Complete read coverage for the infra fifth pass after integration with the fourth pass and required upstream fixes. This size-sorted log covers all 407 production files over 200 lines (406 TypeScript files and the security-policy JSON), plus two explicitly identified supplemental test-fixture/baseline files. Rows 200–409 of 409.
|
9ac158e to
cccc58f
Compare
cccc58f to
2052970
Compare
16c0288 to
c9ff549
Compare
c9ff549 to
ac07216
Compare
ac07216 to
0a2f81c
Compare
Consolidate outbound, pairing, migration, lifecycle, approval, environment, and update plumbing at existing owners. Preserve storage, security, network, and update contracts. Remove 1,514 net production lines and redundant test cases. Fix unchanged Unicode permission maps replacing pending pairing requests when key insertion order changes. The pairing entrypoint regression fails before the exact-key comparison and passes afterward. Linux Testbox: full infra plus importers, import boundaries, builds, and focused regressions passed. Codex P0-P2 review is clean. Changed checks pass except an inherited gateway line cap already fixed by #159473 on main; rebase validation follows. Published upgrade hits the separately owned WhatsApp Doctor defect in #159650.
Distinguish the directive parser from the media-persistence parser, whose error contract differs, and update both internal callers. Preserve JSON parsing, migration errors, and persistent behavior. Linux Testbox: exact export-collision guard, targeted lint, core types, 45 migration/archive tests, import boundaries, and build passed. Fresh Codex P0-P2 review is clean.
0a2f81c to
c468be7
Compare
|
@clawsweeper re-review Current-head proof is complete for Blacksmith Testbox Exact-head CI passed 143 jobs with 18 skips and no failures. The unchanged refactor also retains the completed 16,614-test infra/importer proof. The PR body now records the commands, timings, inherited owner repairs, and the source-based review rejection. No schema or stored-data contract is introduced by this refactor. The complete size-sorted coverage log has 409 READ entries, covering all 407 production files over 200 lines plus two supplemental files. This remains a 900-net-production-line reduction after removing cleanup already landed by the fourth pass. This is a review-only refresh. Leave the PR unmerged and unarmed. |
|
🦞👀 Re-review progress:
|
* refactor(infra): deslop infra fifth pass Consolidate outbound, pairing, migration, lifecycle, approval, environment, and update plumbing at existing owners. Preserve storage, security, network, and update contracts. Remove 1,514 net production lines and redundant test cases. Fix unchanged Unicode permission maps replacing pending pairing requests when key insertion order changes. The pairing entrypoint regression fails before the exact-key comparison and passes afterward. Linux Testbox: full infra plus importers, import boundaries, builds, and focused regressions passed. Codex P0-P2 review is clean. Changed checks pass except an inherited gateway line cap already fixed by openclaw#159473 on main; rebase validation follows. Published upgrade hits the separately owned WhatsApp Doctor defect in openclaw#159650. * refactor(infra): name the directive migration parser explicitly Distinguish the directive parser from the media-persistence parser, whose error contract differs, and update both internal callers. Preserve JSON parsing, migration errors, and persistent behavior. Linux Testbox: exact export-collision guard, targeted lint, core types, 45 migration/archive tests, import boundaries, and build passed. Fresh Codex P0-P2 review is clean. * refactor(infra): retain canonical reader diagnostics after rebase * refactor(infra): retain explicit ClawHub guard entries
What Problem This Solves
This fifth infra pass removes repeated projections, forwarding helpers, redundant normalization, and duplicated decision plumbing. The fourth pass (#158877) landed during preparation, so the rebase keeps its canonical implementations and drops overlapping cleanup.
User Impact
This is a behavior-preserving refactor except for the pairing bug below. SQLite schemas, persistent-store semantics, filesystem/security boundaries, SSRF guards, and update/install behavior remain unchanged. No migration or operator action is required.
Why This Change Was Made
The remaining diff removes 900 net production lines (794 added, 1,694 removed) across 90 production files, plus 45 net test lines. The earlier 1,480-line count is superseded: main absorbed the duplicate work. This is a below-threshold PR with complete, size-sorted READ coverage for every current production file over 200 lines attached in coverage part 1 and part 2.
Fixes found along the way
Permission-map equality used locale-sorted keys. Distinct Unicode keys that collate equally could make an unchanged map with different insertion order replace its pending pairing request. Exact own-key/value comparison fixes that behavior. The existing
requestNodePairingmetadata-refresh test includes the Unicode case and was demonstrated failing on the original implementation and passing with the fix.Evidence
Final head:
c468be72d093f9f97d89f4a525ca8fcad76f6d38; tested source tree:0d6743a0f02c2fc302397e5ed0654f987fa506e2; base:4dafd3b56a2c0da83ea3866c669052d0ebf80d16. All four task commits are patch-identical through the final rebase. The later duplicate check against216798c496afound no absorbed cleanup or pairing fix, and the merge check is conflict-free. The PR remains unmerged and unarmed.All checks, tests, and builds ran on Blacksmith Testbox through the repository wrapper, after frozen dependency installation and exact source-tree verification.
Current-head proof used
tbx_01m3mqt4dk3gza7tpq70kkng59(run). Every phase returned exit 0:node scripts/check-changed.mjs --base 4dafd3b56a2c0da83ea3866c669052d0ebf80d16node scripts/run-vitest.mjs <15 affected upstream contract files>node scripts/run-vitest.mjs <all import-boundary tests>node --import tsx scripts/ci-run-node-test-shard.mtswith the original cap-failure plan and CI environmentnode scripts/run-vitest.mjs test/scripts/ci-node-test-plan.test.tspnpm buildsourceDeliveryTargetsMatchblank-ID/topic-suffix probescripts/package-openclaw-for-docker.mjspnpm test:docker:published-upgrade-survivor, published[email protected],base,legacy-operator-state, manual restartThe normal published-driver cell passed in 361 seconds, including standalone post-update Doctor. The legacy-state cell passed in 433 seconds, including backup rollback. The inspected rollback receipt confirms raw transcript restoration, exact schema-23 admission for both agents, and all three seeded sessions readable by the retained published runtime. Candidate state/agent schema versions are 19/23. Live provider calls were disabled; this is update, state-preservation and rollback proof.
The final lease is stopped. Complete test logs and Docker summaries were downloaded; after the recursive receipt transfer hit its five-minute limit, both cell summaries and the rollback/restore receipts were downloaded individually and inspected. Current-head CI 36472384677 passed: 143 successful jobs, 18 skipped, no failures, including
openclaw/ci-gate.Full
node scripts/run-vitest.mjs src/infra <24 importer files>passed 16,614 tests, 62 existing skips, nine routed shards in 1,598.10 seconds on preceding head0a2f81c2903e1fb0b506613bf17256128c1dc477. The task diff is unchanged on the final head; the affected upstream-contract selection above covers the rebase additions. That broad run, boundary pass and build usedtbx_01m3mkfdbttczz2jbq1vgvjqws(run); that lease is stopped.Inherited failures and owner repairs
The final rebase includes the exact missing-scheduler fixture repair
4bd105408cc, the cap-preserving hourly planner repairdf582a4010d, and the Doctor capture repair #160291 (7d8f806a69e). The original failing CI shard and complete upgrade/rollback flow now pass. No duplicate CI or product repair is included here.The earlier census timeout was fixed by #160531 (
714c2c6baa8f), landed by its existing owner. This lane additionally proved its exact head on Linux: complete ordered plan/matrix parity, three original-order shard replays, twenty consecutive whole integration-file passes, selector/planner/command suites, changed checks, boundaries, build, and independent P0–P2 review. Leasetbx_01m3mdba149d52w3072cvzydz4is stopped. The duplicate fixture PR #159845 was closed as superseded.One earlier tooling shard hung after successful assertion output at its unchanged 300-second watchdog. Its exact original ten-file/two-config plan passed on clean old base (215.75 seconds) and candidate (215.54 seconds), with original order and two workers. No assertion failure or OOM was observed; the original cache artifact was unavailable. That hang remains unreproduced and is not claimed fixed. No speculative teardown patch or timeout increase was added.
Review and test cost
Independent P0–P2 review completed with no accepted actionable finding. Its latest conditional finding claimed blank thread IDs blocked topic-suffix fallback. Complete owner source disproved that premise:
stringifyRouteThreadIddelegates tonormalizeOptionalThreadValueandnormalizeOptionalString, which trim blank strings toundefined. The current-head probe passed all 18 blank-ID combinations with matching and differing topics. Fresh ClawSweeper review also checked that helper chain and found no introduced code or security defect; its request for current-head upgrade and rollback proof is now satisfied by the receipts above. This records the rejected finding accurately, rather than calling that automated report clean.Final ClawSweeper revision 21 marks proof sufficient and reports no actionable findings or supported blocking defect. Its rendered report retains two generic config/data-model checkboxes associated with migration paths and a truncated file inventory. Compatibility is confirmed here: this PR adds no config option or default, schema, transaction, durability, retention, or recovery contract; the current-head published-driver and rollback cells above passed. The pairing equality correction is the intentional behavior fix described above. No auto-merge is armed.
device-pairing-node.test.tsheartbeat-cooldown.test.tsThe changed test bodies are unchanged through rebases. These are costs, not a performance comparison.