Skip to content

perf(plugins): classify cached tool candidates once#96948

Merged
vincentkoc merged 1 commit into
openclaw:mainfrom
ly-wang19:codex/high-quality-algo-2
Jun 26, 2026
Merged

perf(plugins): classify cached tool candidates once#96948
vincentkoc merged 1 commit into
openclaw:mainfrom
ly-wang19:codex/high-quality-algo-2

Conversation

@ly-wang19

Copy link
Copy Markdown
Contributor

What Problem This Solves

Cached plugin descriptor execution scans the selected plugin tool candidates more than once when deciding which runtime registration should execute a requested tool. That path runs when a cached manifest descriptor needs to resolve the actual runtime tool implementation.

Why This Change Was Made

The code now classifies plugin tool candidates in one pass into matching named registrations and unnamed fallback registrations. It preserves the existing execution order: matching named candidates first, then unnamed candidates, with stable registry order inside each group.

User Impact

Plugin tool execution does less repeated candidate-list work on cached descriptor calls, especially for plugins with multiple tool registrations. Runtime behavior and fallback semantics are intended to stay unchanged.

Evidence

  • node scripts/run-vitest.mjs src/plugins/tools.optional.test.ts
  • .agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main --parallel-tests "node scripts/run-vitest.mjs src/plugins/tools.optional.test.ts"
  • autoreview clean: no accepted/actionable findings reported; tests exit 0

@clawsweeper

clawsweeper Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed June 26, 2026, 5:38 PM ET / 21:38 UTC.

Summary
The PR changes cached plugin descriptor execution in src/plugins/tools.ts to build matching named and unnamed fallback candidate lists in one pass before resolving runtime factories.

PR surface: Source +5. Total +5 across 1 file.

Reproducibility: not applicable. this is a performance cleanup rather than a bug report. Source inspection confirms current main does two candidate-list filters, while PR head classifies the same candidates in one pass.

Review metrics: none identified.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🐚 platinum hermit
Result: blocked until real behavior proof from a real setup is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Add redacted terminal output or logs from an after-fix cached descriptor-backed plugin tool call showing the intended tool still resolves and executes, then update the PR body for re-review.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR body lists focused Vitest and autoreview only; it needs redacted terminal output, logs, copied live output, or similar proof from a real cached descriptor-backed tool execution before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Risk before merge

  • [P1] The PR has only test/autoreview evidence; maintainers do not yet have contributor-supplied real output showing a cached descriptor-backed tool still resolves and executes after the change.

Maintainer options:

  1. Decide the mitigation before merge
    Keep the narrow one-pass classification shape, but merge only after redacted terminal output or logs show an after-fix cached descriptor-backed plugin tool resolving and executing in a real setup.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] The remaining blocker is contributor-supplied real behavior proof, not a narrow code repair ClawSweeper can safely make on the branch.

Security
Cleared: The diff only changes in-memory plugin tool candidate iteration and does not touch dependencies, workflows, secrets, persisted data, permissions, or code-loading sources.

Review details

Best possible solution:

Keep the narrow one-pass classification shape, but merge only after redacted terminal output or logs show an after-fix cached descriptor-backed plugin tool resolving and executing in a real setup.

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

Not applicable: this is a performance cleanup rather than a bug report. Source inspection confirms current main does two candidate-list filters, while PR head classifies the same candidates in one pass.

Is this the best way to solve the issue?

Yes for the code shape: one-pass classification is the narrowest maintainable change and preserves the existing execution order. Merge readiness still depends on contributor-supplied real behavior proof.

AGENTS.md: found and applied where relevant.

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

Label changes

Label justifications:

  • P3: This is a small plugin-runtime performance cleanup with no new user-facing surface or urgent regression signal.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body lists focused Vitest and autoreview only; it needs redacted terminal output, logs, copied live output, or similar proof from a real cached descriptor-backed tool execution before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +5. Total +5 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 1 11 6 +5
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 11 6 +5

What I checked:

  • Repository policy read: Read root policy and the scoped plugin policy; plugin cache/laziness guidance and the external-PR proof gate both apply to this review. (AGENTS.md:1, a0e9ca1e9544)
  • Current main behavior: Current main still builds matchingNamedCandidates and unnamedCandidates with two separate filters before iterating named candidates then unnamed fallback candidates. (src/plugins/tools.ts:727, a0e9ca1e9544)
  • PR head behavior: PR head classifies the same candidate groups in one loop and keeps the existing named-first, unnamed-fallback execution loop. (src/plugins/tools.ts:710, 5de49e3692d6)
  • Adjacent cached descriptor tests: Existing tests cover cached descriptor execution, retained runtime registries, implicit unnamed registrations, shared declared names, and avoiding unrelated named factories before unnamed fallback. (src/plugins/tools.optional.test.ts:2025, a0e9ca1e9544)
  • Live PR proof state: The PR body lists focused Vitest and autoreview only; no PR comments, reviews, labels, or body text provide redacted real cached descriptor execution output or a proof override. (5de49e3692d6)
  • Related history: GitHub file history shows the cached descriptor resolver was recently shaped by merged PRs for dispatch-by-runtime-name and retained registries, with adjacent open cached-descriptor hardening PRs on the same files. (src/plugins/tools.ts:675, 3adbbe7c34b5)

Likely related people:

  • zanni098: Authored the merged cached descriptor-backed dispatch fix that established the named-first then unnamed-fallback runtime-name matching invariant this PR preserves. (role: adjacent cached-tool fix contributor; confidence: high; commits: 3adbbe7c34b5; files: src/plugins/tools.ts, src/plugins/tools.optional.test.ts)
  • luoyanglang: Authored the merged retained-registry fix in the same cached descriptor execution path and adjacent tests shortly before this PR. (role: recent area contributor; confidence: high; commits: 374076b5a8c5; files: src/plugins/tools.ts, src/plugins/tools.optional.test.ts, src/plugins/runtime/load-context.ts)
  • vincentkoc: Co-authored and reviewed recent plugin descriptor/cache work and owns an overlapping open cached descriptor hardening PR touching the same resolver and tests. (role: adjacent area contributor; confidence: high; commits: 570e2db25210, 38b1a7c300e8; files: src/plugins/tools.ts, src/plugins/tools.optional.test.ts, src/plugins/tool-descriptor-cache.ts)
  • steipete: Recent file history shows repeated work on plugin tool wrapping, descriptor metadata, and descriptor-cache-related helper surfaces around this runtime path. (role: feature-history contributor; confidence: medium; commits: f62a22ce560e, 643633c1e5fc, 4d54d196c99a; files: src/plugins/tools.ts, src/plugins/tool-descriptor-cache.ts, docs/plugins/sdk-overview.md)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Jun 26, 2026
@vincentkoc
vincentkoc force-pushed the codex/high-quality-algo-2 branch from a15dfe5 to 5de49e3 Compare June 26, 2026 21:29
@vincentkoc
vincentkoc merged commit c1336b6 into openclaw:main Jun 26, 2026
95 checks passed
@vincentkoc

Copy link
Copy Markdown
Member

Merged via squash.

wangmiao0668000666 pushed a commit to wangmiao0668000666/openclaw that referenced this pull request Jun 27, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jun 27, 2026
xydigit-zt pushed a commit to xydigit-zt/xydigit-zt-openclaw that referenced this pull request Jun 28, 2026
QiuYuang pushed a commit to QiuYuang/openclaw that referenced this pull request Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XS status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants