mirror of
https://github.com/bitbaum/openclaw.git
synced 2026-12-04 04:07:14 +01:00
* fix(memory): bound the embedding cache with a built-in default
`memory_embedding_cache` grows without limit. The LRU that this issue asks
for already exists: `pruneEmbeddingCacheIfNeeded` implements it fully. It is
simply unreachable, because `DEFAULT_CACHE_MAX_ENTRIES` is `undefined`, so the
`if (!max || max <= 0) return` guard fires on every call.
783a5d21cf (#111382, "purge numeric tuning knobs behind built-in defaults")
replaced the operator knob with a named default but never chose a value:
- maxEntries: overrides?.cache?.maxEntries ?? defaults?.cache?.maxEntries,
+ maxEntries: DEFAULT_CACHE_MAX_ENTRIES,
+ const DEFAULT_CACHE_MAX_ENTRIES = undefined;
Operators could cap the cache before that commit and cannot after it;
`memory.search.cache.maxEntries` is now rejected by config validation
(src/config/dead-config-keys.test.ts:122), so no setting restores it.
Give the default a value, at the config owner, finishing #111382's stated
intent rather than re-adding config surface. 50_000 stays above observed live
chunk counts (25,897 and 38,985 in openclaw/openclaw#114612); a cap below the
working set would evict rows the next sync needs and force paid re-embedding.
Refs: #114612
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(memory): enforce the embedding cache bound on every sync
The default cap only took effect during a full reindex. `pruneEmbeddingCacheIfNeeded`
was called from inside `runInPlaceReindex`'s shadow rebuild, so it bounded the
temporary rebuild database and never the live one. The incremental branches of
`runSync` — `syncMemoryFiles`, `syncArchiveFiles`, and `executeSourceWideSync` —
insert cache rows and return without pruning, leaving long-running databases
unbounded between full rebuilds and never shrinking an already-oversized cache.
Move enforcement to `runSync`, the lifecycle that owns every cache-writing path,
and drop the shadow-only call so there is one canonical enforcement point.
Regression test drives `runSync` down the incremental path and asserts the prune
runs; on pre-fix code it observes zero prunes.
Refs: #114612
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(memory): bound the cache on every sync exit, not one branch
The previous commit moved pruning out of the reindex shadow rebuild into the
incremental branch of runSync, which left two exits unbounded and removed the
only enforcement the reindex path had:
- `if (targetedSessionSync.handled) return` exits before the try block.
- `if (needsFullReindex) { await runInPlaceReindex(...); return }` returns
before the incremental code, and its shadow-side prune was deleted.
Split runSync into a thin wrapper and runSyncPass, with the prune in a finally
so every exit — early return, fall-through, or throw — bounds the cache exactly
once. Regression tests cover the incremental and targeted-session paths plus an
aborted pass; all three observe zero prunes on pre-fix code.
Extract the harness into manager-sync-ops.startup-catchup.test-support.ts: the
added cases pushed the test file past the 1000-line lint cap, and the rule is to
split rather than suppress. The module-scoped transcript listener becomes
resetTranscriptUpdateListener() because ESM importers cannot reassign a binding.
Refs: #114612
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* chore: retrigger CI
Run 33113993800 failed 63 checks at the 'Setup Node environment' step, before
any repo code was checked out or executed. Sampled across check-lint,
check-prod-types, check-additional-boundaries-a,
check-bundled-channel-config-metadata, check-export-name-collisions, and the
changed-extensions-config and compact-small shards: every failure names that
same step. No test ever ran.
Empty commit to start a clean run on healthy runners.
* fix(memory): type the cache-bound sync table instead of `as const`
`check-test-types` failed: `as const` on the it.each table made the entries
deeply readonly, and `MemorySyncParams.sessions` is a mutable
`MemorySessionSyncTarget[]`.
error TS2345: Type 'readonly [{ readonly agentId: "main"; ... }]' is
'readonly' and cannot be assigned to the mutable type
'MemorySessionSyncTarget[]'
Declare the table as `Array<[string, MemorySyncParams]>` so the params are
checked against the real contract rather than widened by assertion.
Reproduced and verified with
`node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.extensions.test.json`.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* chore(memory): clarify cache pruning owner
---------
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: Patrick Erichsen <patrick.a.erichsen@gmail.com>