fix(store): non-blocking validateStoragePath async background init (Issue #795)#796
Conversation
…#693) - Adds countBefore/countAfter validation in smart-extractor.ts after bulkStore - Adds ExtractionValidation type and callback interface in memory-categories.ts - Adds extraction-validation.test.mjs (6 scenarios, all pass) - Adds dedup-false-alarm.test.mjs (P0 regression: bulkStore does NOT dedup) - Registers new tests in CI manifest - Adds store.count() mock to existing tests (preference-slots, batch-embed, bulk-store)
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 29653644a0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // Issue #693 extraction write validation tests | ||
| { group: "core-regression", runner: "node", file: "test/extraction-validation.test.mjs", args: ["--test"] }, | ||
| { group: "core-regression", runner: "node", file: "test/dedup-false-alarm.test.mjs", args: ["--test"] }, |
There was a problem hiding this comment.
Restore the unrelated regression tests in the CI manifest
This manifest is what the GitHub CI jobs run via npm run test:core-regression / test:storage-and-schema (.github/workflows/ci.yml -> scripts/run-ci-tests.mjs), so replacing the existing block with only the new Issue #693 tests silently stops CI from running the Issue #690, #606, provider inference, recall-governance, and tier1 counter regressions. Unless those tests are intentionally retired elsewhere, keep the existing entries and append the new validation tests so these regressions remain covered.
Useful? React with 👍 / 👎.
Summary
Issue: #795 — plugin init 時 validateStoragePath 的 5 個 sync I/O 會 block event loop
Fix: 新增 validateStoragePathAsync + pathExistsAsync async 版本,並在 register() 內以 fire-and-forget 方式在 setImmediate() 中執行,不 block plugin 註冊的 critical path。
Changes
src/store.ts
index.ts
設計說明:兩全其美方案
同時滿足兩目標:
不採用完整 async 方案的原因:register() 是固定 API signature,改為 async 會破壞 OpenClaw core error detection 能力,且需要重構所有 60+ hook registrations。
關聯 Issue