Skip to content

perf(agents): scope model-catalog worker plugin imports - #135486

Merged
obviyus merged 13 commits into
openclaw:mainfrom
zeroaltitude:fix/model-catalog-worker-plugin-scope
Sep 2, 2026
Merged

obviyus merged 13 commits into
openclaw:mainfrom
zeroaltitude:fix/model-catalog-worker-plugin-scope

Conversation

@zeroaltitude

@zeroaltitude zeroaltitude commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The off-main-thread prepared model-catalog worker rebuilt an unscoped plugin registry. A full catalog refresh imported unrelated plugin runtimes, paid their cold-load cost, and executed their registration code inside a disposable worker.

Why This Change Was Made

The worker now derives one fail-closed runtime scope from its prepared manifest snapshot. It uses the existing control-plane availability predicate and the existing runtime catalog-augment contract. Static manifest rows and lightweight provider discovery stay on their current paths. Selected provider, harness, memory, and runtime-augment owners still join through the existing runtime load plan.

This replaces the earlier parallel eligibility and output-coverage policy. It adds no cache, fallback, configuration, synthetic catalog row, or crash-specific handling.

User Impact

Full model-catalog refreshes keep the same provider and model inventory while loading far fewer plugin runtimes off the main thread.

Evidence

  • Redacted exact-head installed-manifest trace
  • Current main, three cold processes: 83 imports, 35 registrations, 6.56 s median worker latency, and 670 MB median worker RSS growth.
  • Exact production tree, three cold processes: 4 imports, 1 registration, 4.23 s median worker latency, and 522 MB median worker RSS growth.
  • Final exact head: 231 rows across the same 45-provider set as current main; named unrelated plugins stayed unloaded.
  • Regression: the shipped Gateway models.list route with view: "all" fails on current main because an unrelated plugin executes in its non-read-only prepared worker, then passes on this head while the catalog contributor still returns its runtime row.
  • Focused validation: 145 worker, catalog, registry, alias, credential, and provider tests passed.
  • Formatting, focused Oxlint, and all permitted changed-file guards passed. Repository policy leaves local TypeScript typecheck and build to CI on this host.

zeroaltitude and others added 2 commits August 26, 2026 22:56
…penclaw-crb2)

The prepared-model-catalog worker has no gateway request scope, so its registry
load falls through to metadataSnapshot.pluginIds — every installed plugin.
Measured on a live gateway: 156 plugins, 55 loaded, 44.6s, inside a throwaway
worker thread, with real side effects (it opened a plugin's SQLite database and
registered channel hooks). Terminating that worker mid-import is the suspected
trigger for V8 'Check failed: node->IsInUse()' in ~ModuleWrap, which aborts the
entire process rather than just the worker.

Scopes that load to model-contributing plugins, derived from manifest metadata
so no plugin is imported to compute it. Measured against the bundled manifests:
150 records -> 80 scoped, 70 excluded, all 104 expected providers retained.

Defensive by construction, because the failure being avoided is SILENT model
loss, which is worse than the crash:

- Greedy inclusion across 12 manifest signals. A false include costs
  milliseconds; a false exclude loses a model.
- Agent harnesses are kept explicitly. codex and copilot declare only
  activation.onAgentHarnesses and nothing else model-shaped; dropping them
  would delete their runtime-chooser bindings.
- assertModelCatalogCoversExpectedProviders() THROWS, naming the missing ids,
  if the catalog ever produces fewer providers than the manifests promise.
- An empty scope, or any throw while resolving it, falls back to loading
  everything. Slow and correct beats fast and empty.
- Gated on !isMainThread, so main-thread behaviour is bit-for-bit unchanged.

scripts/proof-catalog-worker-scoped-registry.ts is a real-behavior proof against
the real bundled manifests: it asserts no expected provider is lost, that the
fail-crash guard actually fires when one is removed, and that the shipped
app-server harnesses survive the narrowing.

Co-Authored-By: Claude Opus 5 <[email protected]>
@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 scripts Repository scripts agents Agent runtime and tooling size: M labels Sep 1, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 1, 2026
@clawsweeper

clawsweeper Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed September 2, 2026, 10:55 AM ET / 14:55 UTC.

ClawSweeper review

What this changes

Scopes the off-main-thread full model-catalog worker to eligible catalog, CLI, and harness plugins, with a Gateway route integration test that retains a contributor while excluding an unrelated plugin.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⛔ Blocked until real behavior proof is added - 4 items remain

Keep open: the branch cleanly scopes the full-catalog worker’s runtime registry using manifest metadata, but the captured evidence has no inspectable exact-head installed-plugin trace proving that existing catalog contributors remain complete under real configurations.

Priority: P1
Reviewed head: 64e249ae89f4165d4e3c8c861e832910b9bddaa1

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The patch has a coherent owner-boundary implementation and useful worker-route regression coverage, but lacks reviewable real after-fix behavior proof.
Proof confidence 🧂 unranked krab (1/6) Needs real behavior proof before merge: The changed production owner is the worker-side registry construction in src/agents/prepared-model-catalog.worker.ts; the new fixture reaches it through the full-catalog worker and Gateway models.list, but no inspectable exact-head installed-plugin run shows retained inventory and skipped imports. Attach redacted terminal output or runtime logs; redact private endpoints, IPs, keys, and other sensitive data. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The changed production owner is the worker-side registry construction in src/agents/prepared-model-catalog.worker.ts; the new fixture reaches it through the full-catalog worker and Gateway models.list, but no inspectable exact-head installed-plugin run shows retained inventory and skipped imports. Attach redacted terminal output or runtime logs; redact private endpoints, IPs, keys, and other sensitive data. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 6 items Introduced worker scope: The introduced worker code derives sorted eligible plugin IDs from the prepared manifest snapshot and supplies them as the runtime registry base scope, preventing the previous unscoped fallback.
Registry boundary: The prepared-runtime registry passes an explicit base scope only when no inbound or reusable registry exists; the normal runtime loader then converts that scope into its plugin load plan.
Eligibility consistency: The branch uses the same control-plane availability predicate used by manifest catalog selection, and retains runtime discovery contributors because non-bundled provider plugins satisfy the exported runtime-augment predicate.
Findings None None.
Security None None.

How this fits together

Gateway models.list can request a complete model inventory from a prepared runtime snapshot. That request starts a worker which rebuilds a plugin registry, gathers catalog rows, and returns the completed catalog to the Gateway.

flowchart LR
  A[Gateway models list request] --> B[Prepared runtime snapshot]
  B --> C[Full catalog worker]
  C --> D[Manifest eligibility and plugin scope]
  D --> E[Scoped runtime registry]
  E --> F[Catalog discovery]
  F --> G[Gateway model inventory]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The changed production owner is the worker-side registry construction in src/agents/prepared-model-catalog.worker.ts; the new fixture reaches it through the full-catalog worker and Gateway models.list, but no inspectable exact-head installed-plugin run shows retained inventory and skipped imports. Attach redacted terminal output or runtime logs; redact private endpoints, IPs, keys, and other sensitive data. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P1) - A scoped base list can omit a runtime catalog, CLI, or harness owner for an existing plugin configuration; the fixture proves one representative contributor but not the installed-plugin population.
  • Resolve merge risk (P1) - The branch adds production routing code (+30 net production lines) for a performance repair; the extra scope is justified by the worker ownership boundary, but installed-runtime proof should establish that the compatibility tradeoff is safe.
  • Complete next step (P2) - Attach redacted exact-head installed-plugin catalog-refresh proof showing retained catalog contributors and no unrelated worker import; updating the PR body should trigger review, or ask a maintainer to comment @clawsweeper re-review.
Agent review details

Security

None.

PR surface

Source +30, Tests +197. Total +227 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 4 34 4 +30
Tests 2 197 0 +197
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 231 4 +227

Review metrics

Metric Value Why it matters
Production versus test delta production +34/-4 (net +30); tests and test support +197/-0 The added production scope is concentrated in worker registry selection; the test growth provides a route-level fixture regression but does not replace installed-plugin proof.

Merge-risk options

Maintainer options:

  1. Prove installed-plugin compatibility (recommended)
    Attach a redacted exact-head runtime trace from a real installed-plugin catalog refresh that shows retained contributors and skipped unrelated imports before merging.
  2. Pause the performance change
    Keep the existing broad worker import behavior until the scoped inventory has reproducible installed-plugin compatibility evidence.

Technical review

Best possible solution:

Keep one manifest-derived worker scope, then attach a redacted exact-head installed-plugin full-catalog trace showing preserved provider inventory and excluded unrelated runtime imports.

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

No independent high-confidence reproduction was run: source establishes the worker’s prior unscoped fallback, but the supplied benchmark claims have no inspectable runtime trace.

Is this the best way to solve the issue?

Unclear: the manifest-derived scope follows the existing runtime load-plan boundary and the route-level regression is meaningful, but installed-plugin evidence is still needed to show it is the safest complete scope.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 4adab7342dd8.

Labels

Label justifications:

  • P1: This changes the complete model-inventory path and aims to remove substantial worker-thread loading cost and plugin execution.
  • merge-risk: 🚨 compatibility: Replacing an unscoped plugin registry with a manifest-derived allowlist can change which installed provider and harness runtimes participate in an existing full-catalog refresh.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The changed production owner is the worker-side registry construction in src/agents/prepared-model-catalog.worker.ts; the new fixture reaches it through the full-catalog worker and Gateway models.list, but no inspectable exact-head installed-plugin run shows retained inventory and skipped imports. Attach redacted terminal output or runtime logs; redact private endpoints, IPs, keys, and other sensitive data. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • Introduced worker scope: The introduced worker code derives sorted eligible plugin IDs from the prepared manifest snapshot and supplies them as the runtime registry base scope, preventing the previous unscoped fallback. (src/agents/prepared-model-catalog.worker.ts:105, 64e249ae89f4)
  • Registry boundary: The prepared-runtime registry passes an explicit base scope only when no inbound or reusable registry exists; the normal runtime loader then converts that scope into its plugin load plan. (src/agents/prepared-model-runtime.inbound-registry.ts:147, 64e249ae89f4)
  • Eligibility consistency: The branch uses the same control-plane availability predicate used by manifest catalog selection, and retains runtime discovery contributors because non-bundled provider plugins satisfy the exported runtime-augment predicate. (src/plugins/manifest-contract-eligibility.ts:68, 64e249ae89f4)
  • Boundary regression coverage: The added test reaches models.list, invokes the snapshot’s full-catalog worker path, asserts a catalog contributor is returned, and checks that the unrelated worker-only import marker was not written. (src/agents/prepared-model-catalog-worker.scope.integration.test.ts:86, 64e249ae89f4)
  • Real-behavior proof gap: The captured PR body reports benchmark and catalog counts but contains no attached or linked exact-head terminal trace, runtime log, or artifact that can be inspected as after-fix installed-plugin proof.
  • Current-main inspection limitation: The checkout’s promisor remote could not resolve github.com while fetching required current-main blobs. The available comparison showed the worker-scope patch absent from fetched main, but a complete current-main source pass was not possible locally.

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Erick Kinnee: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • 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.

  • Attach a redacted exact-head terminal trace or runtime log from an installed-plugin full-catalog refresh showing retained catalog output and skipped unrelated plugin loading.

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 (8 earlier review cycles)
  • reviewed 2026-09-01T19:31:47.568Z sha 099089a :: needs real behavior proof before merge. :: [P1] Invoke the coverage guard on the worker's actual catalog
  • reviewed 2026-09-01T21:10:14.926Z sha 0ac2310 :: needs real behavior proof before merge. :: [P1] Compare catalog coverage against canonical model providers
  • reviewed 2026-09-01T21:18:04.177Z sha 0ac2310 :: needs real behavior proof before merge. :: [P1] Canonicalize provider aliases before enforcing coverage
  • reviewed 2026-09-01T21:31:36.007Z sha 47249da :: needs real behavior proof before merge. :: [P1] Exclude non-model providers from required catalog coverage | [P1] Preserve the catalog’s first-wins alias ownership rule
  • reviewed 2026-09-01T22:24:41.726Z sha 559aae0 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-02T05:33:28.748Z sha 559aae0 :: needs real behavior proof before merge. :: [P1] Filter coverage expectations by control-plane eligibility | [P2] Exercise scoped registry loading in the installed-worker proof
  • reviewed 2026-09-02T06:49:29.074Z sha 559aae0 :: needs real behavior proof before merge. :: [P1] Filter coverage expectations by control-plane eligibility | [P2] Exercise scoped registry loading in the installed-worker proof
  • reviewed 2026-09-02T14:30:06.729Z sha 6ad1dac :: needs real behavior proof before merge. :: none

Run the model-provider coverage guard against the catalog returned by the real worker, allowing only providers known to be inactive. Keep CLI backend ownership in scope without treating harness IDs as catalog providers.\n\nAdd an actual worker regression that loads a contributing model plugin while proving an installed unrelated plugin is not imported off-main-thread.\n\nValidation: 20/20 prepared-model-catalog worker integration tests\nValidation: pnpm tsgo:core\nValidation: pnpm check:changed (all relevant lanes pass; inherited core-test errors in a file identical to origin/main)\nValidation: pnpm tsx scripts/proof-catalog-worker-scoped-registry.ts\n\nBeads: openclaw-fzif\n\nCo-Authored-By: Claude <[email protected]>
@zeroaltitude

Copy link
Copy Markdown
Contributor Author

P1 worker-coverage finding fixed at 0ac2310a014

The coverage assertion is now invoked on the actual catalog returned by the worker, not only by the proof script. It includes catalog entries, route variants, static entries, and provider outcomes; only manifest providers known inactive in this generation are allowed to be absent.

The regression crosses the real worker boundary: a contributing fixture plugin produces the expected catalog row while a second installed, enabled, but model-unrelated plugin writes no worker-import marker. Full worker integration suite: 20/20. Installed-manifest proof: 151 manifests, 78 loaded, 73 excluded, 104/104 expected providers preserved. pnpm tsgo:core passes.

@clawsweeper re-review

Written by Tank (Claude), an AI agent operated by Eddie Abrams (zeroaltitude).

@clawsweeper

clawsweeper Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Sep 1, 2026
Keep manifest aliases in the plugin-loading scope while comparing worker output against canonical provider identities. Normalize active alias policies before deciding whether an expected canonical provider may be absent, and cover the alias-to-canonical path through the real worker.

Validation: 44 focused worker/catalog tests; pnpm tsgo:core; pnpm check:changed (all branch-owned lanes pass; inherited core-test errors in a file identical to origin/main).

Beads: openclaw-fzif
@zeroaltitude

Copy link
Copy Markdown
Contributor Author

P1 alias-coverage finding fixed at 47249da9f75

The review was correct: manifest aliases belong to the plugin-loading identity domain, while worker catalog output uses canonical provider identities.

  • Alias-owning plugins remain in the conservative worker scope.
  • Expected and active provider IDs are now compared in the canonical catalog-output domain.
  • Setup-only and auth-alias owner-map keys no longer become false output requirements.
  • A real worker regression configures an active alias, observes the canonical catalog row, and confirms the unrelated plugin remains unloaded.

Validation: 44/44 worker and catalog assertions pass; pnpm tsgo:core passes; every branch-owned pnpm check:changed lane passes. The remaining core-test errors are inherited in a file byte-identical to origin/main.

Please re-review exact head 47249da9f75462bb9e066b9abd3f41fe514d8c94.

@clawsweeper re-review

Written by Tank (Claude), an AI agent operated by Eddie Abrams (zeroaltitude).

@clawsweeper

clawsweeper Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Require output only for declarative model-catalog providers and discovery contributors, not every active provider surface. Preserve first-wins alias canonicalization, prove both regressions through the real worker, and replace synthetic proof rows with an installed-manifest worker run.

Validation: 46 focused worker/catalog tests; pnpm tsgo:core; focused oxlint; production-boundary worker proof (151 manifests, 78 scoped plugins, 248 returned rows); pnpm check:changed (all branch-owned lanes pass; inherited core-test errors in a file identical to origin/main).

Beads: openclaw-fzif
@zeroaltitude

Copy link
Copy Markdown
Contributor Author

Both contributor-contract P1s fixed at 559aae0b6e7

The review correctly identified two distinct identity boundaries:

  • Active provider ownership is broader than model-catalog output. Coverage now requires rows only for providers declared by modelCatalog.providers or modelCatalog.discovery; a credential-active media-only provider remains loaded but is not falsely required to emit an LLM row.
  • Duplicate manifest aliases now retain the first nonempty target, exactly matching production catalog normalization instead of overwriting it with a later plugin.

Both cases are exercised through the real prepared full-catalog worker. The separate production-boundary proof now also runs that worker against the installed manifest set—no synthesized rows—and returned 248 entries across 45 providers after scoping 151 manifests to 78 plugins.

Validation: 46/46 focused worker/catalog assertions; pnpm tsgo:core; focused Oxlint; installed-worker proof pass. Every branch-owned pnpm check:changed lane passes; the remaining core-test errors are inherited in a file byte-identical to origin/main.

Please re-review exact head 559aae0b6e789c690375069a1595483a314fb2e3.

@clawsweeper re-review

Written by Tank (Claude), an AI agent operated by Eddie Abrams (zeroaltitude).

@clawsweeper

clawsweeper Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 1, 2026
@zeroaltitude
zeroaltitude marked this pull request as ready for review September 2, 2026 04:59
@clawsweeper clawsweeper Bot added merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Sep 2, 2026
@openclaw-barnacle openclaw-barnacle Bot closed this Sep 2, 2026
@openclaw-barnacle openclaw-barnacle Bot reopened this Sep 2, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Sep 2, 2026
@openclaw-barnacle openclaw-barnacle Bot added size: S and removed scripts Repository scripts size: L labels Sep 2, 2026
@obviyus obviyus changed the title fix(agents): scope model-catalog workers to model-contributing plugins perf(agents): scope model-catalog worker plugin imports Sep 2, 2026
@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. label Sep 2, 2026
@obviyus

obviyus commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Exact-head installed-plugin proof: 64e249ae89f4165d4e3c8c861e832910b9bddaa1

I ran the real non-read-only prepared runtime and full-catalog worker against the 151 installed bundled manifests. The harness enabled the existing plugin.load-profile diagnostic. It did not synthesize catalog rows.

Metric Current main b057266d78d0 Exact head 64e249ae89f4
Worker imports 83 4
Worker registrations 35 1
Worker catalog time 6.54–6.63 s 3.94 s
Worker RSS growth 664–767 MB 532 MB
Catalog rows 231 231
Catalog providers 45 45

The sorted provider list is byte-identical before and after (sha256:7250717ad2ca3bbb6c0ee72abf9e394c0fe417c83e8c766a70e8019512a39851).

Redacted exact-head import trace:

PREPARED_WORKER_PROOF_START
[plugin-load-profile] phase=discovery plugin=anthropic source=extensions/anthropic/index.ts
[plugin-load-profile] phase=discovery:register plugin=anthropic source=extensions/anthropic/index.ts
[plugin-load-profile] phase=discovery plugin=google source=extensions/google/index.ts
[plugin-load-profile] phase=discovery plugin=memory-core source=extensions/memory-core/index.ts
[plugin-load-profile] phase=discovery plugin=ollama source=extensions/ollama/index.ts
PREPARED_WORKER_PROOF_END

The baseline trace imported unrelated browser, device-pair, file-transfer, geolocation, and web-readability plugins. None appear in the exact-head trace.

The shipped Gateway models.list route with view: "all" is the regression boundary. The test fails on current main because the unrelated worker marker exists, then passes on this head while the real catalog contributor still returns plugin-generation-v1.

@obviyus
obviyus merged commit cf59ce4 into openclaw:main Sep 2, 2026
491 of 531 checks passed
@obviyus

obviyus commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Thanks @zeroaltitude!

Proof: The shipped Gateway models.list route with view: "all" now returns the same 231 rows across the same 45 providers while the worker imports 4 plugins instead of 83.

  • Bug: Full catalog refresh rebuilt an unscoped worker registry and executed unrelated plugin imports and registrations.
  • Fix: The worker now scopes runtime loading from prepared manifest ownership and the canonical control-plane eligibility policy.
Before After
83 imports, 35 registrations, 6.56 s median worker time 4 imports, 1 registration, 4.23 s median worker time

@zeroaltitude
zeroaltitude deleted the fix/model-catalog-worker-plugin-scope branch September 2, 2026 19:38
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 3, 2026
)

## What Problem This Solves

The off-main-thread prepared model-catalog worker rebuilt an unscoped plugin registry. A full catalog refresh imported unrelated plugin runtimes, paid their cold-load cost, and executed their registration code inside a disposable worker.

## Why This Change Was Made

The worker now derives one fail-closed runtime scope from its prepared manifest snapshot. It uses the existing control-plane availability predicate and the existing runtime catalog-augment contract. Static manifest rows and lightweight provider discovery stay on their current paths. Selected provider, harness, memory, and runtime-augment owners still join through the existing runtime load plan.

This replaces the earlier parallel eligibility and output-coverage policy. It adds no cache, fallback, configuration, synthetic catalog row, or crash-specific handling.

## User Impact

Full model-catalog refreshes keep the same provider and model inventory while loading far fewer plugin runtimes off the main thread.

## Evidence

- [Redacted exact-head installed-manifest trace](openclaw#135486 (comment))
- Current main, three cold processes: 83 imports, 35 registrations, 6.56 s median worker latency, and 670 MB median worker RSS growth.
- Exact production tree, three cold processes: 4 imports, 1 registration, 4.23 s median worker latency, and 522 MB median worker RSS growth.
- Final exact head: 231 rows across the same 45-provider set as current main; named unrelated plugins stayed unloaded.
- Regression: the shipped Gateway `models.list` route with `view: "all"` fails on current main because an unrelated plugin executes in its non-read-only prepared worker, then passes on this head while the catalog contributor still returns its runtime row.
- Focused validation: 145 worker, catalog, registry, alias, credential, and provider tests passed.
- Formatting, focused Oxlint, and all permitted changed-file guards passed. Repository policy leaves local TypeScript typecheck and build to CI on this host.

Co-authored-by: Ayaan Zaidi <[email protected]>
obviyus added a commit that referenced this pull request Sep 3, 2026
Collapses the model-list cleanup (#135912) and the provider-login branch into
one change rebased onto main.

- models.list reads one closed catalog source (gateway, prepared, published);
  the CLI `models list` and chat `/models` consume the prepared catalog directly.
- Prepared model runtime: owners publish one curated build, live discovery runs
  only in the catalog worker, and secret-free provider-auth facts captured at
  build time replace native readiness reobservation and auth-mode flags.
- Provider login: one login runtime shared by the CLI, chat `/login`, Telegram,
  and the Control UI; `openclaw.setup.auth.start` owns interactive sign-in.
- First-run setup inference saves the credential, confirms the in-memory
  candidate with one tool-free turn, and commits config only on success.
- xai catalog derives from the manifest; Codex native auth probes the CLI;
  doctor repairs legacy model refs and session routes.

Integration with main: keeps the worker discovery plan (#137063), worker plugin
scoping (#135486), auth order and profile identity (#132450, #137022), the
plugin-owned Codex/Claude login readers, and the built-artifact preference for
setup revalidation (#136036). Drops main's readiness reobservation (#134524)
and stale-refresh catalog mode (#136915): the prepared build already carries
the provider-auth facts those paths re-derived.

Claude-Session: https://claude.ai/code/session_01CnvVXNnjjQGMrBLYjq29RP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: M status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants