Repository navigation
refactor(plugins): simplify prepared-runtime composition - #140667
Conversation
Remove unused auth-sync cacheability state, single-use forwarding helpers, duplicate registry naming, and load-options envelopes. Avoid constructing a discarded lazy runtime for restricted registration and reuse the physical-client close owner. Preserve native loading, auth publication, and lifecycle behavior. Maintainer-requested cleanup following #139911. Verified 264 focused tests, six doctor contract tests, four typecheck lanes, changed guards, and a matching-source secretless container build/lint. Production net -48 lines; tests/support net -14. Independent review completed on the identical patch.
|
🦞👀 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 September 6, 2026, 10:51 PM ET / September 7, 2026, 02:51 UTC. ClawSweeper reviewWhat this changesThe PR removes redundant plugin-loading and auth-store wrappers, avoids constructing an unused runtime during restricted registration, and reuses the existing client-close operation. Merge readiness⛔ Blocked before merge - 3 items remain Keep open: this remains a useful, behavior-preserving cleanup distinct from the merged registration repair. No actionable patch defect was found; the restricted-path ownership prerequisite remains unverified. Priority: P3 Review scores
Verification
How this fits togetherThe plugin loader combines configuration, plugin metadata, and auth operations into registries used by model execution. The related client lifecycle code retires shared Codex connections after their users finish. flowchart TD
A[Configuration and plugin metadata] --> B[Native runtime composition]
C[Auth profile store] --> B
B --> D{Restricted registration?}
D -->|Yes| E[Supplied runtime]
D -->|No| F[Lazy host runtime]
E --> G[Provider registry]
F --> G
G --> H[Model execution and client lifecycle]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -49, Tests -13. Total -62 across 10 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain one internal registry resolver and direct return values while preserving auth ownership, post-commit publication, and graceful client retirement. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR proposes internal simplification, and source inspection found no introduced failure requiring reproduction. Is this the best way to solve the issue? Yes: removing unused result metadata and forwarding layers is a narrow simplification that retains the existing selection, publication, and lifecycle owners. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 3fe748574314. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Addressing the remaining pre-merge review items for head Restricted-path ownership is satisfied. This PR is authored and explicitly requested by @steipete. Live There is no persistent data-model change. The entire change to Accordingly, no new upgrade migration is required. Counting the doctor harness as test support gives production +45/-93 (net -48) and tests/support +0/-14, total -62, with no scenario deletion. The requested mitigation—one resolver and direct return values with the existing auth/publication/client-lifecycle owners—is the implementation already under review. No code changes or new review cycle are needed for these evidence clarifications. |
|
Merged via squash.
|
…0667) Remove unused auth-sync cacheability state, single-use forwarding helpers, duplicate registry naming, and load-options envelopes. Avoid constructing a discarded lazy runtime for restricted registration and reuse the physical-client close owner. Preserve native loading, auth publication, and lifecycle behavior. Maintainer-requested cleanup following openclaw#139911. Verified 264 focused tests, six doctor contract tests, four typecheck lanes, changed guards, and a matching-source secretless container build/lint. Production net -48 lines; tests/support net -14. Independent review completed on the identical patch.
Retain missing explicit model-account selections through chat and command admission, preserve durable user context on internal retries, and fail over exhausted usage windows without delaying temporary throttles. Keep retired hook listeners alive for their locator grace period and await host-owned Claude process cleanup before replacement. Preserve supplied lazy plugin runtime services and Gateway protocol aliases. Refuse unreadable shared state before Doctor update admission, migrate credentials before model-route repair, and release staged QA auth-store leases before child maintenance. Align isolated Doctor, Claws, Discord, plugin, UI permission, compaction, yield, and Windows worker-compilation fixtures with their existing contracts. Keep deadlines, explicit concurrency coverage, authority checks, and observable assertions intact. Account for the canonical injected provider resolver owner introduced by #140667 in its exact static boundary inventory. Release-note context: these repairs prevent silent account substitution, lost retry context, stale relay connections, premature CLI process reuse, and Doctor migration ordering failures. This forward-port carries the reviewed release validation repairs independently to main without changing release versions or publication state.
Retain missing explicit model-account selections through chat and command admission, preserve durable user context on internal retries, and fail over exhausted usage windows without delaying temporary throttles. Keep retired hook listeners alive for their locator grace period and await host-owned Claude process cleanup before replacement. Preserve supplied lazy plugin runtime services and Gateway protocol aliases. Refuse unreadable shared state before Doctor update admission, migrate credentials before model-route repair, and release staged QA auth-store leases before child maintenance. Align isolated Doctor, Claws, Discord, plugin, UI permission, compaction, yield, and Windows worker-compilation fixtures with their existing contracts. Keep deadlines, explicit concurrency coverage, authority checks, and observable assertions intact. Account for the canonical injected provider resolver owner introduced by #140667 in its exact static boundary inventory. Release-note context: these repairs prevent silent account substitution, lost retry context, stale relay connections, premature CLI process reuse, and Doctor migration ordering failures. This forward-port carries the reviewed release validation repairs independently to main without changing release versions or publication state.
…0973) * fix: preserve runtime ownership across auth and recovery paths Retain missing explicit model-account selections through chat and command admission, preserve durable user context on internal retries, and fail over exhausted usage windows without delaying temporary throttles. Keep retired hook listeners alive for their locator grace period and await host-owned Claude process cleanup before replacement. Preserve supplied lazy plugin runtime services and Gateway protocol aliases. Refuse unreadable shared state before Doctor update admission, migrate credentials before model-route repair, and release staged QA auth-store leases before child maintenance. Align isolated Doctor, Claws, Discord, plugin, UI permission, compaction, yield, and Windows worker-compilation fixtures with their existing contracts. Keep deadlines, explicit concurrency coverage, authority checks, and observable assertions intact. Account for the canonical injected provider resolver owner introduced by #140667 in its exact static boundary inventory. Release-note context: these repairs prevent silent account substitution, lost retry context, stale relay connections, premature CLI process reuse, and Doctor migration ordering failures. This forward-port carries the reviewed release validation repairs independently to main without changing release versions or publication state. * test(doctor): assert manual recovery for unreadable state Match the current manual recovery contract: require process-stop and verified-backup guidance, and reject a misleading repeat-Doctor loop. Preserve the database bytes, failure cause, selected path, and no-migration assertions. Both old command-copy expectations reproduced failures after the rebase; all six admission cases, scoped checks, and P2 review now pass.
…nclaw#140973) * fix: preserve runtime ownership across auth and recovery paths Retain missing explicit model-account selections through chat and command admission, preserve durable user context on internal retries, and fail over exhausted usage windows without delaying temporary throttles. Keep retired hook listeners alive for their locator grace period and await host-owned Claude process cleanup before replacement. Preserve supplied lazy plugin runtime services and Gateway protocol aliases. Refuse unreadable shared state before Doctor update admission, migrate credentials before model-route repair, and release staged QA auth-store leases before child maintenance. Align isolated Doctor, Claws, Discord, plugin, UI permission, compaction, yield, and Windows worker-compilation fixtures with their existing contracts. Keep deadlines, explicit concurrency coverage, authority checks, and observable assertions intact. Account for the canonical injected provider resolver owner introduced by openclaw#140667 in its exact static boundary inventory. Release-note context: these repairs prevent silent account substitution, lost retry context, stale relay connections, premature CLI process reuse, and Doctor migration ordering failures. This forward-port carries the reviewed release validation repairs independently to main without changing release versions or publication state. * test(doctor): assert manual recovery for unreadable state Match the current manual recovery contract: require process-stop and verified-backup guidance, and reject a misleading repeat-Doctor loop. Preserve the database bytes, failure cause, selected path, and no-migration assertions. Both old command-copy expectations reproduced failures after the rebase; all six admission cases, scoped checks, and P2 review now pass.
Related: #139911 (cold model-runtime registration repair), #139867 (original stall report).
Additional instructions
Maintainer-requested follow-up. This branch is in the upstream repository and remains editable by maintainers.
What Problem This Solves
The cold model-runtime repair retained unnecessary forwarding layers, unused auth-sync result state, and two names for the same registry operation. Restricted registration also constructed a lazy host runtime that it immediately discarded. This focused cleanup reduces that maintenance and allocation overhead without reopening the larger import-boundary refactor.
Why This Change Was Made
Return the selected auth store and provider load options directly, inline two one-use adapters, keep one registry-resolution operation, and share the existing physical-client close operation. Construct the lazy runtime only when used, while preserving the existing constructor-argument sampling point.
Native composition, synchronous hook/admission ordering, getter-only runtime facets, independent mutable method views, authored cache identity, and post-commit publication remain intact. The broader external-auth factory consolidation was intentionally excluded: it requires a separate import-boundary and fixture rewrite. This is a behavior-preserving cleanup, not a new performance architecture.
Production LOC: +45 / -93 (net -48). Tests/support: +0 / -14. Ten files; no test scenarios removed, no new configuration, SQLite/schema, dependencies, compatibility layers, timeouts, or budget changes.
User Impact
No intentional user-visible behavior change. The repaired cold-registration path stays intact; restricted registration avoids allocating an unused lazy runtime. No new operator action is required.
Evidence
1fd0b45c6e479c5c82b83405360813938d0f33ed.openclaw-secops. The doctor harness changes only a mock export; no schema, migration, stored representation, or persistence semantics change. The removed cacheability bit was private, in-memory, and unconsumed, so no upgrade migration is needed.pnpm tsgo:core,pnpm tsgo:core:test,pnpm tsgo:extensions, andpnpm tsgo:extensions:test. Core lint, dead-export scans, formatting, and the changed-gate prefix passed.pnpm install --frozen-lockfilerestored the pinned Node types; the unchanged tests then passed. No test was altered to mask it.pnpm build(6m 7.6s), and the normal targeted plugin-lint wrapper passed (263 rules, zero warnings/errors). All remaining changed-gate checks passed there: native schema consistency, database-first legacy stores, media downloads, runtime sidecars, import cycles, webhook body reads, and pairing scope guards. No guard, dependency, or environment bypass was used.INEFFECTIVE_DYNAMIC_IMPORToccurrences. All 38,841 tracked paths matched the frozen candidate before execution, after install, and after proof. The container was removed; no operator stores, credentials, Gateway, browser, or inference were used.Focused test command:
Targeted plugin lint command (normal package-boundary preparation retained):
Reviewed/tested parent:
dbac2c10809f28e9d8bedb409d8b5307e200e8ad. Frozen binary patch SHA-256:5bb32ef0939f9e59ca74260a9d1f67be5018416cfb8502e3695f52760842f6f0. Current main was checked before publication; none of the ten touched files had drifted.