Repository navigation
refactor(infra): deslop infra - #163969
Conversation
Collapse redundant approval, command, diagnostic, HTTP, and cache layers while preserving their contracts. Forward lazy native approval finalization so channels can release completed system-agent approval bookkeeping.
|
🦞👀 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 October 3, 2026, 12:21 AM ET / 04:21 UTC (Revision 3). ClawSweeper reviewWhat this changesSimplifies shared infrastructure helpers and restores finalization callbacks through lazy channel approval adapters so completed approval bookkeeping is released. Merge readiness⛔ Blocked before merge - 1 item remains Keep open: the callback repair remains useful, and no actionable introduced defect was found. The previous generic migration-proof blocker is unsupported by the reviewed hunks. Priority: P3 Review scores
Verification
How this fits togetherShared infrastructure connects Gateway requests and channel adapters to approval lifecycles, delivery storage, command policy, and diagnostics. These helpers prepare operations and pass results to the existing transport and storage owners. flowchart TD
A[Gateway requests] --> B[Shared infrastructure]
C[Configuration and approval policy] --> B
B --> D[Approval lifecycle]
B --> E[Delivery storage worker]
D --> F[Channel adapters and cleanup]
E --> G[Persisted delivery results]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -571, Tests +3, Other 0. Total -568 across 40 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Retain the existing policy and storage owners while consolidating redundant helpers and completing lazy-adapter lifecycle cleanup. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main omits the lazy adapter's finalization observer, and the modified lifecycle test exercises the missing forwarding path. No tests were executed during this read-only review. Is this the best way to solve the issue? Yes: forwarding the existing observer and reusing canonical helpers repairs the lifecycle gap without adding a competing owner or changing stored contracts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4ec1118e7cc0. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
Remove redundant infrastructure forwarding, duplicate normalization, unused private heartbeat knobs, and repeated transaction setup while preserving public configuration, storage, approval text, and SDK contracts. Fix lazy native approval adapters dropping onFinalized so channels release completed system-agent approval bookkeeping. The regression failed on the old adapter and passed after forwarding the callback. Validation: 870 focused tests before rebase, 125 affected tests after rebase, both import-cycle checks at zero, assertion-safety ratchet passed, core typecheck and independent review passed. Full 113-file coverage log and exact-head CI evidence are in the PR.
What Problem This Solves
Infrastructure helpers repeat approval delivery, wrapper planning, serialization, and cache behavior across unnecessary forwarding layers.
User Impact
The cleanup preserves configuration, stored data, approval text, and public SDK contracts. It also fixes lazy native approval adapters dropping their finalization callback, so channels can release completed approval bookkeeping.
Why This Change Was Made
Simplifications and rationale
Fixes Found Along the Way
The lazy approval adapter forwarded delivery observers but omitted
onFinalized. Telegram uses that observer to remove terminalized system-agent approval IDs. The existing lifecycle test now exercises the lazy adapter rather than bypassing it.Evidence
Measured reduction: 571 net production lines across 37 production files; tests add three net lines. This is the final below-1,000 batch after exhausting this partition; the coverage log below records all 113 files above 200 original lines, including overlap exclusions.
23375bfaeb499a339f5bb5098c97be48ef5a33bf, 125 tests across eight affected files passed (Vitest 415.99 seconds; wrapper 439.09 seconds), including gateway ownership, install/rollback/publication, approval lifecycle, and delivery storage. Both import-cycle checks reported 0, and the full assertion-safety ratchet passed. Core production typechecking passed before rebase;git range-diffconfirms both commits retain their reviewed patches.a9dc4793ea2ecd3e7698059459f3e14a19de73b9. Formatting and diff whitespace checks passed.checks-node-changed-compact-small-10(job111120727410): Bun1.4.3-canary.1+13311cf83exited withSIGSEGV/139 before any Vitest test results. The same 24-file selection passed on a clean Linux Testbox with source-byte verification and the checksum-pinned CI Bun runtime: 363 Vitest tests across 21 files (25.56 seconds) and 17 native Bun tests across three files. The replay does not establish a runtime crash fix; one targeted hosted-job rerun completed the missing coverage. Attempt 2 passed on exact heada9dc4793ea2ecd3e7698059459f3e14a19de73b9; GitHub squash auto-merge landed341fc112e1e83ea74aa55c7c71033760bd043741. No admin exception was used. No test retry, timeout, assertion, or runtime pin changed.Remote execution and cleanup
tbx_01m3zd0t3j7p7n5w0w7pnx5mwqcbx_38ad2e9d5440tbx_01m3zpkf1tjqxkmrrwfd70c6qxtbx_01m3zydd2cvdek86bjwqccs2czscripts/ci-run-node-test-shard.mtsusing the exact failed 24-file group. Both invocations passed (380 tests total); remote payload 107.64 seconds. Lease stopped after proof. First attempt stopped before tests because an extra Git-HEAD assertion did not account for the wrapper carrier commit; corrected to source-byte verification.Final reproduction lease: Testbox run 37094779403. All proof remains bound to the verified source rather than the carrier commit.
The assertion-safety allowances shrink exactly with the removed casts: approval-handler-runtime 15 to 10, exec-approval-reply 2 to 1.
Complete production coverage, largest first
l335 infra a-m coverage
Every direct production file above 200 original lines was read. Sorted by original size; overlap exclusions were inspected without edits. Smaller direct production modules were also swept.