Skip to content

perf(plugins): resolve requested capability owners in one pass - #138111

Merged
steipete merged 1 commit into
mainfrom
codex/perf-sep04-requested-capability-owners
Sep 5, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/perf-sep04-requested-capability-owners

Conversation

@steipete

@steipete steipete commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Related: #138003

Additional instructions

Allow edits from maintainers remains enabled.

What Problem This Solves

Resolving several configured capability providers repeats manifest selection and policy work for each requested provider. This becomes more expensive as the number of requested providers and eligible owners grows.

Why This Change Was Made

The existing owner resolver now consumes the requested-provider Set in one manifest pass, replacing the separate per-provider resolution loop. Complete canonical coverage selects matching owners together. Partial coverage still searches all eligible owners for runtime-only aliases; zero coverage keeps cold catalogs unfiltered. Denied owners do not count toward coverage. Active/private generations, declared source and built catalogs, sorted owner IDs, provider precedence, and single-provider/media behavior retain their existing owners.

No cache, public configuration, schema, dependency, or alternate runtime path is added. Production changes are +44/−61, net −17 lines. Preservation tests add 71 lines, including current source/built catalog coverage. This refresh uses current capability-catalog ownership rather than carrying the older runtime-register-only assumption forward.

User Impact

Configured multi-provider resolution does less repeated bookkeeping and returns the same providers. The measurement below covers the complete public resolver after an explicit private-load priming call. It does not establish faster cold startup, provider execution, whole model turns, or lower memory use.

Evidence

Current refresh at base c26e46b2f87ad50d2f655e44975eafc8d394527f: 213 cases in six complete owner/generation/manifest-policy/config/provider suites passed before and after; all 29 ordinary changed checks passed. Managed Codex review returned no P0–P2 findings, confidence 0.88. The subsequent normal source-mapped build passed, and two authenticated built-Gateway tts.providers calls returned identical complete provider DTOs. These read-only calls did not synthesize audio or invoke provider callbacks; source and built catalog activation, alias fallback, denied owners, stale generations, and unrelated-owner exclusion are covered separately by the whole-file suites.

The fixed proof-before/proof-candidate/B0/C0/C1/B1 cohort ran once: 8,164 checked outputs plus 40 priming calls, 896 measured batch means, and 144 comparisons. A separate root audit recomputed all comparisons from raw observations and verified all outputs against the previously audited proof oracles. Both-order medians:

Complete public resolver case Forward Reverse
Four requested providers / eight owners −4.8038% (−5.867 µs) −2.9792% (−3.547 µs)
Sixteen requested providers / 32 owners −30.9313% (−166.878 µs) −32.5517% (−181.508 µs)

The unchanged numerical verdict remains accepted=false: the first case's reverse improvement is 2.9792%, below the preset 3% primary requirement. The reducer exited 1 for that exact failure. There was no measurement retry, threshold change, or sample selection.

All 65 adverse comparisons remain retained. The results are not uniformly faster: an active-provider control's reverse median increased 994.94 ns/19.24%, and another protected reverse median increased 2.406 µs/2.987%. These fall below one arm of the original conjunctive >3% and >1 µs regression gate, but are still regressions. The first case's reverse p95 increased 26.683 µs/13.29%; a protected active control's reverse p95 increased 3.604 µs/571.86%. Here p95 is nearest-rank over 16 batch means, not individual-call p95.

Sampled tree peak RSS changed +6.55%/−7.69%; kernel child peaks +5.94%/−6.69%. Both sampled-RSS gates passed, but this does not establish a memory improvement. All six hosts and their adapters closed; all 20 recorded process identities and 14 groups were absent on final verification. Native host time totaled 19.425 s and actual dispatch-through-join envelopes totaled 38.792 s; preparation, observation gaps, build, review, and publication are separate costs.

The source-host study retains actual source hashes, Debugger URLs, and complete compiled text. TSX maps contain sourcesContent: [null], so no full embedded-TypeScript equality is claimed. Per-phase setup metrics and isolated state-root fingerprints are retained and explicitly normalized only by the predeclared logical-input comparison. The benchmark does not measure declared-catalog loading; the separate built-Gateway and source/built catalog tests cover that behavior. Three metadata-reader/orchestration errors were corrected without repeating target execution and remain recorded.

Maintainer performance decision and previous review

I accept the scoped owner-selection gains and the smaller canonical implementation as an engineering tradeoff, including the near-threshold result and disclosed slower controls/tails. Numerical acceptance remains false. Correctness, exact-head CI, and native landing gates are not waived.

The earlier experiment on the old source remains a separate failed study: its reverse sampled-tree RSS increase was 16.48%, with 69 adverse comparisons. That unresolved historical failure has not been reclassified or transferred to the current source. The earlier ClawSweeper review requested retaining that tradeoff and resolving exact-head CI. Its old failing security-fast run exhausted four npm advisory-service timeout attempts, with no reported security finding; no security check or registry control was bypassed. This refreshed head must pass the normal required CI before landing.

@clawsweeper

clawsweeper Bot commented Sep 4, 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 size: S maintainer Maintainer-authored PR labels Sep 4, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 4, 2026
@clawsweeper

clawsweeper Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 5, 2026, 1:51 AM ET / 05:51 UTC.

ClawSweeper review

What this changes

The PR batches configured provider-owner lookup into one manifest scan while preserving alias fallback, plugin policy, and catalog loading.

Merge readiness

✅ Ready for maintainer review

Keep open: current main does not contain this optimization, and the refreshed patch has no blocking findings. The failed numerical performance gate and slower controls remain disclosed, with explicit engineering acceptance.

Priority: P3
Reviewed head: c16707c027a31f09f56c76db186d3f9639563acc

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, smaller implementation with useful preservation coverage and transparently bounded performance claims.
Proof confidence 🌊 off-meta tidepool Not applicable: The contributor proof gate is exempt for this maintainer-authored internal refactor. Reported primed-resolver comparisons and built-Gateway tts.providers reads address provider listing; they do not establish audio execution, cold-start, or whole-turn gains.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The contributor proof gate is exempt for this maintainer-authored internal refactor. Reported primed-resolver comparisons and built-Gateway tts.providers reads address provider listing; they do not establish audio execution, cold-start, or whole-turn gains.
Evidence reviewed 11 items Verified introduced scope: The pinned parent-to-head delta contains only the resolver and its two test files. Raw test-merge parents match the pinned base followed by the exact PR head; its comparison against that base contains the same three paths.
Current main still repeats owner resolution: Current main retains the requested-provider loop. Its resolver blob matches the PR merge-base blob, so the merged normalization and catalog changes have not superseded this optimization.
Selection invariants preserved: Coverage is counted only after existing owner eligibility passes. Partial coverage broadens to eligible owners; zero coverage retains the caller’s unfiltered cold-catalog path. Sorted owner IDs, active-provider precedence, single-provider lookup, and media preparation remain intact.
Findings None None.
Security None None.

How this fits together

OpenClaw’s capability loader combines configured provider requests with plugin metadata and policy. It returns provider descriptors used by speech, realtime voice, and media services.

flowchart TD
  A[Configured provider requests] --> C[Manifest ownership and plugin policy]
  B[Plugin metadata snapshot] --> C
  C --> D{Requested IDs covered}
  D -->|Complete| E[Matching eligible owners]
  D -->|Partial or none| F[All eligible owners]
  E --> G[Active registry or scoped catalogs]
  F --> G
  G --> H[Provider descriptors]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -17, Tests +71. Total +54 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 44 61 -17
Tests 2 71 0 +71
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 115 61 +54

Review metrics

Metric Value Why it matters
Production versus test LOC Production −17 net; tests +71 net The existing owner absorbs the optimization while the separate per-provider wrapper is removed.
Manifest scan count Complete coverage: one scan instead of one per requested provider Partial and zero coverage retain a second broad scan, preserving alias discovery without persistent caching.
Numerical acceptance 2.9792% reverse gain versus 3% target; accepted=false The recorded engineering acceptance preserves the failed threshold rather than presenting a uniformly successful benchmark.

Technical review

Best possible solution:

Keep batching inside the existing owner resolver, preserving policy-aware alias fallback and generation-owned catalog loading without adding another cache.

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

Not applicable as a functional bug reproduction: main source directly shows repeated per-provider scans, and the body reports comparative measurements; this review did not execute them.

Is this the best way to solve the issue?

Yes. The existing resolver can absorb batching while retaining its policy and fallback decisions; another cache or parallel lookup API would add unnecessary lifecycle ownership.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • remove merge-risk: 🚨 availability: Current PR review selected no merge-risk labels.

Label justifications:

  • P3: This is a bounded internal performance improvement with preserved provider behavior and no demonstrated urgent user regression.
  • 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 contributor proof gate is exempt for this maintainer-authored internal refactor. Reported primed-resolver comparisons and built-Gateway tts.providers reads address provider listing; they do not establish audio execution, cold-start, or whole-turn gains.

Evidence

What I checked:

  • Verified introduced scope: The pinned parent-to-head delta contains only the resolver and its two test files. Raw test-merge parents match the pinned base followed by the exact PR head; its comparison against that base contains the same three paths. (src/plugins/capability-provider-runtime.ts:125, 4eafe322724c)
  • Current main still repeats owner resolution: Current main retains the requested-provider loop. Its resolver blob matches the PR merge-base blob, so the merged normalization and catalog changes have not superseded this optimization. (src/plugins/capability-provider-runtime.ts:421, 7b1217e2e79e)
  • Selection invariants preserved: Coverage is counted only after existing owner eligibility passes. Partial coverage broadens to eligible owners; zero coverage retains the caller’s unfiltered cold-catalog path. Sorted owner IDs, active-provider precedence, single-provider lookup, and media preparation remain intact. (src/plugins/capability-provider-runtime.ts:137, c16707c027a3)
  • Catalog preservation coverage: Two added source/built cases check both requested descriptors, their selected artifact labels, exclusion of an unrelated throwing catalog, and absence of full runtime imports. Existing generation tests cover installed overrides, omitted and empty families, explicit denials, and replaced generations. (src/plugins/capability-provider-runtime.generation.test.ts:248, c16707c027a3)
  • Alias and policy coverage: The added table checks partial alias coverage, zero canonical coverage, and denied canonical owners. The complete surrounding suite also covers active aliases, policy mutation, external owners, bundled compatibility, and sibling capability families. (src/plugins/capability-provider-runtime.test.ts:1681, c16707c027a3)
  • Production entrypoint and implementation boundary: The tts.providers handler reaches the changed resolver through listSpeechProviders. The resolver uses OpenClaw’s manifest eligibility and scoped registry/catalog loader; no changed behavior depends on a Codex protocol or runtime contract. References to an earlier Codex review do not establish that dependency. (src/gateway/server-methods/tts.ts:327, c16707c027a3)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Shubhankar Tripathy: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; 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 (2 earlier review cycles)
  • reviewed 2026-09-04T09:31:11.027Z sha f4bd9a7 :: blocked before merge. :: none
  • reviewed 2026-09-04T12:09:14.235Z sha f4bd9a7 :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Sep 4, 2026

@sylvesterkaczmarek sylvesterkaczmarek left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The preservation logic is the important part here: complete canonical coverage stays scoped, partial coverage falls back for runtime aliases, and zero coverage avoids incorrectly filtering cold catalogs. Keep the performance claim scoped given the retained RSS rejection.

@steipete
steipete force-pushed the codex/perf-sep04-requested-capability-owners branch from f4bd9a7 to c16707c Compare September 5, 2026 05:18
@steipete

steipete commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Refreshed onto current capability-catalog ownership at c16707c, with source/built catalog preservation coverage, 213 passing cases, normal gates, mapped build, two authenticated built-Gateway provider-list reads, and a new fixed comparative cohort. The body preserves both the historical RSS failure and the current 2.979% versus 3% failed numerical gate, with explicit engineering acceptance and all adverse observations. Exact-head CI is required; no check is bypassed.

@clawsweeper

clawsweeper Bot commented Sep 5, 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 removed the merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. label Sep 5, 2026
@steipete

steipete commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

Ready to land c16707c027a31f09f56c76db186d3f9639563acc: exact-head CI is green, native preparation passed, and the refreshed ClawSweeper review reports no findings or before-merge items. This also resolves the earlier review's CI rank-up request. Independent managed Codex review found no actionable issue.

The existing owner resolver now batches requested provider IDs, removing the separate per-provider traversal and 17 production lines. Partial alias coverage, zero coverage, denied owners, source/built catalogs, and generation replacement retain their existing policy and lifetime. The refreshed 213-case six-file before/after corpus, normal changed checks, mapped build, and authenticated built-Gateway provider-listing reads are recorded in the body.

The numerical verdict remains accepted=false: the smaller primary reverse result was 2.9792%, below its preset 3% target; the larger primary improved 30.93–32.55%. All 65 adverse comparisons and the separate historical reverse-RSS failure remain explicit. The engineering decision accepts this simpler resolver and useful component gain; it does not waive correctness or CI, and does not claim cold-start, synthesis, whole-turn, or memory gains.

@steipete
steipete merged commit 39f37ea into main Sep 5, 2026
180 checks passed
@steipete
steipete deleted the codex/perf-sep04-requested-capability-owners branch September 5, 2026 06:02
@steipete

steipete commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

2 participants