Repository navigation
Conversation
Plugin manifest discovery calls fs.existsSync dozens of times across hot paths during cold start. CPU profiling shows significant self-time in these syscalls. Introduce a process-scoped cache in src/shared/cached-fs.ts that maps absolute paths to their fs.existsSync result. The cache lives for the lifetime of the Node process and can be invalidated per-path or fully via invalidateExistsSyncCache(). Replace fs.existsSync calls in: - src/plugins/bundle-manifest.ts (18 calls) - src/plugins/bundled-dir.ts (14 calls) - src/plugins/sdk-alias.ts (9 calls) Fixes openclaw#76209
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close: the useful plugin-scan Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Canonical path: Keep the merged scan-scoped cache and handle any remaining So I’m closing this here and keeping the remaining discussion on #93919. Review detailsBest possible solution: Keep the merged scan-scoped cache and handle any remaining Do we have a high-confidence way to reproduce the issue? Yes for the patch defect: source inspection shows this branch would cache existence results process-wide while current main tests require later scans to re-read filesystem state. I did not rerun the original Windows cold-start profile in this read-only review. Is this the best way to solve the issue? No. A cache is the right direction, but the merged scan-scoped implementation is the narrower maintainable fix; this branch’s process-lifetime cache is too broad for install and diagnostic freshness. Security review: Security review cleared: No concrete security or supply-chain concern was found; the diff adds no dependencies, workflow changes, secrets handling, network access, or code-execution surface. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against d1b917120a47; fix evidence: commit 1585ec54f1a6, main fix timestamp 2026-06-22T18:27:36Z. |
Summary
Plugin manifest discovery calls
fs.existsSyncdozens of times across hot paths during cold start. CPU profiling shows significant self-time in these syscalls.This PR introduces a process-scoped cache in
src/shared/cached-fs.tsthat maps absolute paths to theirfs.existsSyncresult. The cache lives for the lifetime of the Node process and can be invalidated per-path or fully viainvalidateExistsSyncCache().Changes
src/shared/cached-fs.ts- exportsexistsSyncCached(p)andinvalidateExistsSyncCache(p?)src/shared/cached-fs.test.ts- tests for the cache utilitysrc/plugins/bundle-manifest.ts- replaced 18fs.existsSynccallssrc/plugins/bundled-dir.ts- replaced 14fs.existsSynccallssrc/plugins/sdk-alias.ts- replaced 9fs.existsSynccallsTesting
Tests verify:
fs.existsSyncFixes #76209
Real behavior proof (required for external PRs)
fs.existsSyncdozens of times across hot paths during cold start, causing significant syscall overhead.node scripts/run-vitest.mjs run src/shared/cached-fs.test.tswith tests for cache hit, invalidation, and parity withfs.existsSync.existsSyncCached()returns the same results asfs.existsSyncand caches lookups so repeated calls for the same path do not trigger additional syscalls.invalidateExistsSyncCache()correctly clears individual paths or the full cache.Current review state
check-test-typesfails onextensions/msteams/src/send.test.tslines 663/713 with TS2493 tuple type error -- this file is not in the PR diff.