Skip to content

fix(memory): avoid full vector scans for small source updates - #140102

Closed
maximilliangrand wants to merge 1 commit into
openclaw:mainfrom
maximilliangrand:perf/memory-vector-point-deletes
Closed

maximilliangrand wants to merge 1 commit into
openclaw:mainfrom
maximilliangrand:perf/memory-vector-point-deletes

Conversation

@maximilliangrand

@maximilliangrand maximilliangrand commented Sep 6, 2026 •

Copy link
Copy Markdown

Related: #134575

What Problem This Solves

Resolves a problem where updating or removing a small memory source scans the entire vector index. As unrelated memory accumulates, each incremental cleanup spends more time synchronously occupying the Gateway thread. The full-scan query remains in current main.

Why This Change Was Made

sqlite-vec 0.1.9 gives the existing DELETE ... WHERE id IN (SELECT ...) a full-scan plan. Select source IDs through the existing (path, source) index and stream them through one prepared scalar-key delete instead. This preserves the deletion set across models, surrounding transactions, missing-vector handling, and rebuild-debt policy without introducing schema, worker, or configuration changes.

This complements #103201 (session chunk deltas) and #136482 (publication isolation); their inspected changes retain the source-wide IN delete. It does not replace either effort.

User Impact

Small memory updates and removals no longer scan unrelated vector rows. Newly indexed sources also avoid a full scan when they have no old vectors to remove. This is a sparse-cleanup scaling fix, not a claim that all memory operations or the whole Gateway become faster.

Tradeoff: individual point deletes are slower for dense deletion. In the synthetic 100,000-vector case below, deleting half the index takes about 655 ms rather than 450 ms. Keeping one simple, source-scoped path avoids adding global counting or adaptive deletion policy; the table includes both sparse and dense workloads.

Evidence

  • The new regression first failed on unmodified production code because the actual public memory-sync query planned SCAN memory_index_chunks_vec VIRTUAL TABLE INDEX 0:1. It passes with the repair. Scalar deletion uses sqlite-vec's point plan (... INDEX 1:2!___); regression assertions use query plans rather than wall-clock thresholds.
  • 142 tests passed across 7 files, covering memory indexing/search, reindex recovery, vector writes/rebuild state, legacy cleanup, and the new regression. New coverage verifies replacement vectors exist, unrelated vectors retain identical bytes, same-path/different-source isolation, old-model cleanup, missing/empty vector sets, transaction rollback, and rebuild debt after an injected second-delete failure.
  • node scripts/check-changed.mjs passed, including production/test typechecks, lint, formatting, plugin boundaries, dead-export scans, storage guards, and import-cycle checks. Independent autoreview found no actionable P0–P2 findings; the final regression rerun passed after test-only typing/ordering cleanup.
  • Upstream checks on 8fbaac420e2d91a1e1472887bdca63bd96ca7ba2: 54 successful checks, none failed or pending when checked on September 6.

After-fix OpenClaw CLI behavior proof

Ran the normal pnpm openclaw memory index, memory search, and memory status --deep --json flow on the submitted head, using the built production Memory Core plugin, a task-owned workspace/database, and real local Ollama 0.32.9 embeddings. No embedding-provider mocks. Model: all-minilm, digest 1b226e2802dbb772b5fc32a58f103ca1804ef7501331012de126ab22f67475ef, native 384-dimensional vectors. All indexed documents are synthetic. Updates/removals used incremental indexing, without --force.

Terminal excerpts below omit startup/config warnings and unrelated JSON fields; file edits and database verification are annotated separately:

$ pnpm openclaw memory index --verbose
Provider: ollama (requested: ollama)
Model: all-minilm
Memory index updated (main): 2 files indexed.
$ pnpm openclaw memory search 'lighthouse emergency signal' --json
  "path": "MEMORY.md",
  "snippet": "# Lighthouse operations\nThe lighthouse emergency signal is amber-kestrel. The keeper checks the backup lantern every Friday.\n",

[Edit the synthetic MEMORY.md: amber-kestrel/Friday -> cobalt-heron/Sunday]
$ pnpm openclaw memory index --verbose
Memory index updated (main): 2 files indexed.
$ pnpm openclaw memory search 'lighthouse emergency signal' --json
  "path": "MEMORY.md",
  "snippet": "# Lighthouse operations\nThe lighthouse emergency signal is now cobalt-heron. The keeper checks the backup lantern every Sunday.\n",

[Move MEMORY.md outside the indexed workspace]
$ pnpm openclaw memory index --verbose
Memory index updated (main): 1 file indexed.
$ pnpm openclaw memory search 'lighthouse emergency signal' --json
{ "results": [] }
$ pnpm openclaw memory search 'heritage orchard irrigation' --json
  "path": "memory/unrelated.md",
  "vectorScore": 0.6090167760848999,
  "snippet": "# Orchard notes\nThe heritage orchard grows silver-birch apples. Irrigation starts every Tuesday at sunrise.\n",

Before/update/removal snapshots contained 2/2/1 canonical chunks and 2/2/1 vectors. The replacement vector ID/bytes changed; the removed source had no remaining vector. The ordered ID+embedding SHA-256 for memory/unrelated.md stayed f3590cdf171bd187d2dad81f09a42df19755206b2d1ea582646ccc7b22e9d10c through all three states. Its search content and vector score were preserved; hybrid final scores vary slightly with corpus statistics. The production cleanup observer recorded one old row for both update and removal. Rebuild state remained clean.

Dense source removal through the real CLI

Also indexed two generated maintenance journals with default chunking, then removed one through memory index. These are chosen synthetic source sizes, not a claim about the distribution of real user documents. Each size ran three removal rounds; the closed, checkpointed fixture database was restored between rounds. All embeddings were generated by the real provider through OpenClaw indexing.

Removed source bytes Removed / total vectors Vector cleanup median (range), ms Write transaction held median (range), ms
131,217 (~128 KiB) 119 / 238 2.057 (2.025–2.062) 17.214 (16.799–24.687)
1,048,647 (~1 MiB) 944 / 1,882 16.862 (16.675–18.724) 55.151 (51.525–62.183)

All six commands exited successfully and committed. The resulting databases contained 119 and 938 chunks/vectors respectively, no target rows, unchanged retained vector IDs/bytes, and clean rebuild state. Final memory status --deep --json reported dirty: false, index.state: complete, semanticAvailable: true, dims: 384, and embeddingProbe.ok: true.

Timing used an external observational Node preloader, leaving the submitted source and SQL unchanged. It wraps the exact source-ID statement's native iterate(); the synchronous production point deletes execute between yielded rows. One record is buffered per cleanup and written at process exit. Vector timing therefore includes native iteration and the actual production delete loop, excludes statement preparation, and includes observer overhead. Transaction timing starts after BEGIN IMMEDIATE succeeds and ends after COMMIT, excluding lock acquisition and including FTS/canonical work and commit. CLI startup/model-loading time is not reported as cleanup time.

These measurements quantify the after-fix cost at these source sizes; they do not establish a before/after end-to-end speedup or Gateway responsiveness guarantee. The disclosed 50,000-row dense microbenchmark regression below remains a real tradeoff. Large replacement writes also remain synchronous: growing the retained journal from ~128 KiB to ~1 MiB held its write transaction for 344 ms, of which old-vector cleanup was 1.746 ms. This patch targets dependence on unrelated vector count, not all synchronous indexing work.

Production-loop timing observer (loaded through NODE_OPTIONS=--import)

The observer delegates to the native iterator; it neither substitutes SQL nor synthesizes embeddings. This excerpt shows the cleanup timing mechanism; transaction timing separately observes native exec boundaries as described above.

import { DatabaseSync } from 'node:sqlite';
import fs from 'node:fs';
const records = [];
const prepare = DatabaseSync.prototype.prepare;
DatabaseSync.prototype.prepare = function (sql, ...args) {
  const statement = prepare.call(this, sql, ...args);
  if (sql.trim() === 'SELECT id FROM memory_index_chunks WHERE path = ? AND source = ?') {
    const iterate = statement.iterate.bind(statement);
    statement.iterate = function* (...bindings) {
      const start = performance.now();
      let rows = 0;
      try {
        for (const row of iterate(...bindings)) { rows++; yield row; }
      } finally {
        records.push({ path: bindings[0], source: bindings[1], rows,
          cleanupMs: performance.now() - start });
      }
    };
  }
  return statement;
};
process.on('exit', () => {
  if (records.length) fs.appendFileSync(process.env.PROOF_OBSERVATIONS,
    JSON.stringify(records) + '\n');
});

SQL strategy comparison

Synthetic SQLite microbenchmark, Apple M4 / macOS ARM64, Node 26.7.0, SQLite 3.53.4, sqlite-vec 0.1.9. In-memory tables, 128-dimensional vectors, same database restored by rollback between runs; one warm-up and six measured rounds with alternating baseline/candidate order. Values are conventional medians. Timing includes statement preparation and deletion, excludes transaction begin/rollback and result verification.

Total vectors Target vectors Before (ms) After (ms)
1,000 0 0.555 0.008
1,000 10 0.632 0.142
1,000 500 4.217 7.381
10,000 0 5.149 0.007
10,000 10 5.565 0.148
10,000 5,000 45.584 69.231
100,000 0 58.772 0.021
100,000 10 61.698 0.172
100,000 50,000 450.261 654.930

The microbenchmark executes the two SQL strategies against generated rows in real vec0 tables; the CLI proof above separately exercises the production memory manager with real local embeddings. Neither is an end-to-end Gateway latency benchmark or a reproduction of the full 12–24-second incident in #134575.

Regression commands and standalone benchmark reproduction
node scripts/run-vitest.mjs \
  extensions/memory-core/src/memory/manager-vector-delete.test.ts \
  extensions/memory-core/src/memory/manager-vector-write.test.ts \
  extensions/memory-core/src/memory/manager-vector-rebuild-state.test.ts \
  extensions/memory-core/src/memory/manager.legacy-migration-cleanup.test.ts \
  extensions/memory-core/src/memory/index.test.ts \
  extensions/memory-core/src/memory/manager.reindex-recovery.test.ts \
  extensions/memory-core/src/memory/manager-search.test.ts
node scripts/check-changed.mjs

From a checkout with pinned dependencies installed:

node --input-type=module <<'JS'
import { DatabaseSync } from 'node:sqlite';
import { performance } from 'node:perf_hooks';
import * as vec from 'sqlite-vec';
const median = xs => {
  const a = [...xs].sort((x, y) => x - y), m = Math.floor(a.length / 2);
  return a.length % 2 ? a[m] : (a[m - 1] + a[m]) / 2;
};
for (const size of [1000, 10000, 100000]) {
  const db = new DatabaseSync(':memory:', { allowExtension: true });
  vec.load(db);
  db.exec(`CREATE VIRTUAL TABLE vectors USING vec0(id TEXT PRIMARY KEY, embedding FLOAT[128]);
    CREATE TABLE chunks(id TEXT PRIMARY KEY, path TEXT, source TEXT);
    CREATE INDEX chunks_path_source ON chunks(path, source);`);
  const insert = db.prepare('INSERT INTO vectors VALUES (?,?)');
  const chunk = db.prepare('INSERT INTO chunks VALUES (?,?,?)');
  const embedding = new Float32Array(128).fill(0.125);
  db.exec('BEGIN');
  for (let i = 0; i < size; i++) {
    insert.run(`id-${i}`, embedding);
    chunk.run(`id-${i}`, 'other', 'memory');
  }
  db.exec('COMMIT');
  for (const target of [0, 10, size / 2]) {
    db.prepare("UPDATE chunks SET path='other'").run();
    db.prepare("UPDATE chunks SET path='target' WHERE rowid<=?").run(target);
    const times = { baseline: [], candidate: [] };
    for (let round = 0; round < 7; round++) {
      for (const mode of (round % 2 ? ['candidate', 'baseline'] : ['baseline', 'candidate'])) {
        db.exec('BEGIN IMMEDIATE');
        const start = performance.now();
        if (mode === 'baseline') {
          db.prepare('DELETE FROM vectors WHERE id IN (SELECT id FROM chunks WHERE path=? AND source=?)')
            .run('target', 'memory');
        } else {
          const ids = db.prepare('SELECT id FROM chunks WHERE path=? AND source=?');
          const del = db.prepare('DELETE FROM vectors WHERE id=?');
          for (const row of ids.iterate('target', 'memory')) del.run(row.id);
        }
        const elapsed = performance.now() - start;
        if (db.prepare('SELECT count(*) AS n FROM vectors').get().n !== size - target) {
          throw new Error('wrong deletion set');
        }
        db.exec('ROLLBACK');
        if (round > 0) times[mode].push(elapsed);
      }
    }
    console.log({ size, target, baselineMs: median(times.baseline), candidateMs: median(times.candidate), samples: times });
  }
  db.close();
}
JS

@clawsweeper

clawsweeper Bot commented Sep 6, 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.

@maximilliangrand
maximilliangrand marked this pull request as ready for review September 6, 2026 12:40
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 6, 2026
@clawsweeper

clawsweeper Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 6, 2026, 9:06 AM ET / 13:06 UTC.

ClawSweeper review

What this changes

Memory Core’s local search index switches source cleanup to individual vector-key deletes so small updates avoid scanning unrelated vectors, with regression coverage for isolation and recovery.

Merge readiness

⛔ Blocked before merge - 1 item remains

This remains a useful, focused fix: current main retains the full-scan cleanup query, and the related work does not supersede it. The added production CLI evidence resolves the previous proof request. No blocking correctness finding remains.

Priority: P2
Reviewed head: 8fbaac420e2d91a1e1472887bdca63bd96ca7ba2

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, well-supported repair with sufficient production proof and no blocking defect; dense-deletion cost remains a clearly disclosed tradeoff.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): Submitted-head production Memory Core CLI runs with real Ollama embeddings exercise incremental update and removal, preserve unrelated vector bytes and search results, and record clean recovery state; additional dense-removal runs satisfy the prior proof request.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): Submitted-head production Memory Core CLI runs with real Ollama embeddings exercise incremental update and removal, preserve unrelated vector bytes and search results, and record clean recovery state; additional dense-removal runs satisfy the prior proof request.
Evidence reviewed 10 items Introduced change and current-main necessity: The verified merge-base-to-head delta changes only source vector cleanup and its regression coverage. At fetched main b4c9407, deleteVectorRowsForSource still executes DELETE with an IN subquery; the optimization is not already present.
Deletion scope and transaction ownership: clearIndexedFileData deletes vectors before canonical chunks, preserving the rows needed by the iterator. File removal and replacement invoke this cleanup inside their existing write transactions; the patch adds no await, schema, identifier, or transaction-boundary change.
Existing indexed lookup: The canonical chunk schema already indexes path and source, so selecting matching identifiers requires no new persistent representation.
Findings None None.
Security None None.

How this fits together

Memory Core indexes memory files and session transcripts for search. When a source changes or disappears, its synchronization pipeline removes old vector and text records before publishing the updated index.

flowchart TD
  A[Changed or removed source] --> B[Memory synchronization]
  B --> C[Source write transaction]
  C --> D[Read matching chunk identifiers]
  D --> E[Delete matching vectors]
  E --> F[Update canonical and text records]
  E --> G[Record rebuild debt on failure]
  F --> H[Updated memory search]
Loading

Before merge

  • Resolve merge risk (P1) - Very dense source deletion can hold the synchronous cleanup path longer: the disclosed 50,000-vector benchmark increased from 450.261 to 654.930 ms. The smaller production CLI cases establish correctness and measured cost, not a bound on Gateway stalls.
Agent review details

Security

None.

PR surface

Source +6, Tests +197. Total +203 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 13 7 +6
Tests 1 197 0 +197
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 210 7 +203

Review metrics

Metric Value Why it matters
Dense deletion cost 50,000 of 100,000 vectors: +204.669 ms, approximately 45% The contributor’s controlled benchmark quantifies the synchronous-cost tradeoff that ordinary CI does not assess.

Merge-risk options

Maintainer options:

  1. Accept the documented sparse-versus-dense tradeoff (recommended)
    Retain the focused optimization with its production proof and disclosed dense-delete cost, without treating it as resolution of the broader Gateway stall incident.

Technical review

Best possible solution:

Keep source-scoped point deletion with existing transaction and recovery semantics, accepting the measured dense-workload tradeoff while broader Gateway isolation remains separate work.

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

Yes: current main’s IN-subquery cleanup and sqlite-vec 0.1.9’s planner establish the full-scan mechanism; the contributor also supplies a failing-before query-plan regression. This review did not execute it or reproduce the broader Gateway incident.

Is this the best way to solve the issue?

Yes: the patch changes the existing cleanup owner, reuses the indexed source lookup, and preserves deletion scope and recovery behavior without adding schema or configuration. Its dense-deletion cost is explicitly measured.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. Submitted-head production Memory Core CLI runs with real Ollama embeddings exercise incremental update and removal, preserve unrelated vector bytes and search results, and record clean recovery state; additional dense-removal runs satisfy the prior proof request.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): Submitted-head production Memory Core CLI runs with real Ollama embeddings exercise incremental update and removal, preserve unrelated vector bytes and search results, and record clean recovery state; additional dense-removal runs satisfy the prior proof request.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This is a focused memory-index scaling repair with demonstrated benefit, without proof that it resolves the broader urgent Gateway incident.
  • merge-risk: 🚨 availability: Individual deletes measurably increase synchronous cleanup time for very dense sources, potentially extending event-loop stalls.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): Submitted-head production Memory Core CLI runs with real Ollama embeddings exercise incremental update and removal, preserve unrelated vector bytes and search results, and record clean recovery state; additional dense-removal runs satisfy the prior proof request.
  • proof: sufficient: Contributor real behavior proof is sufficient. Submitted-head production Memory Core CLI runs with real Ollama embeddings exercise incremental update and removal, preserve unrelated vector bytes and search results, and record clean recovery state; additional dense-removal runs satisfy the prior proof request.

Evidence

What I checked:

  • Introduced change and current-main necessity: The verified merge-base-to-head delta changes only source vector cleanup and its regression coverage. At fetched main b4c9407, deleteVectorRowsForSource still executes DELETE with an IN subquery; the optimization is not already present. (extensions/memory-core/src/memory/manager-sync-base.ts:536, b4c940701a28)
  • Deletion scope and transaction ownership: clearIndexedFileData deletes vectors before canonical chunks, preserving the rows needed by the iterator. File removal and replacement invoke this cleanup inside their existing write transactions; the patch adds no await, schema, identifier, or transaction-boundary change. (extensions/memory-core/src/memory/manager-source-sync-ops.ts:51, 8fbaac420e2d)
  • Existing indexed lookup: The canonical chunk schema already indexes path and source, so selecting matching identifiers requires no new persistent representation. (packages/memory-host-sdk/src/host/memory-schema.ts:654, 8fbaac420e2d)
  • Dependency contract signal: The package pins sqlite-vec 0.1.9, and the changed cleanup explicitly relies on its scalar-key query plan. This establishes the relevant dependency boundary; no Codex implementation is involved. (package.json:2228, 8fbaac420e2d)
  • Verified dependency planner: The inspected v0.1.9 planner separates IN constraints from scalar equality and selects the point plan only for the latter; a non-KNN IN query falls through to full scan. Source: sqlite-vec planner. (sqlite-vec.c:5113)
  • Regression coverage and recovery: The new tests exercise public synchronization, inspect its actual SQLite query plan, verify replacement and removal with unchanged unrelated vector bytes, and cover source isolation, rollback, absent vectors, repeated cleanup, and persisted rebuild debt after partial deletion failure. These tests were inspected, not executed during this read-only review. (extensions/memory-core/src/memory/manager-vector-delete.test.ts:14, 8fbaac420e2d)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vito Cappello: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-06T12:45:55.118Z sha 8fbaac4 :: needs real behavior proof before merge. :: none

@maximilliangrand

Copy link
Copy Markdown
Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 6, 2026
@fuller-stack-dev fuller-stack-dev self-assigned this Sep 15, 2026
@steipete

Copy link
Copy Markdown
Contributor

Thanks @maximilliangrand for the sparse vector-cleanup investigation, the query-plan regression, and the dense-workload measurements. main now handles the bounded sparse case in #148854 (1349c4c5420c1f0853f83ad6e0a35ab9db6b8791) at the current MemorySourceIndexKernel owner (extensions/memory-core/src/memory/manager-source-index-kernel.ts): it reads at most 33 source IDs, uses scalar-key deletes for up to 32 vectors, keeps one scan for larger batches, and rolls back partial deletion before recording rebuild debt. That avoids unrelated-vector scans for small source changes while bounding native calls for dense deletion; the old manager owner this PR patched was retired by #145207. Closing as superseded for the small-source outcome; your benchmarks stay the reference if the 32-vector threshold is revisited, and a new PR against the kernel owner is welcome for that.

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 merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants