Skip to content

improve(agents): reuse provider policy manifest registry - #119305

Merged
vincentkoc merged 1 commit into
mainfrom
perf/provider-policy-plan-snapshot-20260804
Aug 4, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
perf/provider-policy-plan-snapshot-20260804

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

What Problem This Solves

OpenClaw's models.json normalization could rebuild the bundled-provider manifest registry while resolving provider aliases, even when the caller already held the process-lifecycle plugin metadata snapshot.

That duplicated provider-policy discovery on the agent startup path. Direct canonical-provider lookups were unaffected.

Why This Change Was Made

Thread the prepared manifest registry through the existing generic provider runtime seam when the metadata snapshot is complete. Scoped snapshots intentionally retain cold discovery because their owner metadata can be incomplete, and the models-config fingerprint now records snapshot scope so full and scoped entries cannot share cache state.

This keeps one provider-policy flow: the runtime accepts an optional prepared registry, while callers without a complete snapshot continue using the existing discovery path.

User Impact

No config, API, model-routing, or output behavior changes. Agent startup avoids one redundant bundled-provider policy registry construction when resolving alias-owned provider config from a full plugin metadata snapshot.

Evidence

  • Base: exact origin/main 7a0a4c5f2a3b778deec2eacafbeffc45f24579cf.
  • Focused tests: 122 passed across the agent models-config and provider-runtime surfaces.
  • Static proof: production tsgo, core test typecheck, current-head oxlint, formatting, and git diff --check passed.
  • Package/build proof: the affected package build and the previously failing CLI startup-metadata phase passed.
  • Final local autoreview: clean, confidence 0.98.
  • Production LOC: +48/-11, net +37. Tests: +304/-7.

Kova exact-main A/B, agent-cold-warm-message with an alias-owned mock provider, 5 samples each:

Metric Main Candidate
Result 5/5 PASS 5/5 PASS
Primary RSS median 862.3 MB 843.2 MB
Agent turn median 5355 ms 4965 ms
Cold pre-provider median 5192 ms 4705 ms
Warm pre-provider median 4747 ms 4421 ms
Metadata scans median 12 12
Metadata scan total median 206.14 ms 204.13 ms

Comparison result: OK, zero regressions and zero inconclusive metrics. These end-to-end timings are host-sensitive, so the performance claim is deliberately limited to removing the proven duplicate registry construction; the table is regression evidence, not a guaranteed latency reduction.

One earlier candidate run had a single cold-start threshold failure. Its time was dominated by config-preflight legacy migrations and plugin-registry startup outside this changed provider-policy seam. An unchanged exact-head rerun then passed 5/5; that separate startup owner remains follow-up work rather than scope growth here.

AI-assisted implementation and review; the maintainer verified the final diff, tests, build proof, and Kova artifacts.

@vincentkoc vincentkoc self-assigned this Aug 4, 2026
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: M maintainer Maintainer-authored PR labels Aug 4, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review August 4, 2026 18:08
@clawsweeper clawsweeper Bot added 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. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Aug 4, 2026
@clawsweeper

clawsweeper Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 4, 2026, 2:14 PM ET / 18:14 UTC.

ClawSweeper review

What this changes

The PR reuses a complete plugin metadata snapshot’s provider manifest registry during models configuration normalization, avoiding a duplicate bundled-provider policy registry load for alias-owned providers.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

No blocking code findings. This focused optimization carries the complete lifecycle-owned metadata registry through the existing provider-policy seam, preserves cold discovery for scoped snapshots, and adds cache-scope coverage; keep the maintainer-authored PR open through exact-head CI.

Priority: P3
Reviewed head: ac4a52ddeb082a7bd453396f571301d91f136cfb

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, well-covered internal optimization with no concrete correctness or security finding in review.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored PR is exempt from the external-contributor real-behavior-proof gate; its supplied benchmark remains useful supplemental evidence.
Patch quality 🐚 platinum hermit (4/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 external-contributor real-behavior-proof gate; its supplied benchmark remains useful supplemental evidence.
Evidence reviewed 6 items Complete-snapshot boundary: The planner forwards the prepared registry only when the snapshot has no plugin scope; scoped snapshots retain the existing discovery path.
Caller and policy chain: Prepared runtime facts pass the lifecycle-owned snapshot into models generation, whose normalization path forwards it to both API-key and configuration policy resolution.
Fallback and direct lookup preserved: Bundled aliases use the supplied registry when present, while direct canonical provider artifacts are resolved before registry inspection and callers without a registry retain manifest loading.
Findings None None.
Security None None.

How this fits together

Agent startup prepares plugin metadata and normalizes provider configuration into an agent models file. Provider-policy hooks use that metadata to resolve aliases, configuration rules, and API-key rules before the agent runtime consumes the result.

flowchart LR
  A[Agent startup] --> B[Complete plugin metadata snapshot]
  B --> C[Models configuration planner]
  C --> D[Provider policy lookup]
  D --> E[Normalized models file]
  E --> F[Agent runtime]
Loading

Before merge

  • Complete next step (P2) - No narrow repair is needed; wait for the required exact-head checks and ordinary maintainer merge review.
Agent review details

Security

None.

PR surface

Source +37, Tests +297. Total +334 across 11 files.

View PR surface stats
Area Files Added Removed Net
Source 6 48 11 +37
Tests 5 304 7 +297
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 11 352 18 +334

Review metrics

Metric Value Why it matters
Production versus test LOC production +48/-11; tests +304/-7 The net production growth establishes the generic prepared-registry and cache-scope boundary, with focused regression coverage for aliases and snapshot scope.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/plugins/provider-public-artifacts.test.ts, persistent cache schema: src/agents/models-config.write-serialization.test.ts, vector/embedding metadata: src/agents/models-config.provider-policy-registry.test.ts, vector/embedding metadata: src/agents/models-config.write-serialization.test.ts, vector/embedding metadata: src/plugins/provider-public-artifacts.test.ts, vector/embedding metadata: src/plugins/provider-runtime.test.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Retain the single canonical provider-policy path and merge once the required checks complete on the reviewed head.

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

Not applicable: this PR optimizes internal metadata reuse rather than fixing a separately reproducible user-facing failure.

Is this the best way to solve the issue?

Yes. Passing the already prepared complete registry through the existing generic policy seam is preferable to another cache or provider-specific alias workaround, while scoped snapshots correctly keep discovery.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 7a0a4c5f2a3b.

Labels

Label changes:

  • add P3: This is a bounded internal startup-performance optimization with no claimed configuration, routing, or user-visible behavior change.
  • 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: This maintainer-authored PR is exempt from the external-contributor real-behavior-proof gate; its supplied benchmark remains useful supplemental evidence.

Label justifications:

  • P3: This is a bounded internal startup-performance optimization with no claimed configuration, routing, or user-visible behavior change.
  • 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: This maintainer-authored PR is exempt from the external-contributor real-behavior-proof gate; its supplied benchmark remains useful supplemental evidence.

Evidence

What I checked:

Likely related people:

  • Vincent Koc: The reviewed commit owns the new agent-to-provider-policy seam; deeper historical attribution is unavailable because the local history ends at a shallow boundary and archive/network lookups were unavailable. (role: recent agent/provider-runtime contributor; confidence: low; commits: ac4a52ddeb08; files: src/agents/models-config.plan.ts, src/plugins/provider-runtime.ts)

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 832459d into main Aug 4, 2026
187 of 192 checks passed
@vincentkoc
vincentkoc deleted the perf/provider-policy-plan-snapshot-20260804 branch August 4, 2026 18:25
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

@clawsweeper

clawsweeper Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: improve(agents): reuse provider policy manifest registry This is item 2/3 in the current shard. Shard 0/38.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

vincentkoc added a commit that referenced this pull request Aug 4, 2026
…fecycle-20260804

* origin/main:
  perf(agents): reuse provider policy manifest registry (#119305)
  fix(media): roll back partial generated batches (#119292)
vincentkoc added a commit that referenced this pull request Aug 4, 2026
Punchcard-Session: crisp-lantern-orchard-nv

* origin/main: (46 commits)
  perf(agents): reuse provider policy manifest registry (#119305)
  fix(media): roll back partial generated batches (#119292)
  fix(gateway): steer matching embedded turns (#119287)
  fix(telegram): correlate deliveries to explicit topics
  fix(plugins): preserve install index state across failures (#119228)
  test: trim redundant control ui coverage (#119286)
  test: cover missing config method in memory settings
  fix: gate curated config controls by method
  test: cover read-only admin method gates
  fix: keep config drafts on their gateway
  fix: reset agent skill filters with config patch
  refactor: reuse chat error state helper
  test: avoid unbound identity request assertion
  refactor: isolate clawhub skill search
  fix: guard delayed config actions across reconnects
  fix: preserve workshop revisions across session navigation
  refactor: isolate workshop revision handoff
  test: advertise skill action methods in ui e2e
  fix: fail stale workshop revision sends
  fix: bind revision handoffs to gateway snapshots
  ...
vincentkoc added a commit that referenced this pull request Aug 5, 2026
…time

* origin/main: (75 commits)
  fix(commands): restore tool inventory for dynamic models (#119306)
  fix(media): release rejected BytePlus and Runway video downloads under debug capture (#119257)
  docs: add ChromeOS (Crostini) platform install guide (#107663)
  test(msteams): serve JWKS from in-process server in auth coverage (#119354)
  fix(qa): enable OpenAI for stored audio scenario (#119349)
  test(agents): realpath apply-patch temp dir fixture (#119353)
  test(slack): drop redundant .js-suffixed system-event mock (#119352)
  fix(exec): leave safe builtins unrewritten in enforced mode (#119351)
  fix(sessions): keep gateway responsive while large transcript archives are built (#112424)
  fix(tui): restore provider auth in installed local mode (#119283)
  fix(release): accept legacy empty core artifacts (#119337)
  fix(qa): carry selected runtime into flow scenarios (#119324)
  fix(ci): retry interrupted Windows dashboard release checks (#119095)
  fix(release): filter validation ancestry fetch (#119334)
  fix(release): accept trusted extended-stable validation evidence (#119264)
  fix(sessions): preserve recorder-owned user turns (#119307)
  perf(cli): split plugin registry startup timing (#119318)
  fix(qa): align release scenario setup and compaction proof (#119188)
  fix(ci): avoid duplicate Matrix release QA runs (#119171)
  perf(agents): reuse provider policy manifest registry (#119305)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 5, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 6, 2026
…fecycle-20260804

* origin/main:
  perf(agents): reuse provider policy manifest registry (openclaw#119305)
  fix(media): roll back partial generated batches (openclaw#119292)
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 P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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