Skip to content

refactor(plugins): share lazy provider runtime forwarding - #138191

Merged
steipete merged 2 commits into
mainfrom
codex/deslop-provider-runtime
Sep 4, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/deslop-provider-runtime

Conversation

@steipete

@steipete steipete commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The provider facade repeated the same asynchronous import and forwarding logic seven times, with a separate type alias for each method.

Why This Change Was Made

Use the existing lazy runtime method binder while retaining the original import loader. The loader still shares in-flight imports and evicts rejected imports so later calls can retry. The heavy provider runtime remains behind a real asynchronous import boundary, and provider-specific behavior stays with its current owner.

Teach the export-collision checker to recognize only the imported canonical binder with an exact same-name selector. Negative cases still reject changed selectors, argument transformations, extra arguments, and unrelated factories.

User Impact

No intended behavior change. The seven internal exports preserve argument/result types, error propagation, and loading behavior. Runtime code shrinks by 40 lines; validation tooling grows by 48 lines and its tests by 45 to cover the canonical binder without a file exemption.

Evidence

  • 99 tests pass across the shared lazy-loader, binder, and provider-runtime owners; 39 collision-checker tests pass.
  • Full changed checks, full build, bootstrap/native-loading guards, and independent Codex reviews pass.
  • An isolated real Gateway refreshed eight catalog models, returned the same prepared catalog, and completed a CLI agent turn through one loopback mock-provider request. V8 coverage confirmed execution of the changed built catalog wrapper. The Gateway, provider, and temporary state were cleaned up.
  • No external OAuth exchange was performed. Existing provider owner tests retain auth dispatch and status coverage.
  • The latest ClawSweeper review could not fetch current-main blobs. Maintainer verification directly read the complete facade at its referenced main commit 8ef56e2; all three affected files are unchanged from the audited base. The branch still supplies the intended consolidation. All checks on head 1fc27ea are green.

@steipete steipete self-assigned this Sep 4, 2026
@clawsweeper

clawsweeper Bot commented Sep 4, 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: S maintainer Maintainer-authored PR labels Sep 4, 2026
@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 4, 2026
@clawsweeper

clawsweeper Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 4, 2026, 8:45 AM ET / 12:45 UTC.

ClawSweeper review

What this changes

The PR replaces seven provider-runtime lazy forwarding wrappers with the shared lazy-runtime binder and updates the export-collision checker to recognize that canonical forwarding pattern.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open. This is a coherent, behavior-neutral consolidation that current main has not subsumed, and the maintainer label prevents automated cleanup closure.

Priority: P3
Reviewed head: 1fc27ea570fe59ecaa96a480058ee3f1b5fb6bc2

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused refactor with a reviewed shared-helper contract and targeted checker coverage; no actionable correctness defect was found.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored behavior-neutral refactor is exempt from the external-contributor proof gate; the supplied body also describes an isolated Gateway exercise, while source review confirms the changed facade delegates through the established lazy loader and binder.
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 body also describes an isolated Gateway exercise, while source review confirms the changed facade delegates through the established lazy loader and binder.
Evidence reviewed 6 items Shared lazy-method contract: The existing binder awaits the supplied loader, selects one method, and forwards all arguments while awaiting its result; the PR uses that unchanged helper rather than introducing another runtime path.
Facade preserves the lazy boundary: The introduced facade retains createLazyImportLoader and supplies its load method to the canonical binder for all seven exported provider operations.
Caller and owner boundary: Runtime-model authentication awaits the facade before merging provider-owned prepared credentials, so the refactor remains at the lazy facade rather than changing provider auth ownership.
Findings None None.
Security None None.

How this fits together

Model catalog and provider-auth callers enter a small provider-runtime facade, which lazily loads the heavier provider runtime before plugin-backed behavior runs. A repository script separately detects duplicate exported definitions while exempting exact forwarding-only facades.

flowchart LR
  A[Catalog and auth callers] --> B[Provider runtime facade]
  B --> C[Shared lazy import loader]
  C --> D[Provider runtime module]
  D --> E[Provider plugin hooks]
  F[Export collision checker] --> G[Forwarding pattern decision]
  G --> H[Repository validation result]
Loading

Before merge

  • Resolve merge risk (P1) - A direct textual read of current-main blobs was unavailable after promisor-remote DNS resolution failed; the verified main-to-head diff is sufficient to show the branch remains distinct, but not to claim broader main equivalence.
Agent review details

Security

None.

PR surface

Source -40, Tests +45, Other +48. Total +53 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 26 66 -40
Tests 1 46 1 +45
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 96 48 +48
Total 3 168 115 +53

Review metrics

Metric Value Why it matters
Production versus test delta production +8 (runtime −40, tooling +48); tests +45 The runtime facade becomes smaller; the net tooling growth is focused on recognizing and rejecting the canonical forwarding shape.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the single shared lazy forwarding path and land it through normal maintainer review if the exact-head checks remain green.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep the single shared lazy forwarding path and land it through normal maintainer review if the exact-head checks remain green.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this PR refactors existing forwarding behavior rather than reporting a user-facing failure; source inspection establishes the relevant equivalence path.

Is this the best way to solve the issue?

Yes. The PR reuses the existing shared lazy-method abstraction already used by sibling runtime facades, while retaining the existing lazy import loader and provider-runtime owner boundary.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 8ef56e23c9d2.

Labels

Label justifications:

  • P3: This is a narrowly scoped internal refactor with no intended user-visible behavior change.
  • 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 body also describes an isolated Gateway exercise, while source review confirms the changed facade delegates through the established lazy loader and binder.

Evidence

What I checked:

  • Shared lazy-method contract: The existing binder awaits the supplied loader, selects one method, and forwards all arguments while awaiting its result; the PR uses that unchanged helper rather than introducing another runtime path. (src/shared/lazy-runtime.ts:39, 1fc27ea570fe)
  • Facade preserves the lazy boundary: The introduced facade retains createLazyImportLoader and supplies its load method to the canonical binder for all seven exported provider operations. (src/plugins/provider-runtime.runtime.ts:5, 1fc27ea570fe)
  • Caller and owner boundary: Runtime-model authentication awaits the facade before merging provider-owned prepared credentials, so the refactor remains at the lazy facade rather than changing provider auth ownership. (src/plugins/runtime/runtime-model-auth.runtime.ts:39, 1fc27ea570fe)
  • Collision-checker coverage: The introduced tests cover canonical binder aliases and reject changed members, transformed selectors, extra arguments, and unrelated same-named factories. (test/scripts/check-export-name-collisions.test.ts:147, 1fc27ea570fe)
  • Current-main comparison: The current-main-to-head comparison still reports all three introduced paths as modified, so current main has not subsumed this refactor. Reading current-main blobs directly was unavailable because the promisor remote could not resolve; this review therefore makes no stronger current-main equivalence claim. (src/plugins/provider-runtime.runtime.ts:5, 1fc27ea570fe)
  • Feature history: Provider-runtime facade history includes prior lazy-boundary and loader consolidation work, supporting the shared-helper direction. (src/plugins/provider-runtime.runtime.ts:5, 75b65c2a352c)

Likely related people:

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

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-04T10:35:57.487Z sha c96039f :: needs maintainer review before merge. :: none
  • reviewed 2026-09-04T11:14:03.903Z sha 60ea45d80dd9e8c4a3e62b0c1e5f67cd038d5360 :: blocked before merge. :: none

@steipete

steipete commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

CI exposed a scanner gap: the export collision guard understood handwritten same-name forwarding functions but counted equivalent calls to the canonical lazy binder as duplicate definitions. Commit 60ea45d80dd teaches the shared parser to recognize the existing helper's exact member selector, including imported aliases. It still rejects changed members, calls, transformed arguments, default/rest selectors, extra arguments, and same-named factories from unrelated modules. No file exemption was added.

The baseline regression failed before the parser change. All 39 scanner and sibling-wrapper tests pass, the actual repository collision command passes, full changed-file checks pass, and independent review is clean. Production remains −40 lines; tooling is +48 after consolidating the old forwarding branches; tests are +45. The added tooling describes helper provenance and forwarding semantics, rather than duplicating runtime behavior.

The separate QA catalog failure is a stale repository docs reference after the ClawHub documentation move; that repair is being validated separately. The browser cold-start test failure is under investigation before any retry.

@sylvesterkaczmarek sylvesterkaczmarek left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed. Good consolidation: one loader, one binder, lazy boundary preserved. The collision guard is also scoped to the known lazy-runtime helpers, so it does not broadly suppress definitions.

@steipete
steipete force-pushed the codex/deslop-provider-runtime branch from 60ea45d to 1fc27ea Compare September 4, 2026 12:17
@steipete
steipete merged commit 2cb316f into main Sep 4, 2026
180 checks passed
@steipete
steipete deleted the codex/deslop-provider-runtime branch September 4, 2026 12:51
@steipete

steipete commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 5, 2026
…38191)

* refactor(plugins): share lazy provider runtime forwarding

* fix(tooling): recognize canonical lazy method forwarders
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. scripts Repository scripts 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.

2 participants