Repository navigation
refactor(memory): use SQLite transcript identities - #117334
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 7:11 AM ET / 11:11 UTC. ClawSweeper reviewWhat this changesThis PR makes Memory Core index active session transcripts through typed SQLite identities and commit events, while retaining reset/delete archives as a separately materialized file corpus. Merge readinessThe patch is a coherent root-boundary repair and has no concrete correctness or security finding, but it intentionally removes live JSONL and filename/marker compatibility paths. Because this PR is labeled Priority: P2 Review scores
Verification
How this fits togetherSessionManager persists agent transcript messages, then publishes typed session targets for in-process consumers. Memory Core and QMD use those targets to index active SQLite transcripts, while archive files remain available for retained reset/delete history. flowchart LR
A[SessionManager append] --> B[SQLite transcript store]
B --> C[Typed transcript update]
C --> D[Memory Core listener]
D --> E[Active SQLite transcript index]
F[Reset or delete archive] --> G[Archive materialization]
G --> H[Memory and QMD archive index]
Decision needed
Why: The source repair is internally coherent, but only maintainers can determine whether a released active-JSONL compatibility case remains supported and therefore requires migration rather than removal. Before merge
Agent review detailsSecurityNone. PR surfaceSource -469, Tests -154. Total -623 across 17 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Confirm that active transcripts are supported only through the typed SQLite corpus and that retained reset/delete history is the sole file-backed transcript compatibility surface; otherwise add the narrow migration or documented upgrade handling before merging. Do we have a high-confidence way to reproduce the issue? Yes—at high confidence from source and the PR’s focused persisted-append and archive-lifecycle coverage. This read-only review did not rerun those tests, but the changed producer, typed consumer, and regression cases align on the same current-main transcript contract. Is this the best way to solve the issue? Yes, conditionally: publishing the persisted typed target at the producer and consuming it from one SQLite-backed corpus is a better owner-boundary fix than retaining downstream path, marker, and byte-delta reconstruction. The remaining question is upgrade-contract intent, not an alternative implementation layer. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4e47c4cabf8f. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
5b922d6 to
33cc8ad
Compare
|
Merged via squash.
|
* origin/main: refactor(doctor): unify legacy auth migration ownership (openclaw#117361) fix(plugins): surface actionable doctor warnings (openclaw#117357) fix(ci): use corrected Kova release evaluator (openclaw#116920) fix(ci): stabilize release validation assertions (openclaw#117377) refactor(memory): use sqlite transcript identities (openclaw#117334) fix(plugins): require tracked owners for targeted updates (openclaw#117333)
* origin/main: refactor(doctor): unify legacy auth migration ownership (openclaw#117361) fix(plugins): surface actionable doctor warnings (openclaw#117357) fix(ci): use corrected Kova release evaluator (openclaw#116920) fix(ci): stabilize release validation assertions (openclaw#117377) refactor(memory): use sqlite transcript identities (openclaw#117334) fix(plugins): require tracked owners for targeted updates (openclaw#117333)
What Problem This Solves
Memory Core still treated live session transcripts as mutable JSONL files after SQLite became the canonical transcript store. That left obsolete file discovery, marker parsing, byte/newline delta accounting, fallback paths, and stale sync state in the hot path. It also hid two connected correctness gaps: ordinary persisted SessionManager appends could complete without a typed transcript event, and compressed reset/delete archives were read as compressed bytes instead of materialized JSONL.
Why This Change Was Made
This moves the owner boundary to the canonical storage contract:
agentId,sessionId,sessionKey)Removed production paths include live JSONL discovery, SQLite marker recovery, canonical path parsing, byte/newline delta reads, delta state snapshots, and filename-to-identity fallbacks. Handwritten production delta: +107 / -576 = -469 LOC. Tests: +280 / -434 = -154 LOC. No schema version, configuration, dependency, protocol, or public plugin-SDK change.
User Impact
Memory indexing now follows the storage facts that actually exist: active SQLite transcripts update from typed commit events, while reset/delete archives remain searchable as durable history. This repairs persisted append notifications and makes compressed archived conversations readable to Memory Core and QMD without restoring legacy live-file behavior.
Evidence
deleteSessionEntry({ archiveTranscript: true })-> emitted archive path -> corpus validation -> indexed archived transcript.tbx_01kyycq6z71bydjtetzyj8cfjy: exact-headpnpm check:changedpassed all core/core-test/extension/extension-test typecheck, lint, boundary, dead-code, DB-first, and cycle gates with no warnings in 278.9s (run).pnpm buildpassed on Blacksmith Testbox in 179.7s (run).gpt-5.6-sol,xhigh, one 89,658-byte pass; clean, no accepted/actionable findings (patch is correct, 0.98).git diff --checkpassed.ClawSweeper Rank-up Move
ClawSweeper optionally suggested rebasing onto current main and rerunning the focused proof. This is intentionally skipped after an exact path and ownership audit: exact head
33cc8adcf1e8c23e74f97b971341899d1d200e3fhas merge base8317e23c1c2bef85989023ea0fcc59b1cfe061a3with current main4e47c4cabf8f2901ec781b59d059999211398813, andgit diff --name-only 8317e23c1c2..4e47c4cabf8f -- <this PR's 17 touched paths>is empty across 404 intervening main paths.Newly landed #117343 touches eight
src/gateway/session-transcript-*/session-utils.fs*paths and has zero touched-path overlap. It owns Gateway history selection, pagination, anchor reads, and the bounded(mtime,size)archive index cache. This PR independently owns the persist-after-write transcript event, Memory Host corpus identities, Memory Core ingestion, and QMD export. Both consume the existing corematerializeSessionArchiveForReadcodec contract; neither changes that codec, and this PR only routes it through the existing allowed Memory Host runtime barrel.Refreshing would therefore invalidate exact-head CI and review proof without exercising a changed owner surface. The branch remains mergeable and exact-head hosted CI is green. Preserved proof includes the broad 16-file / 178-test affected run, final 3-file / 69-test focused run, real persisted SQLite append and delete/archive listener flows, retained-reset SQLite lifecycle, zstd Memory/QMD reads, warning-free exact-head
pnpm check:changed, and exact-headpnpm build.