Repository navigation
perf: avoid plugin discovery for core config paths - #170270
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
|
Codex review: needs maintainer review before merge. What this changesThis PR scopes secret-target discovery to the relevant config owner and skips plugin metadata work for ordinary core paths. Example: Run openclaw config set gateway.mode local.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR delivers a useful, maintainer-directed performance improvement that current main lacks, with relevant CLI evidence and no actionable defects found. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe secret-target registry sits between config and CLI callers and credential contracts, translating concrete paths or configured subtrees into supported secret targets. flowchart TD
A[Config and CLI callers] --> B[Secret target query owner]
B --> C[Static core targets]
B --> D[Selected plugin manifest]
B --> E[Direct channel contract]
E --> F[Broader registry fallback]
C --> G[Resolved secret targets]
D --> G
F --> G
Technical reviewBest possible solution: Use the existing registry owner to avoid unrelated discovery while preserving manifest targets, channel fallback, and disabled-owner auditing. Do we have a high-confidence way to reproduce the issue? Current-main source shows gateway.mode falling through to the full registry, and the supplied built-CLI profile exercises that path; no target code was executed during this review. Is this the best way to solve the issue? The change addresses unnecessary discovery at its existing owner, preserves direct-contract precedence and broader fallback, and accurately limits its performance claims because cold metadata bootstrap remains unchanged. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e068f04c1ba4. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +117, Tests +343, Docs +14. Total +474 across 9 files. Added test files: 1. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed October 12, 2026, 6:00 PM ET / 22:00 UTC (Revision 2). |
|
Merged via squash.
|
Ordinary core config paths paid for the full plugin secret-target registry, including metadata discovery and unrelated channel contracts. Gate secret-target resolution by config-path ownership. Core paths avoid plugin discovery; plugin paths use their manifest targets and channel-contract fallback; channel paths retain broader discovery for external or multiple owners. Reuse supplied manifest records during configured discovery and return immediately for empty plugin entries. Preserve core credentials, plugin-config credentials declared by manifests or channel contracts, disabled-plugin auditing/configuration, external channels, and unknown-channel behavior. No migration or operator action is required. Metadata bootstrap, config-schema loading, and deferred migrations remain outside this change. Release-note context: speed up config and secret-target resolution by avoiding unrelated plugin/channel registry work for core paths and configured subtrees. Validation: final 20-case owner suite, recorded 70-test sibling coverage and 45-test compatibility follow-up, targeted checks, build/runtime build, and independent review. Exact-head CI run 38311971521 passed on 0c6b281; detailed timings and profile evidence remain in the PR. Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Ordinary config paths such as
gateway.modepaid for the full plugin secret-target registry, including metadata discovery and every channel secret contract.User Impact
Core config paths now avoid plugin secret-target discovery. Plugin config paths try the named plugin's manifest targets, then its channel contract on a miss. Channel paths retain direct lookup and broader discovery for external or multiple owners. Configured discovery skips unrelated bundled contracts, and runtime collection returns immediately for empty plugin entries.
No migration or operator action is required. Core credentials, manifest and channel-declared plugin config secrets, disabled-plugin auditing/configuration, external channels, and unknown-channel handling retain their supported behavior. Channel contracts cannot extend core config schemas, but can declare credentials under their own plugin config schema; that shipped behavior is preserved.
Why This Change Was Made
The secret-target query owner now gates by config-path ownership. Concrete CLI target selection uses that scope, and configured discovery reuses supplied manifest records. Broad target enumeration retains the full registry because channel contracts may also declare plugin config credentials. Discovery also uses the broader index after falling back from an incomplete direct contract.
Cold metadata snapshot selection still scans before projecting to selected plugin IDs on this base. This change narrows target/contract construction; it does not redesign metadata bootstrap, config-schema loading, or deferred migrations.
Release-note context: speed up config and secret-target resolution by avoiding unrelated plugin/channel registry work for core paths and configured subtrees.
Evidence
Owner-seam regressions prove non-plugin paths never invoke plugin metadata discovery; selected plugin, bundled channel, external/multiple channel owner, disabled plugin, unknown-channel, and prepared-manifest paths are covered. The non-plugin lookup regression failed against the baseline at the metadata-discovery boundary. Additional compatibility regressions caught and fixed candidate gaps before publication.
The final source passed all 20 owner tests. Earlier validation passed 70 distinct sibling tests, and the plugin-contract compatibility follow-up reran 45 affected sibling tests successfully before the final target-family guard repair. That last repair is directly covered by the new owner regression; unchanged sibling proof is reused. Each changed test file was measured with
pnpm test <file> --maxWorkers=1:src/secrets/target-registry.path-scope.test.tssrc/secrets/target-registry.fast-path.test.tssrc/secrets/runtime-config-collectors-plugins.test.tsCI timing is the test wrapper’s reported per-file shard elapsed time; shared CI setup is amortized across files. The final owner suite used about 2s of local test execution.
The final 20-case owner suite covers direct lookup, plan target-family fallback, scoped discovery, and disabled owners. The three external-owner compatibility cases failed against the earlier candidate because the supported target was absent from path lookup and configured discovery; a fourth caught a target-family path miss preventing contract fallback. The older suites spent 99% and 92% of their Vitest duration transforming code; the cold compiler prepared 15,274 inputs / 19,579 outputs. The earlier 12-file sibling batch passed 70 tests, including real external CJS channel artifacts, registry snapshots, plan/configure, runtime command secrets, and CLI target selection.
The earlier 12-file sibling wall time was 762.837s.
The six-file compatibility sibling follow-up passed 45 tests in 651.682s.
pnpm check:changedpassed (core types, all 28 affected test typecheck graphs, core/extension lint, formatting, docs, boundaries, ratchets, dead exports, import cycles, and runtime/auth guards). It reported only two non-blocking max-lines warnings in untouched extension files. The final compatibility and target-family follow-ups also passed core types, their owning test-project types, changed-file lint, formatting, and diff checks.pnpm buildpassed, followed bypnpm build:runtimefor the final compatibility follow-up. Independent Codex review identified a target-family fallback gap, which was repaired with a failing regression. The final complete-diff review found no actionable P0–P2 issues.CLI measurements
Three-run medians in seconds, using built
dist/entry.js, Node 26.11.1 and Bun 1.4.3 on arm64. Every case uses synthetic isolated HOME/config/state; reused cases are primed once. The after column is a fresh run on the final runtime build. Cells show before → after.config setconfig setconfig getconfig getconfig validateconfig validateconfig setconfig setconfig getconfig getconfig validateconfig validateThe host was shared and heavily loaded (load1 ranges: before 26.01–76.56; after 39.94–71.05). These wall times are noisy and do not establish a controlled speedup ratio. The preliminary pass before the final follow-ups included a 101.5s Bun
setoutlier; no samples were discarded from either pass.Profile evidence
Bun
--cpu-prof --cpu-prof-mdon isolatedconfig set gateway.mode local; this table uses the main process profile, not the launcher. Values are inclusive sampled time, not pure instruction CPU time.resolveConfigSecretTargetByPathloadSecretTargetRegistryFromPluginMetadataloadBundledChannelSecretContractApiExact-head CI: run 38311971521 completed successfully on
0c6b281e8a2d4c00f640053f287e8aada493e755: 38 jobs passed and 25 were skipped by the plan. The native pinned-head watcher reportedGREEN, with no pending checks. GitHub’s raw aggregate still includes 87 superseded check runs; those are not failures of this active run. The PR remains ready for review and unmerged.