Skip to content

[Perf]: Redundant filesystem walks in plugin discovery during startup #82308

@SebTardif

Description

@SebTardif

Problem

discoverOpenClawPlugins() is called independently by multiple plugin subsystems during the same startup flow. Each call performs an identical filesystem walk to discover plugin candidates. When callers like loadBundledCapabilityRuntimeRegistry, resolveBundledPluginSources, and listChannelCatalogEntries are invoked in sequence with the same parameters, the walk repeats unnecessarily.

Impact

Redundant I/O during startup. The effect scales with the number of installed plugins and the depth of the plugin directory tree.

Expected behavior

Callers that already hold a PluginDiscoveryResult from an earlier step in the same flow should be able to pass it through, skipping the redundant filesystem walk while keeping discoverOpenClawPlugins itself stateless (no hidden global cache).

Affected files

File Role
src/plugins/bundled-capability-runtime.ts Calls discovery independently
src/plugins/contracts/registry.ts Retry loop re-discovers on each attempt
src/plugins/bundled-sources.ts Calls discovery independently
src/plugins/channel-catalog-registry.ts Calls discovery independently

Design constraint

discoverOpenClawPlugins() must remain stateless with no hidden cache. Discovery sharing should be function-scoped, not module-level.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions