Repository navigation
fix(memory-wiki): publish dashboard snapshots - #132296
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 29, 2026, 7:11 PM ET / 23:11 UTC. ClawSweeper reviewWhat this changesThe branch compiles Memory Wiki dashboard data into cached snapshots, serves dashboard requests from those snapshots, and discloses bounded results in the Control UI. Merge readinessKeep open: this protected maintainer PR is a coherent candidate fix for the linked large-vault Gateway stall, and current main still performs the request-time path it removes. Priority: P1 Review scores
Verification
How this fits togetherMemory Wiki turns vault pages into dashboard data served through Gateway methods to the Control UI. This change moves expensive page parsing into compilation and makes requests consume a published snapshot. flowchart LR
Vault[Memory Wiki vault] --> Compiler[Background compiler]
Compiler --> Cache[Compiled dashboard snapshots]
Request[Gateway dashboard request] --> Reader[Snapshot reader]
Cache --> Reader
Reader --> UI[Control UI]
Request --> Sync[Background source sync]
Sync --> Compiler
Before merge
Agent review detailsSecurityNone. PR surfaceSource +585, Tests +559, Docs +10. Total +1154 across 33 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the snapshot and lifecycle owner boundary, with the explicit temporary recovery state verified on the exact PR head before merge. Do we have a high-confidence way to reproduce the issue? Yes: current-main source shows the request-time dashboard path, and the linked issue supplies a consistent large-vault operational trace; this read-only review did not execute it locally. Is this the best way to solve the issue? Yes: moving scans and projection construction to the compiler/cache owner eliminates repeated request-time parsing and preserves explicit recovery behavior when no snapshot is ready. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5b532a78ee1f. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (7 earlier review cycles)
|
|
Thanks @etzelm! Proof: On the built Control UI and isolated Gateway, the 229.4 MB vault took 166,149/166,347 ms on current-main behavior. Exact head
Example
|
Publish bounded Memory Wiki dashboard projections with the compiled cache so Control UI reads do not scan the full vault. Keep recovery explicit, preserve disabled automatic compilation, disclose bounded results, and fence all compilation work at plugin service shutdown. Co-authored-by: Ayaan Zaidi <[email protected]>
…#188256) Root cause: `extensions/memory-wiki/src/tool.ts:174` awaits `syncMemoryWikiImportedSources` (import, then a full compile) inside the 30 s `wiki_search` deadline, and `extensions/memory-wiki/src/gateway.ts:277` awaits the same sync before `wiki.search` with no deadline, so a large pending import fails or stalls searches for pages that are already on disk. Related: #187429, #132296, #166329 ## What Problem This Solves Fixes: `wiki_search` fails with "wiki_search timed out after 30s", and the `wiki.search` Gateway method hangs, when a large vault has source changes waiting to import and compile. The pages being searched for are already on disk. ## User Impact Searches answer from the current wiki at once while the Gateway imports and compiles in the background. Content that changed in the sources since the last refresh shows up on the next search, not this one. That one-search delay is the only staleness: pages written with `wiki_apply` are read live, and a vault with no compiled snapshot yet still answers through the existing full scan. Unchanged: `wiki_get`, `openclaw wiki search`, imports, compile, lint, apply and status still wait for the sync. `ingest.autoCompile: false` still never compiles. A caller with no running wiki service (one-shot hosts) still waits as before. ## Why This Change Was Made When the wiki service is running, `wiki_search` and `wiki.search` run the query first and then start the service-owned source sync that the Overview and Import Insights dashboards already use (#132296). That helper moves from `gateway.ts` to `source-sync.ts` as `refreshMemoryWikiImportedSources`. It still single-flights equal requests, queues on the vault mutation lock, is cancelled by the service signal and is joined at shutdown. The refresh starts after the query because a cold read owner activates through the same vault queue, so a refresh started first would block the search. The helper runs the sync with `runInDetachedAsyncContext`. Without it the built Gateway aborted every refresh after the `/tools/invoke` response with `Failed to open the plugin state database. | This operation was aborted`, so nothing was ever published. The dashboard path on main has the same defect and this fixes it too. This takes over Baumus's PR. Thanks @Baumus for finding this, carrying the fix in your own deployment since 2026.10.10 and for the real-Gateway proof (#188256 (comment)), which also found the async-scope abort. Your commits stay in the branch. The commits on top replace the refresh coordinator (60 s freshness window, 5–60 s retry backoff, retry handles), the move to the plugin service scheduler, the query hook, the README section and the test-line allocation with the existing dashboard helper. No new freshness or retry policy is needed: the next search or dashboard poll is the retry, as for dashboards today. ## Evidence The built Gateway (dist) runs in an isolated profile with a task-owned state, config and port. Requests go through `/tools/invoke` → `wiki_search` and through `openclaw gateway call wiki.search`. The importer and compiler are the real unsafe-local ones, with no mocks or delays. Fixture: a compiled vault with one `entities/cobalt.md`, then 6,000 new synthetic source files. Source `0` contains "Zirconium publication evidence." Harness and raw captures: #188256 (comment). | Run | Base 6052fff | This PR | | --- | --- | --- | | `wiki_search cobalt`, run 1 | HTTP 500 at 30.5 s, `wiki_search timed out after 30s` | HTTP 200 at 4.9 s, `entities/cobalt.md`, 0 pages imported, no new publication | | `wiki_search cobalt`, run 2 | HTTP 500 at 30.4 s, `wiki_search timed out after 30s` | HTTP 200 at 4.3 s, `entities/cobalt.md` | | `wiki_search zirconium` after publication | n/a | HTTP 200 at 8.4 s, the newly imported source page | | `wiki.search` RPC (`openclaw gateway call`), twice | no answer within 600 s; all 6,000 imported, still no publication | `entities/cobalt.md` in 8.8 s and 7.7 s; after publication `zirconium` returns the new page | Controls on this PR: - Cold vault with no compiled snapshot: answers `cobalt` in 4.3 s through the scan fallback. - Two concurrent searches plus one `wiki.overview` poll: all answer, and exactly one compile is published. - SIGTERM during the refresh: exit 0 in 2.2 s, no publication, journal unchanged after exit. - `ingest.autoCompile: false`: the search answers, all 6,000 sources import, and nothing compiles. - One-shot `openclaw wiki search zirconium`: still waits for import and compile (508 s on a loaded host) and returns the new page. - Without `runInDetachedAsyncContext`, both runs logged `background source sync failed: Failed to open the plugin state database. | This operation was aborted` and never published. Unit: `tool.deadline.test.ts` "answers from the current index while the service refreshes" fails on base with `wiki_search timed out after 30s` and passes here. Focused memory-wiki suites pass: 8 files, 95 tests. Local review on the head reports no findings. ## Merge Danger Two-way door. No config, schema, protocol or stored-data change; a revert restores the awaited sync. Blast radius: memory-wiki search through the agent tool and the `wiki.search` Gateway method while the plugin service runs. Co-authored-by: Ayaan Zaidi <[email protected]>
…#188256) Root cause: `extensions/memory-wiki/src/tool.ts:174` awaits `syncMemoryWikiImportedSources` (import, then a full compile) inside the 30 s `wiki_search` deadline, and `extensions/memory-wiki/src/gateway.ts:277` awaits the same sync before `wiki.search` with no deadline, so a large pending import fails or stalls searches for pages that are already on disk. Related: #187429, #132296, #166329 ## What Problem This Solves Fixes: `wiki_search` fails with "wiki_search timed out after 30s", and the `wiki.search` Gateway method hangs, when a large vault has source changes waiting to import and compile. The pages being searched for are already on disk. ## User Impact Searches answer from the current wiki at once while the Gateway imports and compiles in the background. Content that changed in the sources since the last refresh shows up on the next search, not this one. That one-search delay is the only staleness: pages written with `wiki_apply` are read live, and a vault with no compiled snapshot yet still answers through the existing full scan. Unchanged: `wiki_get`, `openclaw wiki search`, imports, compile, lint, apply and status still wait for the sync. `ingest.autoCompile: false` still never compiles. A caller with no running wiki service (one-shot hosts) still waits as before. ## Why This Change Was Made When the wiki service is running, `wiki_search` and `wiki.search` run the query first and then start the service-owned source sync that the Overview and Import Insights dashboards already use (#132296). That helper moves from `gateway.ts` to `source-sync.ts` as `refreshMemoryWikiImportedSources`. It still single-flights equal requests, queues on the vault mutation lock, is cancelled by the service signal and is joined at shutdown. The refresh starts after the query because a cold read owner activates through the same vault queue, so a refresh started first would block the search. The helper runs the sync with `runInDetachedAsyncContext`. Without it the built Gateway aborted every refresh after the `/tools/invoke` response with `Failed to open the plugin state database. | This operation was aborted`, so nothing was ever published. The dashboard path on main has the same defect and this fixes it too. This takes over Baumus's PR. Thanks @Baumus for finding this, carrying the fix in your own deployment since 2026.10.10 and for the real-Gateway proof (#188256 (comment)), which also found the async-scope abort. Your commits stay in the branch. The commits on top replace the refresh coordinator (60 s freshness window, 5–60 s retry backoff, retry handles), the move to the plugin service scheduler, the query hook, the README section and the test-line allocation with the existing dashboard helper. No new freshness or retry policy is needed: the next search or dashboard poll is the retry, as for dashboards today. ## Evidence The built Gateway (dist) runs in an isolated profile with a task-owned state, config and port. Requests go through `/tools/invoke` → `wiki_search` and through `openclaw gateway call wiki.search`. The importer and compiler are the real unsafe-local ones, with no mocks or delays. Fixture: a compiled vault with one `entities/cobalt.md`, then 6,000 new synthetic source files. Source `0` contains "Zirconium publication evidence." Harness and raw captures: #188256 (comment). | Run | Base 6052fff | This PR | | --- | --- | --- | | `wiki_search cobalt`, run 1 | HTTP 500 at 30.5 s, `wiki_search timed out after 30s` | HTTP 200 at 4.9 s, `entities/cobalt.md`, 0 pages imported, no new publication | | `wiki_search cobalt`, run 2 | HTTP 500 at 30.4 s, `wiki_search timed out after 30s` | HTTP 200 at 4.3 s, `entities/cobalt.md` | | `wiki_search zirconium` after publication | n/a | HTTP 200 at 8.4 s, the newly imported source page | | `wiki.search` RPC (`openclaw gateway call`), twice | no answer within 600 s; all 6,000 imported, still no publication | `entities/cobalt.md` in 8.8 s and 7.7 s; after publication `zirconium` returns the new page | Controls on this PR: - Cold vault with no compiled snapshot: answers `cobalt` in 4.3 s through the scan fallback. - Two concurrent searches plus one `wiki.overview` poll: all answer, and exactly one compile is published. - SIGTERM during the refresh: exit 0 in 2.2 s, no publication, journal unchanged after exit. - `ingest.autoCompile: false`: the search answers, all 6,000 sources import, and nothing compiles. - One-shot `openclaw wiki search zirconium`: still waits for import and compile (508 s on a loaded host) and returns the new page. - Without `runInDetachedAsyncContext`, both runs logged `background source sync failed: Failed to open the plugin state database. | This operation was aborted` and never published. Unit: `tool.deadline.test.ts` "answers from the current index while the service refreshes" fails on base with `wiki_search timed out after 30s` and passes here. Focused memory-wiki suites pass: 8 files, 95 tests. Local review on the head reports no findings. ## Merge Danger Two-way door. No config, schema, protocol or stored-data change; a revert restores the awaited sync. Blast radius: memory-wiki search through the agent tool and the `wiki.search` Gateway method while the plugin service runs. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit f9f7bf7)
…#188256) Root cause: `extensions/memory-wiki/src/tool.ts:174` awaits `syncMemoryWikiImportedSources` (import, then a full compile) inside the 30 s `wiki_search` deadline, and `extensions/memory-wiki/src/gateway.ts:277` awaits the same sync before `wiki.search` with no deadline, so a large pending import fails or stalls searches for pages that are already on disk. Related: #187429, #132296, #166329 ## What Problem This Solves Fixes: `wiki_search` fails with "wiki_search timed out after 30s", and the `wiki.search` Gateway method hangs, when a large vault has source changes waiting to import and compile. The pages being searched for are already on disk. ## User Impact Searches answer from the current wiki at once while the Gateway imports and compiles in the background. Content that changed in the sources since the last refresh shows up on the next search, not this one. That one-search delay is the only staleness: pages written with `wiki_apply` are read live, and a vault with no compiled snapshot yet still answers through the existing full scan. Unchanged: `wiki_get`, `openclaw wiki search`, imports, compile, lint, apply and status still wait for the sync. `ingest.autoCompile: false` still never compiles. A caller with no running wiki service (one-shot hosts) still waits as before. ## Why This Change Was Made When the wiki service is running, `wiki_search` and `wiki.search` run the query first and then start the service-owned source sync that the Overview and Import Insights dashboards already use (#132296). That helper moves from `gateway.ts` to `source-sync.ts` as `refreshMemoryWikiImportedSources`. It still single-flights equal requests, queues on the vault mutation lock, is cancelled by the service signal and is joined at shutdown. The refresh starts after the query because a cold read owner activates through the same vault queue, so a refresh started first would block the search. The helper runs the sync with `runInDetachedAsyncContext`. Without it the built Gateway aborted every refresh after the `/tools/invoke` response with `Failed to open the plugin state database. | This operation was aborted`, so nothing was ever published. The dashboard path on main has the same defect and this fixes it too. This takes over Baumus's PR. Thanks @Baumus for finding this, carrying the fix in your own deployment since 2026.10.10 and for the real-Gateway proof (#188256 (comment)), which also found the async-scope abort. Your commits stay in the branch. The commits on top replace the refresh coordinator (60 s freshness window, 5–60 s retry backoff, retry handles), the move to the plugin service scheduler, the query hook, the README section and the test-line allocation with the existing dashboard helper. No new freshness or retry policy is needed: the next search or dashboard poll is the retry, as for dashboards today. ## Evidence The built Gateway (dist) runs in an isolated profile with a task-owned state, config and port. Requests go through `/tools/invoke` → `wiki_search` and through `openclaw gateway call wiki.search`. The importer and compiler are the real unsafe-local ones, with no mocks or delays. Fixture: a compiled vault with one `entities/cobalt.md`, then 6,000 new synthetic source files. Source `0` contains "Zirconium publication evidence." Harness and raw captures: #188256 (comment). | Run | Base 6052fff | This PR | | --- | --- | --- | | `wiki_search cobalt`, run 1 | HTTP 500 at 30.5 s, `wiki_search timed out after 30s` | HTTP 200 at 4.9 s, `entities/cobalt.md`, 0 pages imported, no new publication | | `wiki_search cobalt`, run 2 | HTTP 500 at 30.4 s, `wiki_search timed out after 30s` | HTTP 200 at 4.3 s, `entities/cobalt.md` | | `wiki_search zirconium` after publication | n/a | HTTP 200 at 8.4 s, the newly imported source page | | `wiki.search` RPC (`openclaw gateway call`), twice | no answer within 600 s; all 6,000 imported, still no publication | `entities/cobalt.md` in 8.8 s and 7.7 s; after publication `zirconium` returns the new page | Controls on this PR: - Cold vault with no compiled snapshot: answers `cobalt` in 4.3 s through the scan fallback. - Two concurrent searches plus one `wiki.overview` poll: all answer, and exactly one compile is published. - SIGTERM during the refresh: exit 0 in 2.2 s, no publication, journal unchanged after exit. - `ingest.autoCompile: false`: the search answers, all 6,000 sources import, and nothing compiles. - One-shot `openclaw wiki search zirconium`: still waits for import and compile (508 s on a loaded host) and returns the new page. - Without `runInDetachedAsyncContext`, both runs logged `background source sync failed: Failed to open the plugin state database. | This operation was aborted` and never published. Unit: `tool.deadline.test.ts` "answers from the current index while the service refreshes" fails on base with `wiki_search timed out after 30s` and passes here. Focused memory-wiki suites pass: 8 files, 95 tests. Local review on the head reports no findings. ## Merge Danger Two-way door. No config, schema, protocol or stored-data change; a revert restores the awaited sync. Blast radius: memory-wiki search through the agent tool and the `wiki.search` Gateway method while the plugin service runs. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit f9f7bf7) Co-authored-by: RomneyDa <[email protected]>
…openclaw#188256) Root cause: `extensions/memory-wiki/src/tool.ts:174` awaits `syncMemoryWikiImportedSources` (import, then a full compile) inside the 30 s `wiki_search` deadline, and `extensions/memory-wiki/src/gateway.ts:277` awaits the same sync before `wiki.search` with no deadline, so a large pending import fails or stalls searches for pages that are already on disk. Related: openclaw#187429, openclaw#132296, openclaw#166329 ## What Problem This Solves Fixes: `wiki_search` fails with "wiki_search timed out after 30s", and the `wiki.search` Gateway method hangs, when a large vault has source changes waiting to import and compile. The pages being searched for are already on disk. ## User Impact Searches answer from the current wiki at once while the Gateway imports and compiles in the background. Content that changed in the sources since the last refresh shows up on the next search, not this one. That one-search delay is the only staleness: pages written with `wiki_apply` are read live, and a vault with no compiled snapshot yet still answers through the existing full scan. Unchanged: `wiki_get`, `openclaw wiki search`, imports, compile, lint, apply and status still wait for the sync. `ingest.autoCompile: false` still never compiles. A caller with no running wiki service (one-shot hosts) still waits as before. ## Why This Change Was Made When the wiki service is running, `wiki_search` and `wiki.search` run the query first and then start the service-owned source sync that the Overview and Import Insights dashboards already use (openclaw#132296). That helper moves from `gateway.ts` to `source-sync.ts` as `refreshMemoryWikiImportedSources`. It still single-flights equal requests, queues on the vault mutation lock, is cancelled by the service signal and is joined at shutdown. The refresh starts after the query because a cold read owner activates through the same vault queue, so a refresh started first would block the search. The helper runs the sync with `runInDetachedAsyncContext`. Without it the built Gateway aborted every refresh after the `/tools/invoke` response with `Failed to open the plugin state database. | This operation was aborted`, so nothing was ever published. The dashboard path on main has the same defect and this fixes it too. This takes over Baumus's PR. Thanks @Baumus for finding this, carrying the fix in your own deployment since 2026.10.10 and for the real-Gateway proof (openclaw#188256 (comment)), which also found the async-scope abort. Your commits stay in the branch. The commits on top replace the refresh coordinator (60 s freshness window, 5–60 s retry backoff, retry handles), the move to the plugin service scheduler, the query hook, the README section and the test-line allocation with the existing dashboard helper. No new freshness or retry policy is needed: the next search or dashboard poll is the retry, as for dashboards today. ## Evidence The built Gateway (dist) runs in an isolated profile with a task-owned state, config and port. Requests go through `/tools/invoke` → `wiki_search` and through `openclaw gateway call wiki.search`. The importer and compiler are the real unsafe-local ones, with no mocks or delays. Fixture: a compiled vault with one `entities/cobalt.md`, then 6,000 new synthetic source files. Source `0` contains "Zirconium publication evidence." Harness and raw captures: openclaw#188256 (comment). | Run | Base fa7a528 | This PR | | --- | --- | --- | | `wiki_search cobalt`, run 1 | HTTP 500 at 30.5 s, `wiki_search timed out after 30s` | HTTP 200 at 4.9 s, `entities/cobalt.md`, 0 pages imported, no new publication | | `wiki_search cobalt`, run 2 | HTTP 500 at 30.4 s, `wiki_search timed out after 30s` | HTTP 200 at 4.3 s, `entities/cobalt.md` | | `wiki_search zirconium` after publication | n/a | HTTP 200 at 8.4 s, the newly imported source page | | `wiki.search` RPC (`openclaw gateway call`), twice | no answer within 600 s; all 6,000 imported, still no publication | `entities/cobalt.md` in 8.8 s and 7.7 s; after publication `zirconium` returns the new page | Controls on this PR: - Cold vault with no compiled snapshot: answers `cobalt` in 4.3 s through the scan fallback. - Two concurrent searches plus one `wiki.overview` poll: all answer, and exactly one compile is published. - SIGTERM during the refresh: exit 0 in 2.2 s, no publication, journal unchanged after exit. - `ingest.autoCompile: false`: the search answers, all 6,000 sources import, and nothing compiles. - One-shot `openclaw wiki search zirconium`: still waits for import and compile (508 s on a loaded host) and returns the new page. - Without `runInDetachedAsyncContext`, both runs logged `background source sync failed: Failed to open the plugin state database. | This operation was aborted` and never published. Unit: `tool.deadline.test.ts` "answers from the current index while the service refreshes" fails on base with `wiki_search timed out after 30s` and passes here. Focused memory-wiki suites pass: 8 files, 95 tests. Local review on the head reports no findings. ## Merge Danger Two-way door. No config, schema, protocol or stored-data change; a revert restores the awaited sync. Blast radius: memory-wiki search through the agent tool and the `wiki.search` Gateway method while the plugin service runs. Co-authored-by: Ayaan Zaidi <[email protected]>
Fixes #132077
What Problem This Solves
The Memory Wiki dashboard RPCs read and parsed every Markdown page on each Control UI request. A 229 MB vault made both dashboard calls take about 166 seconds and blocked the operator flow.
Why This Change Was Made
The compiled-cache publication now owns the Imported Insights and Memory Wiki overview projections.
rebuilding,compile-required, orfailedstates through structured Gateway errors.ingest.autoCompile: falsenever triggers a hidden compile; the UI tells the operator to runopenclaw wiki compile.Ready dashboard response payloads are unchanged.
User Impact
Memory Wiki dashboards remain responsive on large vaults. Upgrades show a short rebuilding result and then use the new publication. Changed imports publish in the background. Operators who disable automatic compile keep that setting and receive a clear manual recovery command. A dashboard that reaches the item cap now states exactly how many items are shown and how many exist.
Evidence
The same built Control UI and isolated Gateway flow ran with 3,700 valid Markdown pages totaling 229,400,000 bytes, including 2,300 ChatGPT pages and a unique sentinel.
8cd61f02bf48fd44319486d4, warmThe upgrade and changed-import runs retained the sentinel and correct page counts. The changed-import run proved the new sentinel after publication. The disabled-auto-compile run recorded zero compile and publication events. All proof-owned Gateways, browsers, ports, and state were cleaned up.
A separate 2,501-item, 229.4 MB run returned 2,500 items with
truncated: truefrom both real Gateway methods. Imported Insights answered in 230 ms and Memory Wiki in 238 ms. Both built Control UI tabs showedShowing the newest 2,500 of 2,501 items.Concurrent health passed 72/72.A separate SIGTERM probe reached an active large-vault scan in three fresh runs and produced zero later publications. Gateway-wide drains prevented isolating the Memory Wiki abort latency and restart state, so that extra timing probe remains unverified. The owner-boundary regressions independently prove that queued manual compile stops before activation and an active scan stops at its 16 in-flight work units.
Control UI proof
Validation
812840adf85fbecause neither handler responded while source sync remained unresolved.4baa0dabe749because stopped work reactivated the vault owner, then passed on the repaired head.a77e3fbf637b, then passed on the repaired head.node scripts/run-vitest.mjspassed 205 focused Memory Wiki and Control UI tests across 12 owner and sibling files on exact headfd44319486d4; the two bounded-result tests rendered 2,500 real cards per view.main5b532a78ee1fhas no Memory Wiki or Control UI memory-owner change after the exact8cd61f02bf48red run.pnpm buildpassed, including the served Control UI bundle.Line Count
The production growth adds bounded dashboard projections plus the cache-owned availability state, required truncation contract, visible disclosure, and one service-generation fence across every compile path. The absorbing refactor moved both projections into the existing compiler, uses the platform
AbortControllerfor lifecycle closure, removed the request-time raw readers, removed the optional version-2 dashboard shape, removed the hiddenautoCompile: falsecompile path, and removed the temporary derived-write mode. The UI test split also removes the touched file's max-lines violation without a suppression.