Skip to content

perf(memory): reuse generated search schema admission facts - #174438

Merged
steipete merged 6 commits into
mainfrom
dbasync/memschema
Oct 16, 2026
Merged

steipete merged 6 commits into
mainfrom
dbasync/memschema

Conversation

@steipete

@steipete steipete commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Memory search admission repeatedly inspects individual FTS objects and replays already installed DDL. Vector admission also repeats a table-existence read after the memory owner has already read that fact.

User Impact

Memory indexing and search keep their existing tokenizer, search results, and dimension-change rebuild behavior. Admission does less database work. There is no schema-version bump or required user action.

Why This Change Was Made

Route memory's named text and vector extensions through admitStoreSearch. Add the four FTS variants and one vec0 template to the existing hash-first SQLite catalog generator. Runtime admission compares native catalog facts against those fingerprints; it computes the dimension-dependent vec0 declaration without replaying expected DDL. Successful vector creation publishes its schema receipt directly, and owner DDL invalidates that receipt.

FTS body and path admission share one catalog snapshot and savepoint. Matching indexes retain their maintenance triggers without replaying CREATE statements. Existing collision protection, rowid reconciliation, tokenizer rebuilds, and canonical source updates remain covered by regression tests.

Removed work and accepted edge cases:

  • Reuse readMemoryDatabaseFacts().hasVectorTable instead of querying table existence again. Uncoordinated external writes are outside the single-owner contract.
  • Replace individual trigger-presence reads and unconditional CREATE statements with the one admitted catalog snapshot. Equivalent hand-edited derived DDL can be rebuilt at next admission.
  • Reuse the successful vec0 CREATE receipt instead of rereading the new table. Owner DDL invalidates it; foreign edits require an offline reopen.

The PostgreSQL memory search definitions and PostgreSQL admission branch are unchanged. The generated memory assets remain SQLite catalog data only; PostgreSQL memory DDL continues to come from its existing owner.

Measurements

Values are median [min–max], with three runs per side; warm rows pool 30 turns per side. Memory admission counts cover the complete worker requests that contain schema admission.

Memory operation Base SQL Candidate SQL Requests, base → candidate
First use: boot + connect + first turn 155 [155–155] 147 [147–147] 2 → 2
Restart: boot + connect + first turn 13 [13–13] 13 [13–13] 1 → 1
Boot alone, initial and restart 0 [0–0] 0 [0–0] 0 → 0
First vector creation 11 [11–11] 11 [11–11] 1 → 1
Cold existing-vector admission 1 [1–1] 6 [6–6] 1 → 1
Following vector publication write 17 [17–17] 17 [17–17] 1 → 1

The narrower ensureMemoryIndexSchema work falls 132 → 124 statements; its FTS work falls 38 → 30. These are overlapping subsets of the first-use row. Cold vector admission adds five native catalog statements inside the same existing request. Creation and the following publication write are byte-identical. The net measured subsystem change is −3 statements / 0 requests. The vector comparison aligns actual request executions because the new function names tag existing requests that the baseline did not label as vector admission.

Workload Base SQL / requests / MAIN Candidate SQL / requests / MAIN
Warmed causal 70 [70–76] / 23 [23–25] / 0 70 [70–76] / 23 [23–25] / 0
Warmed raw 70 [70–96] / 23 [23–28] / 0 [0–4] 70 [70–103] / 23 [23–29] / 0 [0–8]
Combined startup 1359 [1356–1373] / 258 [258–264] / 114 [113–118] 1348 [1344–1367] / 256 [256–258] / 113 [110–117]
Combined restart 817 [815–824] / 227 [225–231] / 93 817 [770–818] / 227 [225–228] / 93
Whole workload 4049 [4039–4050] / 1042 [1038–1046] / 229 [228–229] 4046 [4023–4049] / 1041 [1041–1044] / 229 [228–229]

Raw first-turn medians are 861 [744–895] → 868 [698–920] SQL and 152 [146–158] → 151 [142–153] requests. The combined startup and whole-workload totals decrease. In C2, one 71-statement admission request ran during connect and the remaining 76 during first turn; the other candidate runs performed all 147 during first turn. The combined admission window avoids treating this phase movement as a saving. The SQL-median runs (M1 and C3) differ by −8 memory-schema statements, +12 other background statements, and +3 turn reads. Those three reads (canonical_ready, quarantine user_version, and its decision) already occur in baseline M2/M3 and remain within the same 62 turn requests. First-turn causal work stays at median 219 SQL / 62 requests / 0 MAIN. Whole-workload request movement is not attributed to this change.

No memory-schema work executes in warm turns. Raw warm background differences come from existing leases, configuration/catalog work, passive WAL checkpoints, and monitoring; raw MAIN outliers are existing state-lease reads. All five monitored shared-read families are zero in every causal warmed turn. Their whole-workload distributions are retained below rather than called identical:

Shared-read family Base SQL / requests Candidate SQL / requests
Exact-entry facts 29 / 29 29 / 29
Actor hydration 13 / 6 13 / 6
Entry-cache snapshot 23 [22–23] / 13 21 [21–23] / 12 [12–13]
Row facts 10 [10–12] / 4 [4–5] 12 [10–12] / 5 [4–5]
Watermarks 4 / 3 4 / 3

The row-fact increase is in second-session activity, offset at the median by fewer entry-cache snapshot reads. Both row-fact variants occur on both sides (M2 has the higher count; C2 has the lower count). No shared-family warmed increase is hidden in the total.

Evidence

  • Focused tests: 23 STRICT, 148 generated/native equivalence, 12 memory fragment, 15 FTS reconciliation, 6 search-extension, 25 memory-schema, 9 schema-admission, 2 publication/restart, and 3 agent-port cases pass.
  • Codex autoreview: two completed rounds. The memory change has no actionable P0–P2 findings; the later Matrix fixture-only correction has no actionable P0/P1 findings and was subsequently superseded by main's canonical fixture repair.
  • pnpm db:postgres:gen passes. It changes only the SQLite memory catalogs; there are no PostgreSQL DDL changes. pnpm db:postgres:check also passes (generator tests, equivalence tests, and canonical/workboard/logbook deterministic verification).
  • Three alternating harness-v3 pairs complete in M,C,M,C,M,C order on frozen base ec90dc1ef23dd9c9dd731479b4431d9b082b78d5 and candidate a18f1a2c4daa885d880542f43e0503388cc1841d. Pre-integration head e43d20b3045c7dc4f6e9ddca2bc290e5b54ba6bc adds only comments/annotations and wrapper inventory entries; executable source is unchanged. All 84 turns and 12 shutdowns pass; no native SQL/prepare errors, missing dispatch records, or remaining fixture children. Node, SQLite, native-library and harness pins match across all six runs. Independent review checks all 25,864 aggregate distributions against the individual ledgers.
  • P3-5a capture workload: both 23-check audits pass; all 44 output phases are byte-identical. The capture has 849 → 834 execution records. All 59 changed records were individually reviewed: 42 savepoint boundaries and 17 catalog reads; the remaining 812 records are byte-identical in order. No search, write, or DDL records changed. Runtime/native-library/script pins, vector-edge, and subprocess comparisons pass. Full SQL byte identity is intentionally not claimed.
  • SDK API diff passes with no public API changes. All declaration sections are byte-identical; only the implementation source path of admitStoreSearch moves from adapters.ts to search-admission.ts.
  • Published-driver update run 38936333046 stopped before execution: package integrity found the existing missing dist/windows-security-helper.exe references in the two sealed updater runtimes. All 13 scanner, build, staging, manifest, and lock inputs are identical on this base, candidate, final head, and the main-rule reproduction at 07667dcc8f4d. This is reused exact-main-rule evidence over existing generated artifacts, not a fresh main tarball or an executed update. The package/build and handoff staging failure is already routed to its owners. No retry was made.
  • T1 inventory: changed area 0 → 0; global T1 222 → 222, worker sites 1337 → 1337. No memory-schema SQL executes on MAIN in any measured phase. No latency claim is made.
  • Targeted type-aware lint and git diff --check pass. Pre-integration CI passes on e43d20b3045c7dc4f6e9ddca2bc290e5b54ba6bc, including PostgreSQL conformance, production/test types, lint, source contracts, Madge, and the T1/dialect/worker ratchets. Knip reproduces exactly the base’s 3 production / 4 full-tree / 0 scripts findings in unchanged agent, Gateway, and Discord files; none are in this change, and the findings are already routed for repair.
  • LOC: production +417/−192 (net +225); tests +278/−28 (net +250); generator +26; generated assets +55/−1; wrapper inventory +5. The expression-parser and separate ensure paths are removed.

Database-engine owner clearance is complete. Integration head 0dcdd6c7d3f1e06c980b90099bced2f845e8ee5d merges main 0e16643538c1e41ec0d22990738749d2413055c5; the only conflict was the generator import block, resolved by keeping both client-credential and memory-search imports. Main's database-engine behavior and both wrapper inventory additions are preserved.

Published-driver update cell: waived by the maintainer for this forward-only admission change. The inherited Windows-helper packaging blocker above remains documented; this PR does not modify the updater, activation, or Doctor flow. No executed-update claim is made.

Integration proof and review follow-ups

The first integration rerun passes all 193 requested owner cases: search-extension 6, memory fragments 12, agent-port 3, generated/native catalog equivalence 149, and STRICT 23. PostgreSQL generation and check both pass; generation leaves the working tree unchanged, and this slice introduces no PostgreSQL DDL changes.

Integration CI ran PostgreSQL conformance. Its memory/search cases passed, but three Matrix portability cases failed because the fixture expected fresh roots to require legacy repair. While the test-only correction was being reviewed, main landed 682eb8ce748, which seeds actual legacy dedupe rows before expecting refusal. Final head d29e3b5342090a4e740d88acd5449d374128bb36 keeps that Matrix test exactly as main, superseding the local correction. The Matrix file is absent from the final PR diff. All port, backup, resume, rollback, retained-byte and startup-refusal assertions remain. The merge also preserves R19's PostgreSQL search changes; no design conflict occurred. Final CI run 38957102456 passes on d29e3b5342090a4e740d88acd5449d374128bb36. PostgreSQL conformance actually ran and passed (job 117163171456); it was not path-skipped. The aggregate openclaw/ci-gate, production/test types, lint, source contracts, architecture checks, and baseline ratchets all pass. No CI failure override is used. Final pnpm db:postgres:gen and pnpm db:postgres:check both pass; generation leaves the tree unchanged and there are no PostgreSQL DDL changes in this PR.

The coordinator-requested single M,C confirmation pair completed on main 0e16643538c1e41ec0d22990738749d2413055c5 versus integration 0dcdd6c7d3f1e06c980b90099bced2f845e8ee5d. All 17 source/generator/generated/test files in the final PR delta are byte-identical to that candidate; only the wrapper inventory incorporates later main entries. The final integration preserves the incoming PostgreSQL behavior, which final CI covers. No extra harness pair was run.

Confirmation pair Base Candidate
First-use memory SQL / requests 155 / 2 147 / 2
Restart memory SQL / requests 13 / 1 13 / 1
Initial/restart boot memory SQL / requests 0 / 0 0 / 0
Warm causal SQL / requests / MAIN, median [min–max] 68.5 [67–73] / 22.5 [22–24] / 0 68.5 [67–73] / 22.5 [22–24] / 0
Warm raw SQL / requests / MAIN, median [min–max] 69 [67–94] / 23 [22–27] / 0 [0–4] 69 [67–99] / 22.5 [22–28] / 0 [0–4]
Raw combined initial boot/connect/first-turn SQL / requests / MAIN 1348 / 264 / 101 1339 / 257 / 102
Raw combined restart SQL / requests / MAIN 754 / 214 / 82 795 / 221 / 82
Whole raw SQL / requests / MAIN 3876 / 1022 / 205 3938 / 1027 / 206

All ten causal warm arrays match exactly. Current main's session batching lowers the median from the earlier 70/23; the 67→70 variation is one versus two trajectory-event transaction batches. No memory admission or monitored shared-read family executes in warm turns. Cold vector admission remains 1→6 SQL in the same request; first creation 11→11 and subsequent write 17→17 remain byte-identical. Net attributed subsystem change remains −3 SQL / 0 requests.

All 28 turns and four shutdowns pass, with zero native errors or missing dispatch and matching runtime/library/workload pins. All 34 ledger audit checks pass. The rebase capture again has all 44 outputs byte-identical, the exact same 59 individually reviewed catalog/savepoint differences, and 812 remaining ordered records byte-identical. Its original full-SQL comparator result is preserved; full SQL identity is not claimed.

The raw +62 SQL/+5 requests are retained and reconciled: −3 memory, +34/+1 from one extra restart transcript-projection maintenance request, +12/0 passive WAL checkpoints, +1/0 busy-timeout adjustment, and +18/+4 net unchanged lifecycle maintenance/admission/batching. The last group includes registry maintenance, cron polling/ticks, quarantine health reads, worker placement, and upstream monitoring. Causal first-turn work rises by two existing worker-admission statements (user_version and quarantine) in the same request; all warmed causal work is identical. These are source-attributed execution differences, not excluded records or a whole-workload saving claim. No latency claim.

Two subsequent automated review suggestions are recorded as follow-ups under the maintainer's relaxed landing policy:

  • The new memory-schema import graph reaches Kysely through the runtime bridge and search capability binding even for schema-only callers. This defeats the intended lazy cold-path boundary. Separate schema admission from capability binding in a follow-up; no startup failure or measured latency regression is established here.
  • The vec0 catalog fingerprint includes the bundled extension's private shadow-table layout. A query-compatible custom extension with a different layout could be refused. No affected build is demonstrated, and this PR does not claim compatibility with arbitrary custom layouts. Preserve public extension override support when refining this fingerprint contract.

These are acknowledged limitations, not claims of a clean later bot review. They do not change the earlier isolated Codex review result.

@clawsweeper

clawsweeper Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-16T19:47:03.905753Z d29e3b5 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added extensions: memory-core Extension: memory-core scripts Repository scripts size: L labels Oct 16, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Oct 16, 2026
@clawsweeper

clawsweeper Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

This PR reuses generated SQLite search-schema fingerprints and successful vector-creation receipts during memory admission.

Example: Re-admit a memory index containing quartz.md with a three-dimensional vector index.

  • Before: Admission replays FTS creation statements and separately checks vector-table existence.
  • After: Matching FTS objects retain their triggers, and vector admission reuses the owner's existing facts and creation receipt.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The source and native SQLite coverage support the implementation, but existing-state compatibility has not yet been demonstrated for this change.
Proof confidence 🦐 gold shrimp (3/6) The ordinary contributor proof gate does not apply to this maintainer-authored PR; inspected tests exercise the production admission owner with native SQLite, while shipped-entry-point measurements remain explicitly pending.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Memory indexing initialization performs avoidable database schema work.
Reason: The feature owner's direction is established, and the patch extends the existing admission design while preserving user settings and search semantics.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open: this maintainer-authored PR provides a distinct admission optimization, with no definite code defect found; its explicit coordination hold remains.

Priority: P2
Reviewed head: e43d20b3045c7dc4f6e9ddca2bc290e5b54ba6bc

Before merge

  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied evidence does not yet demonstrate shipped memory initialization and restart after upgrading a populated v2026.10.4 installation with settings, canonical rows, and search results intact.
Agent review details

How this fits together

Memory schema setup and publication workers pass search definitions to the database engine, which admits SQLite derived indexes and returns bound search capabilities.

flowchart TD
  A[Memory schema owner] --> B[Search admission]
  C[Publication worker] --> B
  B --> D[Generated SQLite fingerprints]
  B --> E[FTS reconciliation]
  B --> F[Vector schema receipts]
  E --> G[Bound search capabilities]
  F --> G
Loading

Technical review

Best possible solution:

Keep generated search facts under the existing database-engine owner while preserving canonical memory data and established rebuild behavior.

Do we have a high-confidence way to reproduce the issue?

Current-main source shows unconditional FTS DDL replay and the separate vector existence check; no target code was run.

Is this the best way to solve the issue?

The approach fits the existing generated-catalog and physical-database admission owners without introducing a competing cache or changing PostgreSQL definitions.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 60ae44b74559.

Provenance checked

  • FTS schema reconciliation and collision protection keeps the original intent (b148150: Repair derived tokenizer and column drift while protecting canonical rows and unsafe custom aliases.)
  • Incomplete derived FTS rows keeps the original intent (2575d0d: Recover missing search results by comparing canonical and derived cardinality.)
  • Physical-database admission reuse keeps the original intent (bb7d32e: Reuse completed admission across handles and workers while invalidating facts through owning writers.)
  • Engine-owned search capabilities and extensions keeps the original intent (20b5969: Place native search primitives at the database adapter while memory retains retrieval and scoring.)
  • Generated memory catalog facts keeps the original intent (8a066f0: Remove static scratch-schema discovery while deferring dynamic search admission.)
  • Equivalent manually edited derived DDL changes intended behavior with a stated reason (b148150: The earlier parser accepted equivalent FTS spellings; this PR explicitly accepts rebuilding equivalent hand-edited derived definitions under exact generated comparison.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit bb7d32e adds packages/memory-host-sdk/src/host/memory-schema-fts.ts:199 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: bb7d32e55d48; files: packages/memory-host-sdk/src/host/memory-schema-fts.ts)

PR surface

Source +279, Tests +250, Other +31. Total +560 across 18 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 12 472 193 +279
Tests 4 278 28 +250
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 31 0 +31
Total 18 781 221 +560

Labels

Label changes:

  • add P2: A focused memory-admission performance improvement with no demonstrated urgent user-facing failure.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.

Label justifications:

  • P2: A focused memory-admission performance improvement with no demonstrated urgent user-facing failure.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Complete the pending published-driver upgrade validation against populated stable-release state and show that settings, canonical rows, and memory search survive.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 16, 2026, 1:13 PM ET / 17:13 UTC.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0dcdd6c7d3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

import { ensureMemoryRecallMetadataSchema } from "./memory-schema-recall.js";
import { migrateMemoryIndexStorage } from "./memory-schema-storage-migration.js";
import { memoryTextSearchSchema } from "./memory-search-schema.js";
import { admitStoreSearch } from "./openclaw-runtime-kysely.js";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep schema admission off the Kysely dependency graph

Because memory-schema.ts is imported by agent-database bootstrap and Doctor for migration helpers, this static import now evaluates openclaw-runtime-kysely.ts, which reexports kysely-sync; admitStoreSearch also eagerly imports the full search binding graph, including the Kysely-backed SQLite full-text and vector modules. Schema-only startup therefore cold-loads these capabilities even when FTS is disabled. Move the schema-admission operation to a non-Kysely bridge and bind search capabilities only at their actual caller.

AGENTS.md reference: AGENTS.md:L74-L74

Useful? React with 👍 / 👎.

Comment on lines +62 to +66
!matchesSqliteMemorySearchFragment(catalog, {
kind: "vector",
tableName: index.table,
dimensions,
})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Validate the public vec0 contract instead of private tables

On a cold reopen with a documented custom store.vector.extensionPath, a loadable and query-compatible sqlite-vec build can use a different private shadow-table layout than the bundled 0.1.9 binary used to generate this fingerprint. This whole-catalog comparison then rejects the existing index with “rebuild the derived memory index”; rebuilding with the same configured extension recreates the same private layout, so admission remains permanently broken. Validate the stable vec0 declaration, visible columns, and dimensions instead of generated private shadow tables, or explicitly enforce an extension-version contract.

AGENTS.md reference: AGENTS.md:L57-L57

Useful? React with 👍 / 👎.

@steipete

Copy link
Copy Markdown
Contributor Author

Reviewed the two later automated suggestions against the source. Both are retained as follow-ups under the maintainer's relaxed landing policy: schema-only imports now eagerly reach the Kysely search capability graph, and vec0 fingerprints can reject a query-compatible custom build whose private shadow-table layout differs from the bundled build. No startup failure, measured latency regression, or affected custom build was demonstrated. The PR body now states both limitations and does not claim universal custom-build compatibility. Separating admission from capability binding and narrowing the custom-layout contract remain follow-ups.

Landing still waits for the explicitly required final-head PostgreSQL pass. The job ran; memory/search cases passed, but all three Matrix portability cases hit the shared fixture's stale fresh-root rejection expectation. The confirmation harness pair remains queued under the shared semaphore.

@steipete
steipete merged commit e3457a5 into main Oct 16, 2026
156 checks passed
@steipete
steipete deleted the dbasync/memschema branch October 16, 2026 20:01
steipete added a commit that referenced this pull request Oct 16, 2026
Project the declared table catalog fields explicitly when canonicalizing
custom memory-search table names. Preserve immutable input and all existing
fingerprint inputs without the map-spread suppression added by #174438.

The existing suppression inventory reproduces 95 vs 94 before this change.
All 12 memory-schema cases and three suppression-inventory tests pass.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
…#174438)

Route memory search admission through the existing engine owner and reuse generated catalog fingerprints, including computed vector dimensions. Preserve tokenizer, result, rebuild, and PostgreSQL behavior.

First-use memory admission falls from 155 to 147 statements; cold vector admission adds five catalog statements in the same request, for a net three-statement subsystem saving. Restart and warmed-turn counts do not regress.

Preserve the canonical Matrix portability fixture and both sides of the wrapper inventory during integration.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
…aw#174689)

Project the declared table catalog fields explicitly when canonicalizing
custom memory-search table names. Preserve immutable input and all existing
fingerprint inputs without the map-spread suppression added by openclaw#174438.

The existing suppression inventory reproduces 95 vs 94 before this change.
All 12 memory-schema cases and three suppression-inventory tests pass.
obviyus added a commit that referenced this pull request Oct 17, 2026
…exes (#175555)

Related: #144641, #174438

## What Problem This Solves

Memory index admission counted rows of the FTS5 table with `SELECT COUNT(*)`. FTS5 serves that count as a full scan of its `%_content` shadow table. On large stores this added up to about 1.7 s of cold I/O, inside the agent database write transaction.

## User Impact

User impact: memory stores with a large full-text index open faster and hold the agent database write lock for less time. Search results, config, schema and stored data do not change.

## Why This Change Was Made

The admitted body FTS DDL keeps the default `columnsize=1`, so FTS5 stores one `%_docsize` row per document. The reconcile check now counts `<fts>_docsize`, which gives the same number from a much smaller table (211 pages instead of 20,567 on a 43,490-chunk store). Admission drops and recreates any FTS table with different DDL before the count runs, so the docsize table is always present. The rebuild decision and its repair are unchanged.

## Evidence

- Focused test `memory-schema-fts-reconcile.test.ts`: 16/16 pass. The new test checks that the query plan reads `memory_index_chunks_fts_docsize`, not the virtual table, and that the count equals `COUNT(*)` of the FTS table after deletes, re-inserts, edits and empty rows.
- Built CLI on this head, isolated state: `openclaw memory index` on 31 memory files gave 31 chunks, 31 docsize rows, 31 content rows. Deleting 12 FTS rows left 19/19. The next `openclaw memory search zebracorn` admission saw the mismatch, rebuilt the index back to 31/31, and returned all 30 matching notes.
- Contributor benchmark on two real stores: cold first admission 2,003-2,060 ms to 317-325 ms (43,490 chunks) and 220-230 ms to 72 ms (6,012 chunks).
- Hosted CI green and ClawSweeper `ready` on the merged head.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 18, 2026
…exes (openclaw#175555)

Related: openclaw#144641, openclaw#174438

## What Problem This Solves

Memory index admission counted rows of the FTS5 table with `SELECT COUNT(*)`. FTS5 serves that count as a full scan of its `%_content` shadow table. On large stores this added up to about 1.7 s of cold I/O, inside the agent database write transaction.

## User Impact

User impact: memory stores with a large full-text index open faster and hold the agent database write lock for less time. Search results, config, schema and stored data do not change.

## Why This Change Was Made

The admitted body FTS DDL keeps the default `columnsize=1`, so FTS5 stores one `%_docsize` row per document. The reconcile check now counts `<fts>_docsize`, which gives the same number from a much smaller table (211 pages instead of 20,567 on a 43,490-chunk store). Admission drops and recreates any FTS table with different DDL before the count runs, so the docsize table is always present. The rebuild decision and its repair are unchanged.

## Evidence

- Focused test `memory-schema-fts-reconcile.test.ts`: 16/16 pass. The new test checks that the query plan reads `memory_index_chunks_fts_docsize`, not the virtual table, and that the count equals `COUNT(*)` of the FTS table after deletes, re-inserts, edits and empty rows.
- Built CLI on this head, isolated state: `openclaw memory index` on 31 memory files gave 31 chunks, 31 docsize rows, 31 content rows. Deleting 12 FTS rows left 19/19. The next `openclaw memory search zebracorn` admission saw the mismatch, rebuilt the index back to 31/31, and returned all 30 matching notes.
- Contributor benchmark on two real stores: cold first admission 2,003-2,060 ms to 317-325 ms (43,490 chunks) and 220-230 ms to 72 ms (6,012 chunks).
- Hosted CI green and ClawSweeper `ready` on the merged head.

Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: memory-core Extension: memory-core P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant