Skip to content

fix: avoid rebuilding provider metadata during usage reads - #146488

Merged
steipete merged 2 commits into
mainfrom
codex/swarm-catalog-policy
Sep 12, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/swarm-catalog-policy

Conversation

@steipete

@steipete steipete commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

TLS prerequisite: #146412 (landed on main).

Related: #130741

What Problem This Solves

Provider usage discovery rebuilds plugin manifest metadata even when the Gateway already holds a complete inventory.

User Impact

Usage reads reuse the active plugin inventory while preserving current activation rules, aliases, and bundled-provider compatibility.

Why This Change Was Made

Carry the manifest metadata already returned by the registry owner through usage discovery and plugin-id normalization. Cold discovery remains available when no compatible operation snapshot exists.

Evidence

The regression fails on the base because two warm usage lookups rebuild manifests four times. All 176 scoped tests pass on the candidate, covering usage discovery, provider runtime, cold fallback, and plugin usage loading. The normal build, representative OpenAI plugin import profile, and isolated P1 review passed.

The full canonical changed gate passed on the published head. Exact-head CI remains required before landing.

@clawsweeper

clawsweeper Bot commented Sep 12, 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.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: S maintainer Maintainer-authored PR labels Sep 12, 2026
@steipete
steipete marked this pull request as ready for review September 12, 2026 21:28
@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 12, 2026
@clawsweeper

clawsweeper Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 12, 2026, 5:53 PM ET / 21:53 UTC (Revision 2).

ClawSweeper review

What this changes

The branch reuses prepared plugin metadata during provider usage discovery, adds warm and cold discovery regression coverage, and corrects TLS renewal shutdown registration.

Merge readiness

✅ Ready for maintainer review

This remains a useful, focused fix: current main still rebuilds metadata during usage discovery. No actionable introduced defect was found, and the already-merged TLS prerequisite does not supersede the provider change.

Priority: P2
Reviewed head: 6c25e954135068277a5c361b2e9fe841d9c9fc52

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-reuse fix with meaningful regression coverage and no actionable correctness or security findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied repository state identifies a maintainer-authored internal optimization, so the external-contributor proof gate does not apply; reported tests exercise metadata discovery, while unrelated subagent media is not credited as usage-path proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied repository state identifies a maintainer-authored internal optimization, so the external-contributor proof gate does not apply; reported tests exercise metadata discovery, while unrelated subagent media is not credited as usage-path proof.
Evidence reviewed 9 items Introduced change and merge boundary: The verified test merge records the pinned base followed by the exact PR head as parents. Its provider diff carries prepared manifests into discovery and normalization; the TLS correction is already present on the base.
Current-main necessity: The fetched main revision still discards prepared manifests through loadProviderRegistrySnapshot and invokes normalization without supplying them.
Latest-release check: The v2026.9.4 source also uses the old usage-discovery path. A local release-blob read failed, so the source was inspected through GitHub's contents API.
Findings None None.
Security None None.

How this fits together

Provider usage discovery identifies eligible plugins before OpenClaw resolves credentials and fetches usage summaries. It consumes the plugin inventory and current activation settings to produce provider descriptors.

flowchart TD
  A[Usage summary request] --> B[Plugin registry owner]
  B --> C{Compatible inventory available?}
  C -->|Yes| D[Prepared plugin metadata]
  C -->|No| E[Cold metadata discovery]
  D --> F[Apply aliases and activation rules]
  E --> F
  F --> G[Provider descriptors]
  G --> H[Resolve credentials and fetch usage]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +4, Tests +143. Total +147 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 2 7 3 +4
Tests 1 143 0 +143
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 150 3 +147

Review metrics

None.

Technical review

Best possible solution:

Keep usage discovery on the existing lifecycle-owned inventory while preserving current activation policy and cold-process fallback.

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

Yes, from source: warm usage discovery on current main discards prepared manifests and rebuilds them during discovery and alias normalization. The PR reports a failing base regression; this review did not execute it.

Is this the best way to solve the issue?

Yes. Passing the existing owner's prepared manifests through both consumers removes redundant work without adding another cache, public API, or configuration path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 5270db64d8d0.

Labels

Label justifications:

  • P2: This fixes bounded, repeated metadata work on provider usage reads without evidence of an urgent user-facing outage.
  • 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 supplied repository state identifies a maintainer-authored internal optimization, so the external-contributor proof gate does not apply; reported tests exercise metadata discovery, while unrelated subagent media is not credited as usage-path proof.

Evidence

What I checked:

  • Introduced change and merge boundary: The verified test merge records the pinned base followed by the exact PR head as parents. Its provider diff carries prepared manifests into discovery and normalization; the TLS correction is already present on the base. (src/plugins/providers.ts:796, 2305f3bccb35)
  • Current-main necessity: The fetched main revision still discards prepared manifests through loadProviderRegistrySnapshot and invokes normalization without supplying them. (src/plugins/providers.ts:796, 5270db64d8d0)
  • Latest-release check: The v2026.9.4 source also uses the old usage-discovery path. A local release-blob read failed, so the source was inspected through GitHub's contents API. (src/plugins/providers.ts, 3a9d69db306c)
  • Existing lifecycle owner: The registry loader already returns both inventory and manifests. Snapshot selection retains operation-scope compatibility checks and the existing immutable Gateway-generation contract; this PR adds no new cache or lifecycle owner. (src/plugins/plugin-registry-snapshot.ts:409, 6c25e9541350)
  • Documented metadata contract: Plugin architecture documents complete metadata inventories, including disabled plugins, and runtime reads without filesystem rediscovery; explicit lifecycle operations publish replacement inventories. Public docs: docs/plugins/architecture.md. (docs/plugins/architecture.md:141, 6c25e9541350)
  • Regression coverage and execution limits: The complete added test covers warm reads without manifest rebuilds or filesystem reads, alias normalization, disablement, bundled compatibility, and four cold-fallback cases without runtime loading. The captured PR body reports a failing base regression, 176 passing scoped tests, build, import profile, and changed gate; these were not executed during this read-only review. Diff whitespace validation passed and the checkout remained clean. (src/plugins/providers.current-snapshot.test.ts:61, 6c25e9541350)

Likely related people:

  • 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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-12T21:37:21.253Z sha 6c25e95 :: needs maintainer review before merge. :: none

@steipete
steipete merged commit bcec455 into main Sep 12, 2026
260 checks passed
@steipete
steipete deleted the codex/swarm-catalog-policy branch September 12, 2026 22:16
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 13, 2026
…146488)

* fix(gateway): stop TLS renewal through the shutdown owner

* fix: avoid rebuilding provider metadata during usage reads
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime 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