Repository navigation
fix(memory): preserve newer indexes and disclose automatic rebuild costs - #146908
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 13, 2026, 6:25 AM ET / 10:25 UTC (Revision 2). ClawSweeper reviewWhat this changesMemory Core preserves newer-format indexes during automatic synchronization and carries rebuild-cost warnings through CLI, Gateway, and agent-tool search results. Merge readiness⛔ Blocked before merge - 2 items remain This remains necessary: current main still treats newer indexes as eligible for automatic repair. No actionable introduced defect was found, and verified maintainer status exempts this PR from the prior external-contributor proof gate. Priority: P2 Review scores
Verification
How this fits togetherMemory Core indexes memory files and eligible session content for retrieval. Its manager checks stored index compatibility, coordinates rebuilding, and supplies results or recovery guidance to search callers. flowchart TD
A[Search request] --> B[Check stored index format]
B --> C[Older or missing format]
B --> D[Newer format]
B --> E[Compatible format]
C --> F[Existing rebuild writer]
F --> G[Results and repair notice]
E --> G
D --> H[Pause with recovery guidance]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +149, Tests +439, Docs +2. Total +590 across 22 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the maintainer-confirmed rollback policy, with one classifier protecting newer indexes and the existing writer repairing older indexes while callers disclose costs. Do we have a high-confidence way to reproduce the issue? Yes, from source: a stored format version above the runtime version is classified as mismatched on current main and admitted to automatic repair. This review did not execute that path. Is this the best way to solve the issue? Yes. The patch keeps version ordering in the existing classifier, enforces it at the writer, and reuses existing warning fields without changing stored schemas or search parameters. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2908c7e8d26c. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
landpr-approve-admin-merge |
|
Thanks @obviyus! Proof: Command-line, Gateway, and Telegram searches preserve newer indexes and report recovery advice. Older indexes rebuild once with cost disclosure; 311 focused tests pass.
|
* refs/heads/temp/pr-146833: (43 commits) fix(memory): preserve newer indexes and disclose automatic rebuild costs (#146908) fix: retain route ownership while discovering conversations (#146927) refactor: reuse plugin fixture shell runner (#146920) fix(worker): stop preparing disabled live previews (#146896) fix(runtime): support Bun across tooling suite (#146807) chore(i18n): refresh native locales (#146924) perf(secrets): limit expiry metadata to transient credentials (#146882) fix(ui): preserve queued refreshes during session discovery (#146535) test(ui): wait for quiet scrolling and close named file tabs (#146836) fix(ui): prevent Usage hour filters from freezing during DST (#146919) test(ui): share browser page cleanup across layout fixtures (#146805) ci: balance complete PR runtime test groups (#146916) improve(infra): reduce scheduling work for session notice bursts (#146818) improve: prepare Gateway skill commands asynchronously (#146812) improve(agents): skip unused assistant delivery parsing (#146858) improve(ui): reuse date formatters across timestamp lists (#146789) fix(tests): isolate installer and Docker shell snippets (#146897) test(heartbeat): share explicit channel configuration fixtures (#146853) fix: retain conversation reply claims through write admission (#146866) perf(sessions): bound history reads and stabilize cursor paging (#146770) ...
* temp/pr-146802: (51 commits) improve: reduce worktree filesystem stalls and archive syncs (#146906) fix(ui): avoid extra chat rail work while replies stream (#146883) improve(ui): speed up populated Usage timelines (#146947) test(gateway): retain auth recovery failure diagnostics (#146925) fix(tests): create private temporary home directories (#146931) fix(backup): preserve discovery under concurrent state writes (#146912) fix: keep queued deliveries in their original state directory (#146917) fix(discord): settle voice waveform work before releasing input (#146885) fix(memory): preserve newer indexes and disclose automatic rebuild costs (#146908) fix: retain route ownership while discovering conversations (#146927) refactor: reuse plugin fixture shell runner (#146920) fix(worker): stop preparing disabled live previews (#146896) fix(runtime): support Bun across tooling suite (#146807) chore(i18n): refresh native locales (#146924) perf(secrets): limit expiry metadata to transient credentials (#146882) fix(ui): preserve queued refreshes during session discovery (#146535) test(ui): wait for quiet scrolling and close named file tabs (#146836) fix(ui): prevent Usage hour filters from freezing during DST (#146919) test(ui): share browser page cleanup across layout fixtures (#146805) ci: balance complete PR runtime test groups (#146916) ...
…sts (openclaw#146908) ## What Problem This Solves After a rollback, an ordinary memory search could rebuild an index written by a newer OpenClaw and call the embedding provider without disclosing possible cost. This corrects a regression introduced by openclaw#146713. AI-assisted. ## Why This Change Was Made Newer versions take precedence over older versions when checking the index. Automatic synchronization preserves newer indexes; explicit reindex remains available. ## User Impact After an OpenClaw index-format upgrade, the first search can rebuild an older index before returning results. Rebuilding can take longer and can incur costs from the configured embedding provider. An index written by a newer OpenClaw remains paused; upgrade OpenClaw or reindex explicitly. Later searches reuse the repaired index. Status inspection alone does not rebuild it. A search that requests a rebuild retains the existing provider-cost disclosure, including on retrieval failure or timeout. ## Evidence Real CLI runs with two declared runtime-format fixtures reproduced a rebuild on every version switch before this change. On the candidate, the upgrade rebuilt once, rollback made no embedding requests, and switching forward reused the preserved index. These fixtures exercise the real CLI; they are not two separately installed released versions. Live Gateway searches cover older, current, newer, and mixed stored versions. The retained 2026.7.1-2 state repairs once after current Doctor prepares a copy. Three later searches return known facts without re-embedding documents. Recording providers establish requests, not billed cost. This is search compatibility proof, not an old-updater rerun. ## Compatibility No schema, configuration, protocol, or public SDK changes. Production code grows to carry repair notices through existing response and error fields without changing the search API. ## Consumers The classifier serves search admission, the synchronization writer, and status identity. CLI, Gateway, and tool results consume the existing diagnostic formatter. Deep status has its own recovery text. Search can also hand retry work to a separate maintenance manager, so disclosure must cross that handoff. Active Memory preserves successful-search warnings separately from failure state. ## Invalidation The decision `whether a runtime index is older or newer` is made by exactly one mechanism at `extensions/memory-core/src/memory/manager-reindex-state.ts:153`. The existing writer lease rechecks identity. Successful repair refreshes the existing index generation; notices apply only to searches that observe a repair request. ## Contention Concurrent searches share one rebuild and each receives its disclosure. The existing writer and publication leases are unchanged. ## Tests The retained candidate run passes 69 focused memory tests. A separate Gateway run passes 17 tests. The original-source tool regression run reports 10 failures and two current-version passes. The accepted merge `ed397080e63c06374724c1e4f5b41911edb38d85` now has 311 distinct passing tests: 281 memory/CLI, 13 diagnostics, and 17 Gateway tests. One CLI assertion initially saw forced ANSI colors; the complete CLI file passed with `FORCE_COLOR=0 NO_COLOR=1` on the same unchanged merge. No assertion, source behavior, or timeout was weakened. <details> <summary>Test commands on the accepted merge</summary> ```sh OPENCLAW_E2E_USE_PREBUILT_DIST=1 node node_modules/vitest/vitest.mjs run --config test/vitest/vitest.extension-memory.config.ts extensions/memory-core/src/tools.index-upgrade.test.ts extensions/memory-core/src/tools.index-diagnostic.test.ts extensions/memory-core/src/tools.real-manager.test.ts extensions/memory-core/src/cli.test.ts extensions/memory-core/src/memory/manager-search-upgrade.test.ts extensions/memory-core/src/memory/manager-reindex-state.test.ts extensions/memory-core/src/memory/manager-search.test.ts extensions/memory-core/src/memory/manager.reindex-recovery.test.ts FORCE_COLOR=0 NO_COLOR=1 OPENCLAW_E2E_USE_PREBUILT_DIST=1 node node_modules/vitest/vitest.mjs run --config test/vitest/vitest.extension-memory.config.ts extensions/memory-core/src/cli.test.ts FORCE_COLOR=0 NO_COLOR=1 OPENCLAW_E2E_USE_PREBUILT_DIST=1 node node_modules/vitest/vitest.mjs run --config test/vitest/vitest.unit-fast.config.ts packages/memory-host-sdk/src/host/types.test.ts FORCE_COLOR=0 NO_COLOR=1 OPENCLAW_E2E_USE_PREBUILT_DIST=1 node node_modules/vitest/vitest.mjs run --config test/vitest/vitest.gateway-methods.config.ts src/gateway/server-methods/memory-search.test.ts ``` </details> ## Test movement The former keyword-only provenance table moved to a recording-provider version matrix. Path, citation, revision, and repeat-search outcomes remain covered. The former zero-query assertion for older/missing keyword-only indexes is not part of that new provider matrix; keyword-only repair is also covered by the real Gateway case and existing tool cases. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
After a rollback, an ordinary memory search could rebuild an index written by a newer OpenClaw and call the embedding provider without disclosing possible cost.
This corrects a regression introduced by #146713. AI-assisted.
Why This Change Was Made
Newer versions take precedence over older versions when checking the index. Automatic synchronization preserves newer indexes; explicit reindex remains available.
User Impact
After an OpenClaw index-format upgrade, the first search can rebuild an older
index before returning results. Rebuilding can take longer and can incur costs
from the configured embedding provider. An index written by a newer OpenClaw
remains paused; upgrade OpenClaw or reindex explicitly. Later searches reuse the
repaired index. Status inspection alone does not rebuild it.
A search that requests a rebuild retains the existing provider-cost disclosure, including on retrieval failure or timeout.
Evidence
Real CLI runs with two declared runtime-format fixtures reproduced a rebuild on every version switch before this change. On the candidate, the upgrade rebuilt once, rollback made no embedding requests, and switching forward reused the preserved index. These fixtures exercise the real CLI; they are not two separately installed released versions.
Live Gateway searches cover older, current, newer, and mixed stored versions. The retained 2026.7.1-2 state repairs once after current Doctor prepares a copy. Three later searches return known facts without re-embedding documents. Recording providers establish requests, not billed cost. This is search compatibility proof, not an old-updater rerun.
Compatibility
No schema, configuration, protocol, or public SDK changes. Production code grows to carry repair notices through existing response and error fields without changing the search API.
Consumers
The classifier serves search admission, the synchronization writer, and status identity. CLI, Gateway, and tool results consume the existing diagnostic formatter. Deep status has its own recovery text. Search can also hand retry work to a separate maintenance manager, so disclosure must cross that handoff. Active Memory preserves successful-search warnings separately from failure state.
Invalidation
The decision
whether a runtime index is older or neweris made by exactly one mechanism atextensions/memory-core/src/memory/manager-reindex-state.ts:153.The existing writer lease rechecks identity. Successful repair refreshes the existing index generation; notices apply only to searches that observe a repair request.
Contention
Concurrent searches share one rebuild and each receives its disclosure. The existing writer and publication leases are unchanged.
Tests
The retained candidate run passes 69 focused memory tests. A separate Gateway run passes 17 tests. The original-source tool regression run reports 10 failures and two current-version passes. The accepted merge
ed397080e63c06374724c1e4f5b41911edb38d85now has 311 distinct passing tests: 281 memory/CLI, 13 diagnostics, and 17 Gateway tests. One CLI assertion initially saw forced ANSI colors; the complete CLI file passed withFORCE_COLOR=0 NO_COLOR=1on the same unchanged merge. No assertion, source behavior, or timeout was weakened.Test commands on the accepted merge
Test movement
The former keyword-only provenance table moved to a recording-provider version matrix. Path, citation, revision, and repeat-search outcomes remain covered. The former zero-query assertion for older/missing keyword-only indexes is not part of that new provider matrix; keyword-only repair is also covered by the real Gateway case and existing tool cases.