Repository navigation
fix(memory): restore indexing during fresh agent startup - #170220
Conversation
Let explicit worker preparation borrow the creation reference already held by the canonical agent execution owner. Keep ordinary captures and absent-store reads unchanged. Cover overlapping creators, memory indexing and search, and existing V2 authority behavior.
|
🦞👀 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 changesExplicit worker preparation borrows the execution owner’s captured creation target so memory indexing can initialize alongside fresh-agent session creation. Example: Agent main starts while another creator holds its absent database target, then records a turn about a cobalt telescope.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR: it repairs a current fresh-agent indexing failure through the existing execution owner, and no actionable introduced defect was found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherMemory initialization calls the shared agent worker store, whose execution owner admits database creation and worker operations while preserving physical identity, live authority, and settlement. flowchart TD
A[Fresh agent session creation] --> C[Canonical execution owner]
B[Memory manager startup] --> D[Worker store preparation]
D --> C
C --> E[SQLite worker]
E --> F[Agent database and memory index]
F --> G[Memory search]
Technical reviewBest possible solution: Keep preparation on the canonical execution owner and land this focused repair once its normal validation gates are satisfied. Do we have a high-confidence way to reproduce the issue? The current source exposes a deterministic overlapping-creator failure, supported by the reported baseline regression; no target code was executed during this read-only review. Is this the best way to solve the issue? The repair fixes the creation-reference mismatch at the shared execution owner without weakening ordinary absence, replacement, or authorization semantics. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 31ec669615b9. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +16, Tests +94. Total +110 across 6 files. Added test files: 1. View PR surface stats
Review metrics
LabelsLabel changes: No label changes. Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 (1 earlier review cycle)
Reviewed October 12, 2026, 4:50 PM ET / 20:50 UTC (Revision 2). |
…0220) Let explicit worker preparation borrow the creation reference already held by the canonical agent database execution owner. Preserve ordinary absent-store reads and target/authority checks. Regression coverage proves overlapping creation, fresh-agent memory startup, transcript indexing and search. Live harness confirms the startup warning is gone and memory worker SQL returns; warmed turn-caused SQL/requests remain 210/47, with zero MAIN statements. Validation: 31 changed-suite tests, type-aware lint, types, source/export contracts, Madge, database ratchets, three Knip export scans, and Codex review. Landed under the approved exception for three independently proven inherited test failures, recorded in PR openclaw#170220.
What Problem This Solves
Fixes memory indexing startup on a fresh agent when session creation already holds the absent agent database's creating reference. The memory service previously logged
Originally observed agent target requires its captured creating referenceand failed to start its index.User Impact
Fresh agents can initialize memory indexing and make subsequent session turns searchable. No configuration change or migration is required.
Why This Change Was Made
Explicit worker preparation now borrows the creation reference already held by the canonical execution owner. Ordinary execution captures and absent-store reads keep their existing semantics. The old unqualified preparation capture is removed; no extra SQL, filesystem observation, owner, generation, or SDK export is introduced.
No checks are removed. The captured-target and live-authority guards protect real database replacement and revoked writes, so they remain at their existing boundaries. Gateway main-thread SQLite call sites in the touched owners remain 0 → 0.
Historical source attribution:
a17bd679979e1dc69bba795222c5dce5da750815introduced V2 worker storage;91eff279daa0d6dbf9cd44a9440355ffad9564f1adopted it for memory publication. The same deterministic overlapping-creator probe fails on both current base910a2c1b30857b3b96a456da86a1e72d69d3ebbaand supplied good revision42042df1da5d8924b0343a43e972375004b5a5a0. The supplied bisect window therefore cannot identify the latent owner defect; the later scheduling trigger remains unproven.Evidence
8f7bac24b5fe6de7a511c6b372669cdf6324cc4d(same test/error/stack, 1 failed/1 passed, 35.92 s). All three test files are unchanged here and recorded for the red-main owner. Candidate CI.9658984afe1a8e9909bc756f61e8b5de8abcb15f; harness and Knip both exited 0.One baseline/candidate pair under relaxed testing v6; each has ten warmed turns. Baseline used macOS / Node 24.21.0 / SQLite 3.53.4; candidate used an isolated Testbox checkout / Node 24.19.0 / SQLite 3.53.3. Both use shared harness v2 causal accounting. The local copy only adjusted fixture location and startup readiness; the candidate used the unchanged shared harness. Host/runtime differences limit wall-clock and background-window comparisons; no speedup is claimed.
Restored memory work is background-attributed by the harness. Its mean SQL per warmed window-turn is: publication 2.4, source-index maintenance 2.4, embedding cache 1.7, chunk writes 1.6, vector writes 1.0, search/retrieval 1.5, and source-state reads 0.3. Each was zero on the failing baseline. Restoring this work is the intended product correction, not a query regression. Turn-caused mean statements/requests are 211.7/47.9 → 210.6/47.6; all-window means are 245.5/59.6 → 246.5/59.0.
Proof-tool recovery: local candidate connection failed before turns at the existing 15-second handshake deadline; its startup already showed restored memory publication. Two local Knip scans timed out under host load. An initial Testbox expired during local source staging before executing code. Native Testbox provisioning, an isolated checkout of the pushed SHA, and frozen-lockfile installation completed the missing live proof and all Knip scans. No product timeout, guard, or baseline was changed to obtain a pass.
Landing uses the authorized head-pinned squash route and the independently evidenced inherited-test exception. The three inherited failures have been handed to the red-main repair owner.