Skip to content

fix(models): model browsing fails after automatic plugin activation - #130481

Merged
steipete merged 2 commits into
mainfrom
codex/fix-catalog-worker-metadata
Aug 27, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/fix-catalog-worker-metadata

Conversation

@steipete

@steipete steipete commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where users browsing models or refreshing model authentication receive prepared model catalog worker reconstructed a different runtime generation on an otherwise healthy Gateway. A fresh multi-agent Gateway with automatic provider activation reproduces this without changing any plugin files.

Why This Change Was Made

The Gateway publishes one lifecycle-owned plugin metadata snapshot, but the catalog worker discarded it and rediscovered metadata using an individual agent's workspace and runtime activation config. Those inputs need not match the source metadata's workspace or policy. Passing only the original workspace fixed four regression cases but still failed the real Gateway's activation-overlay case.

Transfer the exact metadata graph, including the paired inventory, manifests, scope, and owner maps. The plugin metadata owner restores its process-local ID normalizer and immutability; ordinary metadata loads share that finalization path. Keep the existing generation fingerprint and parent-lifetime checks. No consumer retries, new config, storage changes, or provider-specific branches.

Production LOC: +30/-5 (net +25). The growth implements the missing worker ownership handoff and restores non-cloneable behavior; copying only inventory or weakening identity checks would lose the paired metadata contract. Tests: +75/-20 (includes reindent of an existing table-driven test). Release-note context is in this body; the root changelog remains release-owned.

Provenance: likely made visible by #125596, authored and merged by @steipete on 2026-08-18 (fd216cb5509e), which made Gateway metadata explicitly shared across prepared agent owners. The worker's independent reconstruction predates that change.

Related: #126108 and #126224. The latter is assigned to @jalehman and addresses recovery after plugin changes. This fixes the initial unchanged-plugin metadata handoff, not that recovery contract; neither item is closed by this PR. Metadata identity is not executable-byte pinning: the first worker still imports the selected plugin paths, and replacing plugin code before that import is not claimed fixed here.

User Impact

Model browsing and auth refresh use the Gateway's published plugin metadata even when agents have separate workspaces or startup enables a provider in memory. Existing session/agent/global model-selection behavior remains intact.

Evidence

  • Before: a real built Gateway with temporary HOME/state, two agents, loopback-only transport, and Anthropic auto-activation returned UNAVAILABLE from models.list with view: "all".
  • Failing-first regressions: four distinct/absent metadata-workspace cases failed on original code; two source/runtime activation-policy cases also failed on the workspace-only intermediate patch. The final real-worker suite passes all 16 tests, including auth refresh, SecretRef preservation, shared discovery, and generation retirement.
  • Metadata owner suite: 25 tests pass, including structured-clone round-trip normalization and immutable owner Maps.
  • After: five fresh built Gateways completed actual model browsing and an admin sessions.patch, then verified persisted config after shutdown: session, agent, global, default-main, and default-overridden-agent scopes. No provider inference or external credentials were used; this is real Gateway/CLI/RPC and persistence proof, not authenticated provider proof.
  • Build passes. Independent Codex autoreview found no actionable findings.
  • Full local check:changed passes, including core production/test typechecks, changed-file lint, formatting, import-cycle, dead-export, plugin-boundary, and storage guards. The first remote changed-gate attempt failed during Testbox file sync and stopped its lease; it did not produce a passing check result.
  • Final-head hosted CI 33023800497, attempt 2 completed successfully at ccadcbb749b8d6045ebb2f5b22dab7dccf214496, including openclaw/ci-gate. Attempt 1 had one failure in the unrelated 50-worker retention test newly added to main by fix(workers): protect in-flight workspace manifests from concurrent retention #130449; that test is absent from this PR head. One targeted unchanged-shard rerun passed; no assertions, concurrency, or timeout were weakened. The earlier source head also passed full CI 33022280478 before the changelog-only removal.
  • CI investigation follow-up Child-process hard drain deadline silently drops buffered output under event-loop contention #130504 records independently reproduced subprocess hard-deadline output loss. Its connection to the stress test's empty-SHA failure remains unproven; this PR does not claim to fix it.
  • Named follow-up: prepared-model-runtime.plugin-context.test.ts's no-current-metadata-probe assertion fails identically on untouched main d27b0e96204a and this patch (one bundled-channel metadata lookup). The remaining nine tests in that owner group pass. A clean independently installed/built baseline reproduced the failure; the assertion was not weakened. Cold broad-suite startup also stalled on both revisions; the real-worker and metadata-owner suites above completed separately. These are not reported as green full-suite proof.

@clawsweeper

clawsweeper Bot commented Aug 26, 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 agents Agent runtime and tooling size: S maintainer Maintainer-authored PR labels Aug 26, 2026
@steipete steipete self-assigned this Aug 26, 2026
@steipete steipete closed this Aug 26, 2026
@steipete steipete reopened this Aug 26, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. 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 Aug 26, 2026
@clawsweeper

clawsweeper Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 7:40 PM ET / 23:40 UTC.

ClawSweeper review

What this changes

The PR transfers the Gateway-owned plugin-metadata snapshot into model-catalog worker threads so model browsing and authentication refresh retain the active plugin generation.

Merge readiness

✅ Ready for maintainer review

Keep open. The resolved changelog finding is no longer in the PR, and the exact worker-boundary repair is coherent; current-head CI remains the normal landing gate. Likely related people: steipete (high) and joshavant (medium).

Priority: P1
Reviewed head: ccadcbb749b8d6045ebb2f5b22dab7dccf214496

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch has focused owner-boundary coverage and a credible real-Gateway report; exact-head hosted checks are still the remaining landing gate.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: This maintainer-authored PR is exempt from the contributor proof gate; its body nevertheless records after-fix real built-Gateway model-browsing and persistence runs.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored PR is exempt from the contributor proof gate; its body nevertheless records after-fix real built-Gateway model-browsing and persistence runs.
Evidence reviewed 4 items Current-main failure path: Current main creates a worker input without the metadata snapshot, while its worker rebuilds from only the agent input and compares the resulting generation fingerprint; distinct Gateway metadata scope can therefore fail before catalog or auth work begins.
Worker handoff repair: The PR serializes the full snapshot except its process-local normalizer, restores that normalizer and immutability in the worker, then supplies the restored graph to workspace preparation before retaining the existing fingerprint check.
Boundary regressions: The integration table covers absent, differing-workspace, and activation-overlay metadata for both catalog-first and auth-refresh-first requests; the metadata-owner test also covers structured-clone restoration, normalizing IDs, and frozen owner maps.
Findings None None.
Security None None.

Live Verification

Command: pnpm openclaw --help

Result: FAIL (failed) — step 1 run pnpm openclaw --help: previous terminal command was still running after 30 seconds: "pnpm openclaw --help"

$ node scripts/run-node.mjs --help
[openclaw] Building TypeScript (dist is stale: missing_build_stamp - build stamp missing).
[openclaw] Building bundled plugin assets.
[canvas] build: node scripts/bundle-a2ui.mjs
[log] ‹DIR›/a2ui.bundle.js  chunk │ size: 399.96 kB
[log] ‹DIR›/a2ui-v0.9.bundle.js  chunk │ size: 615.66 kB
[log]
[success] rolldown v1.2.0 Finished in 101.20 ms
[diffs] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts curated
[diffs-language-pack] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts full
[discord] build: node --import tsx ../../scripts/build-discord-activity-sdk.mts
[tsdown-build] invocation 1/2 finished in 0.7s
node_modules/playwright-core/lib/coreBundle.js (65821:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65821:29 ]
       │
 65821 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/playwright-core/lib/coreBundle.js (65828:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65828:29 ]
       │
 65828 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2343:30) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2343:31 ]
      │
 2343 │           ASM_CONSTS[start] = eval(func);
      │                               ──┬─
      │                                 ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2366:32) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2366:33 ]
      │
 2366 │           moduleExports[name] = eval(func);
      │                                 ──┬─
      │                                   ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

[tsdown-build] invocation 2/2 finished in 13.9s
[plugin-control-plane-loads] verified 36 built modules with native require and checked doctor closures
runtime-postbuild: 11 phases completed in 4207ms (slowest: built plugin control-plane loads 3461ms)

OpenClaw 2026.8.1 (ccadcbb) — All your chats, one OpenClaw.

Usage: openclaw [options] [command]

Options:
  --container ‹name›   Run the CLI inside a running Podman/Docker container named ‹name› (default: env OPENCLAW_CONTAINER)
  --dev                Dev profile: isolate state under ~/.openclaw-dev, default gateway port 19001, and shift derived ports (browser/canvas)
  -h, --help           Display help for command
  --log-level ‹level›  Global log level override for file + console (silent|fatal|error|warn|info|debug|trace)
  --no-color           Disable ANSI colors
  --profile ‹name›     Use a named profile (iso
… output truncated …

Assertions:

  • FAIL expect_output: OpenClaw

How this fits together

The Gateway prepares model-catalog workers from lifecycle-owned plugin metadata. Those workers perform model and authentication discovery for model-browsing RPCs.

flowchart LR
  A[Gateway startup] --> B[Plugin metadata snapshot]
  B --> C[Prepared catalog request]
  C --> D[Worker thread]
  D --> E[Model and auth discovery]
  E --> F[Model browsing RPC]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +25, Tests +55. Total +80 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 3 30 5 +25
Tests 2 76 21 +55
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 106 26 +80

Review metrics

Metric Value Why it matters
Production versus test delta production +25 net; tests +55 net after table-test reformatting The production growth carries one immutable metadata graph across the worker boundary; the added tests cover the prior scope-reconstruction failure modes.

Stored data model

Persistent data-model change detected: unknown-data-model-change: src/plugins/plugin-metadata-snapshot.test.ts, unknown-data-model-change: src/plugins/plugin-metadata-snapshot.ts, vector/embedding metadata: src/agents/prepared-model-catalog-worker.integration.test.ts, vector/embedding metadata: src/agents/prepared-model-catalog.worker.ts, vector/embedding metadata: src/plugins/plugin-metadata-snapshot.test.ts, vector/embedding metadata: src/plugins/plugin-metadata-snapshot.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Land the snapshot handoff after the exact-head checks pass, while keeping the separate recovery behavior tracked by #126108 and #126224.

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

Yes — source inspection shows current main reconstructs worker metadata from agent inputs rather than receiving the published Gateway snapshot, and the PR adds focused scope-mismatch regressions.

Is this the best way to solve the issue?

Yes — transferring the immutable owner graph and restoring only its process-local normalizer preserves the existing generation check without adding retries, configuration, or provider-specific policy.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 02a60e0d8714.

Labels

Label justifications:

  • P1: This fixes model browsing and authentication refresh failing on otherwise healthy Gateway instances.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR is exempt from the contributor proof gate; its body nevertheless records after-fix real built-Gateway model-browsing and persistence runs.

Evidence

What I checked:

  • Current-main failure path: Current main creates a worker input without the metadata snapshot, while its worker rebuilds from only the agent input and compares the resulting generation fingerprint; distinct Gateway metadata scope can therefore fail before catalog or auth work begins. (src/agents/prepared-model-catalog.worker.ts:78, 02a60e0d8714)
  • Worker handoff repair: The PR serializes the full snapshot except its process-local normalizer, restores that normalizer and immutability in the worker, then supplies the restored graph to workspace preparation before retaining the existing fingerprint check. (src/agents/prepared-model-catalog-worker.ts:119, ccadcbb749b8)
  • Boundary regressions: The integration table covers absent, differing-workspace, and activation-overlay metadata for both catalog-first and auth-refresh-first requests; the metadata-owner test also covers structured-clone restoration, normalizing IDs, and frozen owner maps. (src/agents/prepared-model-catalog-worker.integration.test.ts:334, ccadcbb749b8)
  • Related ownership history: The preceding lifecycle-owned metadata change was merged as a shipped release-publish ancestor, supporting the same ownership boundary without making the recovery work redundant. (src/agents/prepared-model-catalog-worker.ts:96, fd216cb5509e)

Likely related people:

  • steipete: Authored merged PR 125596, which established the lifecycle-owned plugin metadata generation this patch now carries into the worker. (role: introduced the adjacent lifecycle ownership design; confidence: high; commits: fd216cb5509e; files: src/agents/prepared-model-catalog-worker.ts, src/plugins/plugin-metadata-snapshot.ts)
  • joshavant: Recent model-catalog worker history includes the worker-auth and generation-preservation refactors in this same path. (role: recent catalog-worker contributor; confidence: medium; commits: 815b26430506, 639e7718f396, 80d1478b2471; files: src/agents/prepared-model-catalog-worker.ts)

Rank-up moves

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

  • Let the hosted checks for ccadcbb complete successfully before landing.

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 (1 earlier review cycle)
  • reviewed 2026-08-26T23:16:59.891Z sha ca1e79e :: found issues before merge. :: [P3] Remove the release-owned changelog entry

@steipete

Copy link
Copy Markdown
Contributor Author

Maintainer review completed for ca1e79e.

  • Rank-up / P3 changelog request: skipped by maintainer decision. Retaining the single release-note entry for this maintainer-authored, user-facing repair as part of this landing.
  • Production growth: accepted with the concrete ownership justification already in the PR body and confirmed by review. The +25 lines carry the paired metadata graph across a real worker boundary and restore its non-cloneable normalizer; normal loading shares that finalizer. Workspace-only reconstruction demonstrably failed, and copying only the index or removing generation checks would be weaker.
  • The automated stored-data warning is not applicable: this patch changes in-memory worker transfer only. It adds no persisted state, schema, vector/embedding storage, or migration.
  • The review runner's 30-second no-output limit did not establish a failing test. The complete real-worker suite passed 16/16 in 62.71 seconds locally; metadata-owner tests passed 25/25, five isolated built Gateways passed catalog/admin-selection/post-shutdown persistence checks, and full local changed-code checks passed.

Exact-head CI is complete and successful: https://github.com/openclaw/openclaw/actions/runs/33022280478 . The previously documented baseline-only metadata-context assertion remains a named follow-up; it was not weakened. No production code changed after the reviewed and CI-verified head.

@steipete

Copy link
Copy Markdown
Contributor Author

Follow-up to the maintainer disposition above: the native landing gate enforces release-only ownership of the root changelog even for normal maintainer fix PRs. The changelog edit has therefore been removed, addressing the P3 / Rank-up request; the release-note context remains in this PR body. The prior decision to retain that entry is superseded. No bypass flag was used, and the production/test patch is unchanged.

The original source head passed full CI at https://github.com/openclaw/openclaw/actions/runs/33022280478 . The updated head will be revalidated before landing.

@steipete

Copy link
Copy Markdown
Contributor Author

Final-head CI is green: run 33023800497, attempt 2, head ccadcbb749b8d6045ebb2f5b22dab7dccf214496, including openclaw/ci-gate. This addresses the latest ClawSweeper rank-up request; its final-head review reports no actionable findings.

Attempt 1 had one unrelated failure in the 50-worker reconciliation stress test newly added to main by #130449. That file is absent from this PR head. I inspected the failure and performed one targeted unchanged-shard rerun, which passed; no assertions, concurrency, or timeout were weakened. Investigation also reproduced an independent subprocess hard-deadline output-loss bug, recorded with a runnable probe in #130504. The causal connection to the CI empty-SHA error remains unproven.

The release-owned changelog cleanup is complete. Production and tests remain byte-identical to the source head that passed the first full CI run. Real Gateway proof, owner-boundary regressions, build, local changed gates, and independent Codex autoreview are recorded in the PR body. No persisted-state/schema change is present; the automatic data-model warning is inapplicable. Separate plugin-change recovery remains open in #126108/#126224.

@steipete
steipete merged commit 3dd18cc into main Aug 27, 2026
381 of 432 checks passed
@steipete
steipete deleted the codex/fix-catalog-worker-metadata branch August 27, 2026 00:03
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

pochinkovtrofim added a commit to pochinkovtrofim/arxi-openclaw that referenced this pull request Aug 27, 2026
* fix(models): model browsing fails after automatic plugin activation (openclaw#130481)

* fix(models): preserve Gateway metadata in catalog workers

* docs: leave catalog release notes to release automation

* Gate catalog worker metadata backport

---------

Co-authored-by: Peter Steinberger <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 27, 2026
…penclaw#130481)

* fix(models): preserve Gateway metadata in catalog workers

* docs: leave catalog release notes to release automation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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