Repository navigation
fix(plugins): resolve embedded auth and require restart for bundled code changes - #182403
Conversation
Resolve authentication runtime helpers through literal lazy imports so embedded code does not require physical JavaScript discovery. Refresh bundled registrations without recapturing code and report the existing Gateway restart requirement. Preserve external plugin source reload and recovery.
|
🦞👀 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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs maintainer review before merge. What this changesThis PR replaces filesystem-based authentication module discovery with lazy imports and makes bundled-plugin reload retain host code while reporting a required restart. Example: Change bundled-probe's helper.cjs from A to B and explicitly reload the plugin.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR provides a useful repair, resolves all four previous findings, and introduces no newly identified actionable defect. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe SDK authentication facade delegates credential lookup to the host runtime, while plugin loaders turn selected modules into instance-owned registrations and lifecycle receipts. flowchart TD
A[SDK authentication caller] --> B[Lazy host runtime import]
B --> C[Existing credential owners]
D[Plugin reload request] --> E[Plugin instance loader]
E --> F[Shared bundled code]
E --> G[Captured external code]
F --> H[Registrations and restart receipt]
G --> H
Technical reviewBest possible solution: Keep authentication imports host-selected and bundled code stable until restart while preserving external-plugin capture and recovery. Do we have a high-confidence way to reproduce the issue? The original authentication resolver necessarily throws when embedded runtime code has no physical candidate; the PR records failing original-owner controls, but this review executed no target code. Is this the best way to solve the issue? The change uses existing authentication and plugin-instance owners, removes the replaced bundled recapture machinery, and preserves the distinct external-plugin path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against dfdb2c4bcbaf. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource -258, Tests -348, Docs +2, Other -2. Total -606 across 30 files. Added test files: 1. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed October 24, 2026, 5:35 AM ET / 09:35 UTC (Revision 2). |
|
The four reported cutover findings are addressed in d439169: the deleted wrapper inventory entry and unused assertion allowance are removed, bundled probes receive their retained service counters, and the bundled public-surface expectation retains original code. The setup lifecycle expectations and conflicting reload docs are aligned as well. Codex review of the repair batch is clean through P2; targeted lint and format pass. The PR body distinguishes completed proof from the incomplete local lifecycle attempt, and fresh exact-head CI is running. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
* test(gateway): expect restart for bundled reload after cleanup Align the timeout-recovery retry with the explicit bundled reload contract introduced by ae81c07 (#182403). Keep all cleanup, availability, replacement and service-count assertions. * test(gateway): explain bundled reload restart receipt Match the independently prepared lifecycle correction in #182958 so this red-main repair adds no merge conflict.
…ode changes (openclaw#182403) * fix(plugins): keep bundled code host-owned during reload Resolve authentication runtime helpers through literal lazy imports so embedded code does not require physical JavaScript discovery. Refresh bundled registrations without recapturing code and report the existing Gateway restart requirement. Preserve external plugin source reload and recovery. * fix(plugins): complete immutable bundled reload cutover
…law#183066) * test(gateway): expect restart for bundled reload after cleanup Align the timeout-recovery retry with the explicit bundled reload contract introduced by 4cc49e8 (openclaw#182403). Keep all cleanup, availability, replacement and service-count assertions. * test(gateway): explain bundled reload restart receipt Match the independently prepared lifecycle correction in openclaw#182958 so this red-main repair adds no merge conflict.
…#184851) * test(plugins): cover unused URL expressions in source references Restore regression coverage for #182194: a discarded new URL(...) or its discarded .href is not a plugin source asset, while the URL's arguments are still traced. The original regression was deleted with the bundled reload module in #182403, and #184340 removed this suite's visitor assertion. Before #182194, this pattern in a generated codec made the OpenAI plugin reload capture the host build, which hung Linux Bun teardown of server.config-patch.test.ts in restart.close.config-reloader. * test(plugins): pass a lazy resolver to the source reference visitor #188890 changed visitPluginSourceReferences to take getResolver. The old call throws a TypeError on current main, and stale PR CI could not see it.
…openclaw#184851) * test(plugins): cover unused URL expressions in source references Restore regression coverage for openclaw#182194: a discarded new URL(...) or its discarded .href is not a plugin source asset, while the URL's arguments are still traced. The original regression was deleted with the bundled reload module in openclaw#182403, and openclaw#184340 removed this suite's visitor assertion. Before openclaw#182194, this pattern in a generated codec made the OpenAI plugin reload capture the host build, which hung Linux Bun teardown of server.config-patch.test.ts in restart.close.config-reloader. * test(plugins): pass a lazy resolver to the source reference visitor openclaw#188890 changed visitPluginSourceReferences to take getResolver. The old call throws a TypeError on current main, and stale PR CI could not see it.
…openclaw#184851) * test(plugins): cover unused URL expressions in source references Restore regression coverage for openclaw#182194: a discarded new URL(...) or its discarded .href is not a plugin source asset, while the URL's arguments are still traced. The original regression was deleted with the bundled reload module in openclaw#182403, and openclaw#184340 removed this suite's visitor assertion. Before openclaw#182194, this pattern in a generated codec made the OpenAI plugin reload capture the host build, which hung Linux Bun teardown of server.config-patch.test.ts in restart.close.config-reloader. * test(plugins): pass a lazy resolver to the source reference visitor openclaw#188890 changed visitPluginSourceReferences to take getResolver. The old call throws a TypeError on current main, and stale PR CI could not see it.
What Problem This Solves
Provider authentication can fail when its runtime module is embedded without a physical JavaScript file. Explicit bundled-plugin reload also tries to recapture disk code even though the running host owns that code.
User Impact
Authentication resolves through the host-selected runtime module in ordinary Node/Bun and standalone builds. Bundled plugin reload refreshes registrations and reports
restartRequired: true, including when files are unchanged. Restart the Gateway to load updated bundled code; rebuild first for compiled installations, and install a new executable when replacing embedded code. External on-disk plugins retain source reload and recovery in Node/Bun and dynamic standalone hosts. AOT hosts continue to admit embedded modules only, as defined by the runtime execution profiles.Why This Change Was Made
Literal lazy imports replace the repeated filesystem search. Bundled runtime, setup, and public modules keep the host's code identity. Removing bundled-only recapture, cache eviction, and shared-module links avoids creating a second code identity; external captures and state-operation custody remain with their existing owners. Main's runtime-profile admission check remains at the loader boundary. No new configuration or dependency is introduced.
Evidence
bun compileon the experimental AOT compiler (5d8fe974f) run with their fixture sources hidden: the original physical auth gate fails, the literal import resolves, and deleting a compiled module's require-cache entry retains its original exports. A new worker initializes fresh module state. External disk reload observes1 → 2under Node, Bun, and AOT. These are reduced engine-behavior probes; OpenClaw's AOT profile separately restricts plugin admission to embedded modules. No whole-application AOT compilation or interpreter-tripwire claim.Focused test commands and wall times
All Vitest commands use
--maxWorkers=1and the supported Node runner. Cold worker-artifact preparation dominates these wall times; they are not test-body or startup benchmarks.pnpm test src/plugin-sdk/provider-auth-runtime-resolution.test.ts --maxWorkers=1against original ownerfacade-loader.test.tsagainst original ownerpnpm test src/plugin-sdk/provider-auth-runtime-resolution.test.ts --maxWorkers=1pnpm test src/plugin-sdk/facade-loader.test.ts --maxWorkers=1pnpm test src/plugin-sdk/provider-auth-runtime.test.ts --maxWorkers=1pnpm check:test-mock-exports --base ae2a9dd8ec7445803a336a2eb83b3fa54000df6dThe merged candidate passed targeted lint (124.563 s), core types (12.610 s), affected test-type graphs (154.379 s), formatting (0.712 s), and the existing runtime-profile/plugin-admission suites under Bun (8 tests, 71.858 s combined wall,
--maxWorkers=1). Independent Codex review is clean through P2; ClawSweeper reports no remaining actionable finding.The normal
pnpm buildat the prior headd43916948280passed (2288.415 s), including runtime, 99 external plugin packages, declarations, and the Control UI. This head integrates main while preserving its runtime-profile admission check. The only conflict was the loader parameter rename.Local proof gaps remain explicit: the Node Gateway integration attempt and Bun setup lifecycle attempt were interrupted before an assertion result (861.667 s and 1122.248 s including preparation/cleanup). The prior-head CI completed these consumer suites successfully. OpenAI entrypoint imports and cleanup passed, but the fixed-budget Git cleanliness probe timed out; memory values are unqualified and are not benchmark evidence. Full standalone-image qualification belongs to the standalone build lane.
Current-head CI run 40087299988 has the inherited
session-catalog.test.tscasekeeps a delayed source off the catalog RPC path: expectedCATALOG_LOADING, actualpending: true. The same failure appears in scheduled main run 40074498223. All six relevant source/test blobs are identical across that main baseline, this PR head, and the actual CI merge066a2aeb3ca549a0925d3ed55c797ce500414a4eand its main parent. The CI merge has the expected ordered parents and matches the reconstructed merge tree. The completed run has 56 successful jobs and 26 legitimate skips; the catalog job and its aggregate CI gate are the only failures. Security and all affected auth/reload consumer coverage passed. This is inherited-only CI evidence for the native landing exception; CI is not green, and no rerun was dispatched.