Skip to content

fix(memory): preserve index and session-state integrity - #114319

Closed
kevin2966n wants to merge 1 commit into
openclaw:mainfrom
kevin2966n:qa-laptop-qa09-c66ca2f
Closed

kevin2966n wants to merge 1 commit into
openclaw:mainfrom
kevin2966n:qa-laptop-qa09-c66ca2f

Conversation

@kevin2966n

Copy link
Copy Markdown
Contributor

Closes #114313
Closes #114314
Closes #114315
Closes #114316
Closes #114317
Closes #114318

What Problem This Solves

Fixes six memory and session-integrity failures: phantom file pages after terminal newlines, QMD framing noise and primitive entries, stale or malformed derived FTS schemas, incomplete FTS disable cleanup, and loss of agent ownership from case-variant Windows session paths.

Why This Change Was Made

The change validates data at each owning boundary: file-line framing, QMD result framing/types, exact derived FTS schema identity and lifecycle, and centralized platform-aware session ownership extraction. Derived indexes are rebuilt only from canonical rows; no state-schema version bump is needed.

User Impact

Memory reads paginate accurately, noisy QMD output cannot hide or corrupt valid results, FTS configuration transitions recover safely, and Windows session paths retain the correct agent owner.

Evidence

  • Parser/read group: 17/17 passed.
  • Memory schema: 24/24 passed.
  • Targeted session paths: 3/3 passed.
  • Legacy migration: 8/8 passed.
  • Read-file and yield groups: 4/4 passed.
  • Adjacent memory-core database/search groups: 41/41 passed.
  • Production core typecheck, targeted oxfmt, targeted oxlint, git diff --check, state-schema guard, public Plugin SDK surface, protected-path, and secret scans passed.
  • Fresh independent autoreview: no actionable findings, correctness 0.99.
  • AI-assisted implementation and review; SQLite acceptance used Node 24.18.0 and no canonical memory rows are dropped by the repair.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Jul 27, 2026
@clawsweeper

clawsweeper Bot commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 31, 2026, 9:15 AM ET / 13:15 UTC.

ClawSweeper review

What this changes

The draft changes memory-file pagination, QMD search-result parsing, derived SQLite FTS index reconciliation and disable behavior, and Windows session-path ownership extraction.

Merge readiness

⛔ Blocked until real behavior proof is added - 9 items remain

Keep this PR open. PR close coverage proof kept this PR open against #115685: PR B materially covers only the derived FTS-disable slice of PR A. PR A contains additional material memory parser, pagination, and session-state behavior that PR B does not carry forward, so closing the umbrella PR as fully covered would leave independent work without a canonical review path.

Priority: P2
Reviewed head: 5d408b8426118a4a393cd6fccbf4216c7a088111

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The draft has useful investigation but is not merge-ready because proof is absent and its old umbrella patch overlaps targeted current-main work.
Proof confidence 🧂 unranked krab (1/6) Needs real behavior proof before merge: The body reports tests and static checks but provides no inspectable after-fix real runtime artifact for this external draft; add a redacted terminal transcript, runtime log, or recorded proof after rebasing, then update the PR body for automatic re-review.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The body reports tests and static checks but provides no inspectable after-fix real runtime artifact for this external draft; add a redacted terminal transcript, runtime log, or recorded proof after rebasing, then update the PR body for automatic re-review.
Evidence reviewed 4 items PR close coverage proof: PR close coverage proof kept this PR open against #115685: PR B materially covers only the derived FTS-disable slice of PR A. PR A contains additional material memory parser, pagination, and session-state behavior that PR B does not carry forward, so closing the umbrella PR as fully covered would leave independent work without a canonical review path.
linked superseding PR: #115685 (fix(memory): fully disable derived full-text indexes) is merged at 2026-07-29T08:01:26Z.
cluster evidence: the durable review links that PR in the work cluster or recommended risk path.
Findings 1 actionable finding [P1] Remove already-merged parser and FTS fixes before merge
Security None None.

How this fits together

Memory Core reads local memory files and QMD search output, then stores searchable derived FTS indexes alongside canonical memory rows. Session-path helpers also derive agent ownership for memory transcript ingestion, so incorrect parsing or path normalization can affect memory retrieval and agent-scoped session attribution.

flowchart LR
  A[Memory files and QMD output] --> B[Memory host parser]
  B --> C[Canonical memory rows]
  C --> D[Derived FTS indexes]
  E[Session file paths] --> F[Agent ownership extraction]
  D --> G[Memory search results]
  F --> H[Session transcript ingestion]
  G --> H
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The body reports tests and static checks but provides no inspectable after-fix real runtime artifact for this external draft; add a redacted terminal transcript, runtime log, or recorded proof after rebasing, then update the PR body for automatic re-review.
  • Remove already-merged parser and FTS fixes before merge (P1) - This umbrella branch still changes the QMD parser and derived-index lifecycle that targeted replacements have already merged in fix(memory): reject invalid QMD search results #115705 and fix(memory): fully disable derived full-text indexes #115685. Rebase on current main and retain only independently remaining behavior; otherwise this branch creates competing implementations and can overwrite current-main fixes during conflict resolution.
  • Resolve merge risk (P1) - Merging this old combined branch without a current-main rebase could reintroduce or conflict with the targeted FTS-disable and QMD validation behavior already merged from separate PRs.
  • Resolve merge risk (P1) - The FTS and session-path portions alter derived persistent state and agent-scoped logical paths, so fresh-install-only tests do not establish upgrade safety.
  • Resolve merge risk (P1) - This external draft has no inspectable after-fix real-behavior artifact; the reported test totals are supplemental rather than proof of the affected runtime paths.
  • Complete next step (P2) - This needs contributor-led rebase, scope reduction, and real runtime proof; no narrow automated repair should rewrite an external six-part draft on its behalf.
  • Improve patch quality - Rebase against current main and remove the portions already supplied by targeted merged PRs.
  • Improve patch quality - Show redacted after-fix runtime proof for each remaining behavior, such as a terminal transcript or SQLite/session-path output.
  • Improve patch quality - Split any remaining repair by owner boundary rather than retaining the six-part draft.

Findings

  • [P1] Remove already-merged parser and FTS fixes before merge — packages/memory-host-sdk/src/host/qmd-query-parser.ts:21-49
Agent review details

Security

None.

PR surface

Source +129, Tests +177. Total +306 across 11 files.

View PR surface stats
Area Files Added Removed Net
Source 7 203 74 +129
Tests 4 177 0 +177
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 11 380 74 +306

Review metrics

Metric Value Why it matters
Independent repair scopes 6 reported failures in 1 draft The combined scope spans separate parser, storage-lifecycle, and session-ownership boundaries, while targeted replacements already own several of them.

Stored data model

Persistent data-model change detected: database schema: packages/memory-host-sdk/src/host/memory-schema-fts.ts, serialized state: packages/memory-host-sdk/src/host/session-files.test.ts, serialized state: packages/memory-host-sdk/src/host/session-files.ts, serialized state: packages/memory-host-sdk/src/host/session-transcript-corpus.ts, unknown-data-model-change: packages/memory-host-sdk/src/host/memory-schema-fts.ts, unknown-data-model-change: packages/memory-host-sdk/src/host/memory-schema.test.ts, and 8 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Rebase and isolate remaining behavior (recommended)
    Rebase on current main, drop the already-merged FTS-disable and QMD-validation portions, and submit any remaining fix as a focused current-main patch with upgrade and runtime proof.
  2. Pause this umbrella draft
    Close or leave the draft paused in favor of the narrower linked PRs if no independently reproducible behavior remains after the current-main comparison.

Technical review

Best possible solution:

Keep this PR open until a linked canonical PR proves it covers this PR's unique work, or a maintainer confirms closure.

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

No high-confidence current-head reproduction is provided by this draft. The changed parser, FTS, and session-path boundaries make the original reports source-reproducible, but the branch lacks inspectable failing-before/after runtime evidence and several portions have since received targeted fixes.

Is this the best way to solve the issue?

No. The best maintainable path is not to merge this historical umbrella patch unchanged: targeted current-main fixes already cover part of it, so any remaining defect should be isolated after rebasing and compared against those canonical repairs.

Full review comments:

  • [P1] Remove already-merged parser and FTS fixes before merge — packages/memory-host-sdk/src/host/qmd-query-parser.ts:21-49
    This umbrella branch still changes the QMD parser and derived-index lifecycle that targeted replacements have already merged in fix(memory): reject invalid QMD search results #115705 and fix(memory): fully disable derived full-text indexes #115685. Rebase on current main and retain only independently remaining behavior; otherwise this branch creates competing implementations and can overwrite current-main fixes during conflict resolution.
    Confidence: 0.91

Overall correctness: patch is incorrect
Overall confidence: 0.88

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against aaab981ab097.

Labels

Label justifications:

  • P2: The affected memory and session behavior is important but the branch is not evidence of an active release-blocking regression.
  • merge-risk: 🚨 compatibility: The old branch changes derived-index lifecycle and parser behavior that targeted current-main fixes have already changed, so it needs a rebase and upgrade comparison before merge.
  • merge-risk: 🚨 session-state: The draft changes agent ownership derived from session paths, which can alter how existing Windows session transcripts are associated.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The body reports tests and static checks but provides no inspectable after-fix real runtime artifact for this external draft; add a redacted terminal transcript, runtime log, or recorded proof after rebasing, then update the PR body for automatic re-review.

Evidence

What I checked:

  • PR close coverage proof: PR close coverage proof kept this PR open against fix(memory): fully disable derived full-text indexes #115685: PR B materially covers only the derived FTS-disable slice of PR A. PR A contains additional material memory parser, pagination, and session-state behavior that PR B does not carry forward, so closing the umbrella PR as fully covered would leave independent work without a canonical review path.
  • linked superseding PR: fix(memory): fully disable derived full-text indexes #115685 (fix(memory): fully disable derived full-text indexes) is merged at 2026-07-29T08:01:26Z.
  • cluster evidence: the durable review links that PR in the work cluster or recommended risk path.
  • no human follow-up: live comments and timeline hydrated by apply contain no non-automation activity after the ClawSweeper review.

Likely related people:

  • steipete-oai: Authored the merged targeted repairs for derived FTS disable behavior and QMD invalid-result validation, both of which overlap this draft's current-main reconciliation work. (role: recent targeted-fix author; confidence: high; commits: 263d1763d76a, 327432831ad6; files: packages/memory-host-sdk/src/host/memory-schema.ts, packages/memory-host-sdk/src/host/qmd-query-parser.ts)
  • steipete: Authored the narrower proof-positive memory paging and QMD-result PRs linked from this draft's timeline, so is closely connected to the remaining split-out repair paths. (role: recent adjacent contributor; confidence: high; commits: 6d198bff4e72, 08e71e7ec188; files: packages/memory-host-sdk/src/host/read-file-shared.ts, packages/memory-host-sdk/src/host/qmd-query-parser.ts)

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 (2 earlier review cycles)
  • reviewed 2026-07-27T05:15:16.409Z sha 5d408b8 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-31T13:02:10.205Z sha 5d408b8 :: needs real behavior proof before merge. :: none

@steipete

steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Thank you for documenting this memory-integrity cluster. Every linked issue has already been fixed on main: terminal-newline continuation pages by #115722, noisy QMD output by #115023, invalid primitive QMD results by #115705, derived FTS schema reconciliation by #115775, complete FTS disablement by #115685, and Windows session ownership by #115851. I verified the canonical reader, parser, FTS lifecycle, and Windows owner plus their direct regressions; an actual SQLite in-memory exercise confirmed tokenizer reconciliation, retained source rows, removed disabled indexes and triggers, and no schema-version bump. Closing as superseded by the six focused landed owner fixes; thank you.

@steipete steipete closed this Aug 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: M status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

2 participants