Repository navigation
refactor(channels): share lazy runtime forwarding - #134945
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed September 1, 2026, 5:43 PM ET / 21:43 UTC. ClawSweeper reviewWhat this changesThe PR replaces repeated lazy channel-runtime delegate wrappers with one shared factory and adds characterization tests for registration, live callback lookup, and error propagation. Merge readinessKeep this maintainer-owned PR open. The shared forwarder preserves the existing lazy-resolution and delivery-error boundary, with no concrete introduced defect found; the remaining gate is exact-head validation already in progress. Priority: P3 Review scores
Verification
How this fits togetherChannel plugins expose directory and outbound adapters while deferring heavy runtime loading until a live operation is called. The adapter resolves the active runtime method, then returns directory data or performs channel delivery. flowchart LR
A[Channel plugin registration] --> B[Lazy adapter]
B --> C[Runtime getter]
C --> D[Method resolver]
D --> E[Directory data]
D --> F[Outbound delivery]
F --> G[Delivery outcome]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -52, Tests +83. Total +31 across 2 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the shared factory and merge after the exact-head focused channel checks complete successfully. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR refactors an existing implementation rather than reporting a user-visible defect; focused tests characterize the preserved behavior. Is this the best way to solve the issue? Yes. One private factory removes repeated forwarding logic while retaining the existing resolution owner and the distinction between pre-dispatch and sender failures. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7a632532c35c. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
f0ce18d to
d425b05
Compare
|
Merged via squash.
|
What Problem This Solves
Channel runtime adapters repeated the same lazy invocation body across four directory methods and five outbound methods. Consolidating those copies must preserve the distinction between a runtime that could not load and a sender that may already have begun delivery.
Why This Change Was Made
One private forwarding factory reuses the existing resolution owner. The resolution catch is unchanged; sender execution stays outside it, so sender errors retain their original identity and cannot acquire a false definitely-not-dispatched marker. The factory still reads current callbacks on every call and preserves both await boundaries. Directory capabilities are omitted when unconfigured; outbound delegates retain their five existing own keys with undefined values for unavailable capabilities.
User Impact
Behavior is preserved. The public factories, six channel registrations, configuration, protocol and storage contracts are unchanged. Production TypeScript decreases by 52 physical lines (+74/-126), including the helper/type/caller cost; the nonblank delta is -53. Tests add 83 physical lines (+73 nonblank). This is a simplification, with no performance claim.
Evidence
The final candidate is based on main
bcdf5a25632fb5a2d197f2019ed51602deb3852ewith the exact two source/test files unchanged from published headd425b05b508b64dc3a3424edce001449027c2a4a. Ten maintained owner cases passed on this frozen graph. The complete normal changed-check chain passed, including core/plugin source and test type checks, selected lint and architecture guards. Fresh managed Codex P2/high review returned scoped-clean with no accepted, rejected or filtered finding. The diff-scoped deslop pass found no further change needed.The actual final commands were:
The owner characterization retained from the earlier reviewed graph records 147 differential observations and 372 assertions on each version, including all nine methods, all method-presence combinations, property ordering, in-flight resolver selection, both await boundaries and reference/error identity. Its behavioral projections match after excluding only owner-hash metadata; stack value/locations are excluded, with stack-key presence and descriptors retained. The earlier full build and built Tlon loopback remain proof of their recorded inputs, not new final-base runs.
Both maintained Tlon transport cases passed in CI 33520267346, messaging job 99897831336, attached to the earlier d425b05 head and executed at merge
a6c5739a9cad12e09f5c0043246c5ea49aafd5a7: DM/group/media-caption sanitization, 2.093s and bounded chunked HTTP pokes, 322ms. That group completed 139 files / 1,578 tests with explicit exit 0. Its overall workflow failed a separately recorded SQLite test; the final frozen main includes the subsequently landed fixture repair. No older CI result is represented as coverage of the new published head.The first final-base selected-check process was interrupted during session continuation and had no exit receipt. The next attempt correctly refused its stale build-artifact lock before core typechecking. After verifying the recorded owner/child claims, process groups, all process arguments and open-file/cwd records, the unchanged stale lock was archived intact using the documented recovery procedure. The normal full command then completed successfully. Both earlier local Tlon timeouts and the initial built-probe TS5107 failure remain recorded; no timeout or guard was relaxed.
Main later advanced to
9101e7cc9de17bb661e2eb694090cc6a07c1752a, changing fs-safe from 0.5.6 to 0.7.0. The dependency audit identifies real portable implementation changes as well as optional native packaging; native-off defaults do not make these implementations byte-equivalent. The local proof above uses the frozen base and installed 0.5.6. Normal exact-head hosted CI must still be checked against its actual tested merge and installed dependency graph, followed by current-main and latest ClawSweeper disposition before landing.Tlon proof uses actual loopback login/poke HTTP with synthetic credentials, a mocked media uploader and
skipQueue: true. It does not establish durable queue persistence, external upload, a remote Urbit service or recipient display. No new product/configuration/dependency/persistence behavior is introduced by this PR.Final validation for head
6a26308607a4e4ff2046b66de245a1d57e0c4498: normal CI passed with 203 successful jobs, 17 skipped jobs and a successful required CI gate. Actual Checkout output binds mergeb88bcd69ec7de753a503293eb7b926acf236563a, combining this head witheee230d0b763d30e737aaf0c28c7277aa30adcf9. The full integrated patch and all 127 relevant source paths match the reviewed candidate and audited dependency context.The actual Tlon messaging job passed the named sanitization and bounded chunking cases; its shard finished with 139 files and 1,578 tests passed, exit 0. These fixtures exercise real local HTTP authentication and pokes; image upload is mocked and the durable queue is bypassed. The storage job passed all 49 read-only-location and 6 busy-timeout cases, including the earlier WAL/MEMORY concurrency cases; its storage subgroup finished with 508 passed tests, 2 skipped tests and exit 0.
Normal CI does not select
src/channels/plugins/runtime-forwarders.test.ts. All ten owner cases passed separately through the canonical local wrapper on the exact CI merge, after a normal frozen install, with Node 24.19.0, pnpm 12.1.0 and directly observed fs-safe 0.7.0. Source and index guards remained unchanged. This is local proof; the named follow-up is to include these canonical channels tests in normal CI selection. Hosted fs-safe 0.7.0 is inferred from the audited merge lockfile and successful frozen installation, with no hosted package-version probe.The latest exact-head ClawSweeper review and its Rank-up request are satisfied. Subsequent main changes through
213975df7583433c088dc18e755d5c870156fa9fwere source-audited: the only relevant additional lockfile changes move UI Mermaid ownership through a workspace importer, preserving the root and Tlon dependency records. All 127 guarded source paths remain identical through19620d1877a5e6b4a0bcd371224cd981b7dc83cd. Production remains +74/-126, a net reduction of 52 lines, with 83 test lines added. The single private forwarding helper preserves lazy resolution, unbound invocation, optional method shape and sender-error identity.