Repository navigation
fix(memory): prevent dirty-index maintenance from delaying searches - #139230
Conversation
Signed-off-by: Barry-886 <[email protected]>
|
🦞👀 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: needs maintainer review before merge. What this changesMoves resident memory reconciliation to the existing recovery timer and refreshes standalone CLI searches before retrieval. Example: Search memory/seed.md repeatedly while memory/missed.md awaits indexing.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it addresses dirty-search reconciliation still present on current main, preserves CLI freshness, and has no actionable findings in the reviewed head. Priority: P1 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherMemory Core receives tool, Gateway, and CLI queries, reads a published index, and uses watcher and timer maintenance to publish updated memory and transcript sources. flowchart LR
A[Tool and Gateway searches] --> B[Resident memory manager]
C[Standalone CLI search] --> D[Refresh sources]
D --> E[Published index]
B --> E
F[Watchers and recovery timer] --> G[Existing maintenance owner]
G --> E
E --> H[Results and freshness guidance]
Technical reviewBest possible solution: Retain this focused repair using the existing maintenance and timer owners, with published resident reads and fresh one-shot CLI reads. Do we have a high-confidence way to reproduce the issue? Current main visibly schedules maintenance from dirty searches, matching the linked report and supplied baseline trace; this read-only review ran no target code. Is this the best way to solve the issue? The change fixes the scheduling boundary using existing owners, removes the replaced search path, and preserves bootstrap, identity repair, retry custody, and CLI freshness. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 5382559b66da. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource -1, Tests -18, Docs +7. Total -12 across 24 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (8 earlier review cycles)
Reviewed November 5, 2026, 5:28 AM ET / 10:28 UTC (Revision 9). |
Signed-off-by: Barry-886 <[email protected]>
Signed-off-by: Barry-886 <[email protected]>
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…penclaw#139230) * fix(memory): prevent dirty-index maintenance from delaying searches Signed-off-by: Barry-886 <[email protected]> * fix(memory): preserve CLI freshness and cheap sweep status Signed-off-by: Barry-886 <[email protected]> * docs(memory): explain resident and CLI freshness Signed-off-by: Barry-886 <[email protected]> * test(memory): exercise deadline recovery and owned timer teardown * test(memory): name the scoped bootstrap spy binding * test(memory): restore the bootstrap spy explicitly * fix(memory): preserve recovery retries and resident RPC ownership * fix(memory): preserve scoped recovery guidance and error details * test(memory): align recovery fixtures with resident ownership * test(memory): exercise cooldowns through recovery owners * fix(memory): preserve CLI search admission failures --------- Signed-off-by: Barry-886 <[email protected]> Co-authored-by: Barry-886 <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
Fixes #137366
What Problem This Solves
A dirty resident memory index made interactive searches start source-wide reconciliation, competing with retrieval even when a usable published index already existed.
User Impact
Resident searches use the published index without launching ordinary or full-retry reconciliation. Pending updates remain visible through the existing stale-result fields. Watcher updates continue normally, and the existing idle-indexing timer now provides five-minute recovery for missed events, including during a running turn. Standalone CLI searches refresh sources before reading.
There are no new configuration options, schema changes, or index-format changes. Existing indexes remain usable after updating; no manual migration is required. Empty-index bootstrap and required identity repair retain their existing behavior. Provider failures and full-rebuild cooldowns can delay successful publication: the five-minute deadline bounds admission of recovery, not completion under an unavailable provider.
Why This Change Was Made
Recovery reuses the session indexing owner's existing
SESSION_MAX_DEFERRAL_MSand timer, plus the existing detached maintenance operation. Activity cannot move its recovery deadline. Ordinary session work still prefers idle periods. CLI freshness uses the automaticcli-searchsync path, preserving format-repair notices and embedding fallback custody; its redundant pre-search diagnostic scan is removed. Legacy Gateway RPC searches borrow the service-owned resident manager, while the explicit CLI owner RPC keeps its transient lifecycle. Recovery shares the existing retry settlement and cooldowns. Pending-update guidance uses the existing agent-scoped repair formatter and cost disclosure; timer failures retain nested diagnostic details. Teardown joins admitted recovery and closes the existing timer and watcher resources.This incorporates @Barry-886's original separation of resident retrieval and reconciliation into the current maintenance owners. All three contributor commits are preserved; current main was merged into the branch without rebasing or force-pushing.
Production: +101/-102 lines (net -1). Tests/support: +282/-300 (net -18). Documentation: +15/-8.
Evidence
nomic-embed-text: five dirty searches started one source-wide pass on main and zero on the candidate. On the final head, the legacymemory.searchRPC returned in 2.485 s including a new CLI connection. Five tool reads then took 210 ms followed by 29–36 ms, all reporting pending updates and starting zero source-wide syncs. These are a small synthetic functional workload, not a benchmark of the reporter's large Linux corpus.qwen2.5:7banswer,RECOVERY-PROOF-OK. Gateway process teardown took 430 ms and the listener closed.pnpm buildpassed in 2m 29.4s; UI budget warnings match the main baseline. Scoped memory typecheck, scoped lint/format, and all baseline ratchets pass, including line cap and a shrinking test-line budget. A broader local extension typecheck hits an unrelated missing@openclaw/crabbox-provider/cli-runtime-api.jsdeclaration. Prompt snapshots regenerate unchanged (token delta 0).af7ea2ba51a906fe2e6e2dd6b7ad0ba101ba1a83to headfb9eb894586c1eab9fff184682392c4836915394, with source/sync/recovery/registry context: scoped-clean, no actionable P0–P2 findings.Recorded trace of the final scheduling implementation (native Gateway, SQLite, shared Ollama; synthetic notes):
The later error-handling and fixture repairs reuse this scheduling evidence because they do not change timer scheduling, source publication, or cleanup. With the final production bytes, real CLI searches preserved both newer chunking and provenance metadata, chunk counts, and index revisions (3.217 s and 3.231 s). An older provenance index then repaired successfully and retained the automatic-repair/provider-cost notice (3.873 s).
Platform limitation: this repair has native macOS proof; the reporter's full-size Linux workload and native Windows were not rerun. CI and advisory review are tracked against the pushed head.
The five-minute timing proof reuses the unchanged scheduling implementation; the final Gateway/CLI compatibility proof was repeated on
fb9eb894586c1eab9fff184682392c4836915394after the admission-error repair.Final exact-head CI run 42010254552 passed: 48 successful jobs, 28 intentionally skipped, including all three PostgreSQL conformance shards and
openclaw/ci-gate. ClawSweeper reviewed this head with no actionable findings or before-merge items; local Codex review is also scoped-clean at P0–P2.