Skip to content

refactor(channels): share lazy runtime forwarding - #134945

Merged
steipete merged 2 commits into
mainfrom
codex/qa50-runtime-forwarders
Sep 1, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/qa50-runtime-forwarders

Conversation

@steipete

@steipete steipete commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

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 bcdf5a25632fb5a2d197f2019ed51602deb3852e with the exact two source/test files unchanged from published head d425b05b508b64dc3a3424edce001449027c2a4a. 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:

node scripts/run-vitest.mjs src/channels/plugins/runtime-forwarders.test.ts
node scripts/check-changed.mjs --base bcdf5a25632fb5a2d197f2019ed51602deb3852e -- src/channels/plugins/runtime-forwarders.ts src/channels/plugins/runtime-forwarders.test.ts

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 merge b88bcd69ec7de753a503293eb7b926acf236563a, combining this head with eee230d0b763d30e737aaf0c28c7277aa30adcf9. 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 213975df7583433c088dc18e755d5c870156fa9f were 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 through 19620d1877a5e6b4a0bcd371224cd981b7dc83cd. 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.

@clawsweeper

clawsweeper Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added size: M maintainer Maintainer-authored PR labels Sep 1, 2026
@steipete
steipete marked this pull request as ready for review September 1, 2026 07:09
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 1, 2026
@clawsweeper

clawsweeper Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 1, 2026, 5:43 PM ET / 21:43 UTC.

ClawSweeper review

What this changes

The 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 readiness

⚠️ Ready for maintainer review - 2 items remain

Keep 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
Reviewed head: 6a26308607a4e4ff2046b66de245a1d57e0c4498

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, well-covered refactor with no supported correctness or security finding, pending terminal exact-head CI.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored, behavior-neutral refactor is exempt from the external-contributor proof gate; the supplied focused tests cover the altered forwarding owner and its error boundary.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored, behavior-neutral refactor is exempt from the external-contributor proof gate; the supplied focused tests cover the altered forwarding owner and its error boundary.
Evidence reviewed 6 items Forwarding owner preserves the error boundary: The shared factory resolves the runtime method before invoking it; its comment and await placement keep sender execution outside the resolution catch, preserving unknown delivery outcomes.
Focused characterization coverage: Tests cover unconfigured capability shape, per-call runtime and resolver lookup, unavailable outbound classification, runtime-load failures, and both synchronous and rejected sender failures.
Callers span six channel plugins: Discord, Matrix, Slack, Microsoft Teams, Feishu, and Tlon register these adapters through the public plugin SDK seams; the PR changes the shared implementation rather than plugin registration contracts.
Findings None None.
Security None None.

How this fits together

Channel 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]
Loading

Before merge

  • Resolve merge risk (P1) - The exact-head hosted channel validation is still in progress; merge should wait for its terminal result because the earlier focused validation was against the PR base.
  • Complete next step (P2) - No mechanical repair is indicated; retain this protected maintainer PR for normal exact-head validation and maintainer merge handling.
Agent review details

Security

None.

PR surface

Source -52, Tests +83. Total +31 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 74 126 -52
Tests 1 83 0 +83
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 157 126 +31

Review metrics

Metric Value Why it matters
Production versus test delta production −52 lines; tests +83 lines The refactor removes repeated production forwarding bodies while adding focused behavior characterization.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Retain the shared factory and merge after the exact-head focused channel checks complete successfully.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best 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.

Labels

Label justifications:

  • P3: This is a behavior-preserving internal channel refactor with no new user-facing capability.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored, behavior-neutral refactor is exempt from the external-contributor proof gate; the supplied focused tests cover the altered forwarding owner and its error boundary.

Evidence

What I checked:

Likely related people:

  • Jason (Json): Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Confirm the in-progress exact-head focused channel validation before merge.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-01T07:31:25.580Z sha f0ce18d :: needs maintainer review before merge. :: none
  • reviewed 2026-09-01T14:46:05.813Z sha d425b05 :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the codex/qa50-runtime-forwarders branch from f0ce18d to d425b05 Compare September 1, 2026 14:33
@steipete
steipete merged commit abf21a6 into main Sep 1, 2026
279 of 282 checks passed
@steipete
steipete deleted the codex/qa50-runtime-forwarders branch September 1, 2026 22:41
@steipete

steipete commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant