Skip to content

fix: restore MCP discovery after provider normalization - #149662

Merged
vincentkoc merged 1 commit into
mainfrom
fix/mcp-tool-metadata-20260916
Sep 16, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
fix/mcp-tool-metadata-20260916

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 16, 2026 •

Copy link
Copy Markdown
Member

Post-merge proof (2026-09-16 UTC): merged as e83ea6e7f095b249ade7d0c9e87a04854e8db81d. Main CI 35055114649, attempt 1 passed on that exact commit at 04:35:32 UTC: all 76 jobs passed or were intentionally skipped, including successful build, Docker owner lanes, and the required aggregate gate.

Related: #149522

What Problem This Solves

Fixes admitted MCP tools disappearing from the Code Mode API catalog after provider normalization, causing Unknown API file: mcp/index.d.ts.

User Impact

Agents can discover and call configured MCP tools after tool assembly. No configuration change or migration is required.

Why This Change Was Made

Provider hooks return plugin-owned collection views. Mapping host tool wrappers over that collection rewraps the wrappers and loses their identity-bound MCP metadata. The normalization owner now copies the assembly array before metadata transfer while retaining fenced tool elements. The regression covers both runtime-plan and provider normalization, final catalog attribution, execution, and denial after plugin disposal.

This isolates the two runtime files from the separate CI-routing proposal. Production grows by two lines; tests grow by 71 lines. Shared plugin collection semantics and execution fences remain intact.

Evidence

  • Packaged failure reproduction at exact CI merge 187145699a1b1a419621a35d5970635b2442e9c9: all five fixture MCP tools survived materialization and policy, then lost their metadata during tool assembly and were classified as core tools.
  • Earlier repaired build, merge 55cde55c266ece3ad5e2fd6c47bf357ac62e4f8d with runtime repair e9f50210f4590c9d0affd70b3dc15a0bb7c87af2, passed the packaged MCP discovery/execution scenario in 24 seconds. This is supporting proof, not qualification of this PR head. Its fixture-only TS2352 was corrected before this extraction.
  • The two selected file blobs match the reviewed 640981025463821eb9028da0fe3355c83b2734dd repair exactly. The unfixed owner and relevant collection/wrapper/catalog dependencies remain unchanged on this PR's frozen main base 3c5854d129c4dc1d57332a7d154ce7edc36d4098.
  • Fresh independent P0-P2 review is clean. git diff --check and a read-only oxfmt 0.65 check passed; the pinned hosted formatting/type/lint gates also passed.
  • Exact-head CI passed at 036820b8ea2b7e2eca330971b073c805767d7846 (attempt 1; tested merge 7ba062221e273c41a310a155971fca9edb40d6a9). ClawSweeper review is clean for that head, with no remaining rank-up move.
  • Package Acceptance passed at the same source SHA using workflow ef93dfcbb0daf5d5bda66b79b52f635bd4abee02: package integrity, npm 12 installation, and the single mcp-code-mode-gateway scenario. The scenario passed once in 48 seconds, with no retry or timeout. It uses a deterministic mock provider and an ephemeral Gateway.
  • Package SHA-256: 61486037f29ec389634eeb8fb828c16da31be43cf08b9d68229715d9c345ac80. The artifact-only image tuple is run 35053493803 / attempt 1 / artifact 10429762702, image archive SHA-256 11b71ebfe0de05ecacfa1fe6396931e4800cc3ac45204e6b7d1f2b2a51e728c3.
  • MCP receipt artifact 10430805401 (docker-e2e-mcp-code-mode-gateway), SHA-256 4cacb69232cda00344f335da41a0f2182651927667d7968d84e275aa0d6ce2fe, records this fixture verdict (selected fields):
{"ok":true,"finalText":"MCP_CODE_MODE_FILE_OK note=fixture-note-alpha unclear=none improvement=virtual-api-files-were-clear-and-needed-one-exec","plannedTools":["exec"],"sessionLogMentions":{"apiCall":0,"apiFileList":1,"apiFileRead":2,"mcpNamespace":1,"mcpTool":1,"toolSearchPollution":0}}

No local install or local Vitest result is claimed. Remote source/package identity, normal CI, and the actual packaged MCP execution qualify this head.

  • Follow-up: the Docker seed planner does not map runtime normalization changes to the MCP lane; this PR keeps the owner repair isolated and qualifies its package through the existing exact-SHA workflow.
  • Release-note context is above; CONTRIBUTING.md reserves changelog generation for release tooling.

Own the normalized assembly array before copying tool metadata so plugin collection views cannot rewrap later host wrappers. Preserve plugin-owned element execution fences and cover both normalization routes through MCP catalog registration and disposal.
@vincentkoc vincentkoc self-assigned this Sep 16, 2026
@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@vincentkoc
vincentkoc marked this pull request as ready for review September 16, 2026 03:49
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S maintainer Maintainer-authored PR labels Sep 16, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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 16, 2026
@clawsweeper

clawsweeper Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 16, 2026, 12:01 AM ET / 04:01 UTC.

ClawSweeper review

What this changes

Copies the normalized tool array so later wrappers preserve MCP discovery metadata while retaining plugin execution guards, with regression coverage for both normalization routes.

Merge readiness

✅ Ready for maintainer review

Keep open: this is a focused, useful repair that fetched main still needs. No actionable correctness or security defect was found, and the related routing PR explicitly delegates the runtime repair here.

Priority: P2
Reviewed head: 036820b8ea2b7e2eca330971b073c805767d7846

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-boundary repair with meaningful regression coverage and no blocking finding.
Proof confidence 🌊 off-meta tidepool Not applicable: The MEMBER-authored PR is exempt from the external-contributor proof gate. Its captured evidence reports packaged MCP discovery/execution recovery on an earlier repaired build; the matching job succeeded, detailed logs were inaccessible through the review proxy, and current-head Package Acceptance remained in progress.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The MEMBER-authored PR is exempt from the external-contributor proof gate. Its captured evidence reports packaged MCP discovery/execution recovery on an earlier repaired build; the matching job succeeded, detailed logs were inaccessible through the review proxy, and current-head Package Acceptance remained in progress.
Evidence reviewed 9 items Introduced repair: The verified merge-base-to-head production diff copies the normalized collection with Array.from before transferring metadata; it retains the tool elements. git diff --check passed.
Current-main and release necessity: Fetched main still returns the provider collection directly. The same owner in v2026.9.4 also lacks the copy, so neither inspected version contains this repair; this does not establish that every release configuration reproduces the failure.
Collection identity and execution guards: The fully inspected collection-view implementation wraps collection-method results and caches views by object identity. Callable views continue to enter plugin admission; copying the array does not unwrap their execute functions or change disposal authority.
Findings None None.
Security None None.

How this fits together

Agent tool assembly combines configured tools with provider-specific schema normalization before publishing the searchable API catalog. MCP ownership metadata lets that catalog expose the correct server namespaces and dispatch calls through guarded tool objects.

flowchart LR
  A[Configured tools] --> B[Tool policy filtering]
  B --> C[Provider normalization]
  C --> D[Host-owned array]
  D --> E[Metadata-preserving wrappers]
  E --> F[MCP API catalog]
  F --> G[Guarded tool execution]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +2, Tests +71. Total +73 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 3 1 +2
Tests 1 73 2 +71
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 76 3 +73

Review metrics

None.

Root-cause cluster

Relationship: canonical
Canonical: #149662
Summary: The related branch explicitly names this PR as the isolated MCP runtime repair while retaining its separate CI-routing proposal.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Keep collection ownership in the normalization owner while preserving tool metadata and the existing plugin execution fences.

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

Yes, from source: provider collection mapping rewraps host wrappers and loses their identity-bound MCP metadata before catalog registration. The focused regression models that path; no local runtime reproduction was executed.

Is this the best way to solve the issue?

Yes. Copying the assembly array at the existing normalization boundary fixes both routes without changing shared collection semantics, plugin APIs, persisted settings, or execution admission.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 9854595b8073.

Labels

Label changes:

  • add P2: Repairs configured MCP discovery in the affected tool-assembly path without changing configuration or public protocols.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The MEMBER-authored PR is exempt from the external-contributor proof gate. Its captured evidence reports packaged MCP discovery/execution recovery on an earlier repaired build; the matching job succeeded, detailed logs were inaccessible through the review proxy, and current-head Package Acceptance remained in progress.

Label justifications:

  • P2: Repairs configured MCP discovery in the affected tool-assembly path without changing configuration or public protocols.
  • 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: The MEMBER-authored PR is exempt from the external-contributor proof gate. Its captured evidence reports packaged MCP discovery/execution recovery on an earlier repaired build; the matching job succeeded, detailed logs were inaccessible through the review proxy, and current-head Package Acceptance remained in progress.

Evidence

What I checked:

  • Introduced repair: The verified merge-base-to-head production diff copies the normalized collection with Array.from before transferring metadata; it retains the tool elements. git diff --check passed. (src/agents/runtime-plan/tools.ts:141, 036820b8ea2b)
  • Current-main and release necessity: Fetched main still returns the provider collection directly. The same owner in v2026.9.4 also lacks the copy, so neither inspected version contains this repair; this does not establish that every release configuration reproduces the failure. (src/agents/runtime-plan/tools.ts:139, 9854595b8073)
  • Collection identity and execution guards: The fully inspected collection-view implementation wraps collection-method results and caches views by object identity. Callable views continue to enter plugin admission; copying the array does not unwrap their execute functions or change disposal authority. (src/plugins/plugin-instance-value-views.ts:233, 036820b8ea2b)
  • Observable regression coverage: The added table-driven regression exercises runtime-plan and provider normalization through real collection views, hook/abort wrapping, MCP catalog attribution, successful execution, and rejection after disposal. Existing clone-metadata tests remain. Tests were inspected, not executed under this read-only review. (src/agents/runtime-plan/tools.test.ts:269, 036820b8ea2b)
  • Catalog classification: Catalog classification reads identity-bound plugin metadata and otherwise falls back to core attribution, directly explaining the reported missing MCP declarations after wrapper identity changes. (src/agents/tool-search-catalog.ts:111, 036820b8ea2b)
  • Related work and captured proof: The supplied complete bodies explicitly isolate this runtime repair from fix: unblock Blacksmith CI and restore MCP tool discovery #149522, whose CI-routing work remains on hold. The captured body reports packaged discovery/execution passing on an earlier repaired build. GitHub independently confirms its docker-seed-e2e job succeeded; detailed log retrieval was blocked by the redirected artifact host. Package Acceptance remained in progress when inspected. (55cde55c266e)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; 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.

@vincentkoc
vincentkoc merged commit e83ea6e into main Sep 16, 2026
271 of 272 checks passed
@vincentkoc
vincentkoc deleted the fix/mcp-tool-metadata-20260916 branch September 16, 2026 04:18
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

steipete added a commit that referenced this pull request Sep 16, 2026
Extend the canonical assembly-array fixture from #149662 with an admitted provider that returns cloned tools. Preserve its metadata, catalog, successful execution, abort-wrapper and post-disposal assertions. The production Array.from owner remains unchanged on main.
steipete added a commit that referenced this pull request Sep 16, 2026
Record that the earlier MCP code-mode failures came from the product
regression fixed by #149662. Keep Docker seed on the 16-class and align
runner guidance with main's build-artifacts and runtime-topology settings.
steipete added a commit that referenced this pull request Sep 16, 2026
Extend the canonical assembly-array fixture from #149662 with an admitted provider that returns cloned tools. Preserve its metadata, catalog, successful execution, abort-wrapper and post-disposal assertions. The production Array.from owner remains unchanged on main.
steipete added a commit that referenced this pull request Sep 16, 2026
* fix: preserve Windows credential reads with fs-safe 0.12.0

* test: preserve compiled fs-safe configuration checks on Windows

* test: drain workspace page routes before closing fixtures

* ci: move heavy main checks to 16-vCPU runners

* perf(cli): avoid eager protocol schemas in cron registration

* test: align prerelease workflow expectation with main CI

* test: resume pending MCP Code Mode fixture calls

* test(agents): cover cloned admitted normalizers

Extend the canonical assembly-array fixture from #149662 with an admitted provider that returns cloned tools. Preserve its metadata, catalog, successful execution, abort-wrapper and post-disposal assertions. The production Array.from owner remains unchanged on main.

* ci: spread Control UI checks across twelve shards

* docs(ci): align runner guidance with current placement

* ci: route trusted hybrid preflight to Blacksmith

* test: align hybrid preflight runner table

* ci: retain real-Gateway failure diagnostics

Keep captured browser JSON and screenshots in an attempt-specific artifact when the real-Gateway CI job fails. Reuse the ordinary Control UI upload policy with seven-day retention and ignore absent captures, while preserving test commands and sanitized proof uploads.

Extend the existing workflow guard and document that diagnostic artifacts are not sanitized public proof. The new guard fails before the fix; all 18 focused alias, workflow, and command cases pass afterward. Workflow lint, selected changed-file checks, and independent review pass.

* fix(ui): preserve agent panel intent while route data loads

A reused Agents page retained its initialized flag after its route data became pending. Roster initialization could then navigate through the default Overview panel, replacing an intended Files route. Require current route data before navigation and panel work, and clear initialization when the pending update applies.

Keep explicit Settings selection revisions authoritative when the loader completes. Four focused regression cases fail before the repair with the reproduced Overview URL; 136 adjacent cases, targeted lint, formatting and independent review pass afterward.

* ci: publish allowlisted UI failure summaries

Keep raw browser reports and screenshots out of automatic CI artifacts. Write an explicit public projection from the existing failure owner and select only its fixed filename in ordinary and real-Gateway jobs. Raw captures remain local, and fixed private filenames keep sensitive labels out of logged paths. Older frozen targets without the summary produce no matching artifact.

Preserve original failures and manual sanitized proof capture. Sensitive-sentinel regressions cover nested state, route parameters, labels, errors, models and content, including evaluation, screenshot and storage failures. All 10 helper cases, six workflow/command cases, workflow validation, plain Node import and selected changed-file checks pass; independent review found no actionable issues.

* fix: align FileTransfer with fs-safe 0.12.0

Upgrade the FileTransfer dependency introduced by #148881 to the same exact version used by core, OpenShell and 1Password. Regenerate the importer with pnpm 12.3.4 and retain all other lock entries.

Strengthen the existing orphan-WAL collision regression with equal-length, different-content bytes so recovery exercises the shared hash path and preserves the existing quarantine. Frozen installation, the 16-case sidecar suite, 18 tool-policy cases and 23 UI/diagnostic cases pass on the integrated source; independent review found no actionable issues.

* test(ui): retain safe Canvas failure diagnostics

* test(gateway): model live child execution in stop proof

* test(ui): inspect HTML sandbox after render readiness

* test(cron): cover event schedules after API state updates

* ci: count hosted rows after hybrid preflight routing
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 17, 2026
…claw#149662)

Own the normalized assembly array before copying tool metadata so plugin collection views cannot rewrap later host wrappers. Preserve plugin-owned element execution fences and cover both normalization routes through MCP catalog registration and disposal.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 17, 2026
…149124)

* fix: preserve Windows credential reads with fs-safe 0.12.0

* test: preserve compiled fs-safe configuration checks on Windows

* test: drain workspace page routes before closing fixtures

* ci: move heavy main checks to 16-vCPU runners

* perf(cli): avoid eager protocol schemas in cron registration

* test: align prerelease workflow expectation with main CI

* test: resume pending MCP Code Mode fixture calls

* test(agents): cover cloned admitted normalizers

Extend the canonical assembly-array fixture from openclaw#149662 with an admitted provider that returns cloned tools. Preserve its metadata, catalog, successful execution, abort-wrapper and post-disposal assertions. The production Array.from owner remains unchanged on main.

* ci: spread Control UI checks across twelve shards

* docs(ci): align runner guidance with current placement

* ci: route trusted hybrid preflight to Blacksmith

* test: align hybrid preflight runner table

* ci: retain real-Gateway failure diagnostics

Keep captured browser JSON and screenshots in an attempt-specific artifact when the real-Gateway CI job fails. Reuse the ordinary Control UI upload policy with seven-day retention and ignore absent captures, while preserving test commands and sanitized proof uploads.

Extend the existing workflow guard and document that diagnostic artifacts are not sanitized public proof. The new guard fails before the fix; all 18 focused alias, workflow, and command cases pass afterward. Workflow lint, selected changed-file checks, and independent review pass.

* fix(ui): preserve agent panel intent while route data loads

A reused Agents page retained its initialized flag after its route data became pending. Roster initialization could then navigate through the default Overview panel, replacing an intended Files route. Require current route data before navigation and panel work, and clear initialization when the pending update applies.

Keep explicit Settings selection revisions authoritative when the loader completes. Four focused regression cases fail before the repair with the reproduced Overview URL; 136 adjacent cases, targeted lint, formatting and independent review pass afterward.

* ci: publish allowlisted UI failure summaries

Keep raw browser reports and screenshots out of automatic CI artifacts. Write an explicit public projection from the existing failure owner and select only its fixed filename in ordinary and real-Gateway jobs. Raw captures remain local, and fixed private filenames keep sensitive labels out of logged paths. Older frozen targets without the summary produce no matching artifact.

Preserve original failures and manual sanitized proof capture. Sensitive-sentinel regressions cover nested state, route parameters, labels, errors, models and content, including evaluation, screenshot and storage failures. All 10 helper cases, six workflow/command cases, workflow validation, plain Node import and selected changed-file checks pass; independent review found no actionable issues.

* fix: align FileTransfer with fs-safe 0.12.0

Upgrade the FileTransfer dependency introduced by openclaw#148881 to the same exact version used by core, OpenShell and 1Password. Regenerate the importer with pnpm 12.3.4 and retain all other lock entries.

Strengthen the existing orphan-WAL collision regression with equal-length, different-content bytes so recovery exercises the shared hash path and preserves the existing quarantine. Frozen installation, the 16-case sidecar suite, 18 tool-policy cases and 23 UI/diagnostic cases pass on the integrated source; independent review found no actionable issues.

* test(ui): retain safe Canvas failure diagnostics

* test(gateway): model live child execution in stop proof

* test(ui): inspect HTML sandbox after render readiness

* test(cron): cover event schedules after API state updates

* ci: count hosted rows after hybrid preflight routing
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 P2 Normal backlog priority with limited blast radius. 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