Skip to content

fix(memory): restore FTS fallback for same-name view collisions - #144783

Merged
steipete merged 2 commits into
mainfrom
codex/memory-fts-view-collision
Sep 11, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/memory-fts-view-collision

Conversation

@steipete

@steipete steipete commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Related: #144641, #144761

What Problem This Solves

Fixes an issue where memory searches could report full-text search as available when a SQLite view occupied the body index name, bypassing the intended unavailable-FTS fallback. The fixture repair in #144761 restored CI coverage but left this production detection bug unchanged.

Why This Change Was Made

The row-count optimization in #144641 exposed a table-only schema lookup: a same-name view could remain in place with matching row counts. The existing FTS schema owner now detects views and rejects the collision before reconciliation, preserving the view and canonical memory rows. It retains SQLite's existing view-collision diagnostic, including the expectation added in #144761. Ordinary derived-table repairs remain unchanged.

User Impact

Memory search can use its existing fallback when a view shadows the canonical or custom body FTS index. No schema migration or configuration change is required.

Evidence

  • Reproduced the original body-view detection failures before the guard, then reproduced the diagnostic mismatch against the exact merged test(memory-core): repair temporal-ranking CI after FTS reconciliation #144761 fixture before preserving SQLite's wording.
  • Passed 53 focused tests across five files on Node 24.20.0, including view preservation, ordinary-table repair, 31 canonical/legacy-schema cases, and all six temporal-ranking modes with the exact merged test(memory-core): repair temporal-ranking CI after FTS reconciliation #144761 fixture. Its assertions were not changed.
  • Compatibility proof: schema definitions, versions, configuration, transactions, and recovery rules are unchanged. The canonical/legacy-schema tests exercise existing upgrade paths, and the exact-main fixture passes with the guard. The change introduces no migration.
  • The full changed gate passed for the original guard, including production/test typechecks, dead-export scans, lint, and architecture/storage guards. The subsequent message-only adjustment passed the focused suites, formatting, and whitespace checks.
  • The original P2 review identified a pre-existing path-trigger recovery limitation; paired original/candidate SQLite proof confirmed it is unchanged by this patch. A separate P2 review of the one-line diagnostic adjustment found no actionable issues. Recovery after externally replacing a live path index remains a separate follow-up.

Detect SQLite views before FTS schema reconciliation so matching row counts cannot falsely report an available body index. Preserve colliding views, canonical rows, and existing ordinary-table repairs.

Regression context: #144641. Validated with 53 focused tests and the full changed gate. P2 review raised only an unchanged path-trigger recovery limitation, confirmed with paired original/candidate SQLite proof and retained as a separate follow-up.
@clawsweeper

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

@steipete
steipete marked this pull request as ready for review September 11, 2026 08:09
@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Sep 11, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. labels Sep 11, 2026
@clawsweeper

clawsweeper Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 11, 2026, 5:12 AM ET / 09:12 UTC (Revision 2).

ClawSweeper review

What this changes

Memory search now detects SQLite views occupying full-text index names, preserves those views, and selects the existing unavailable-index fallback.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

✅ Ready for maintainer review

This remains a useful, focused fix for a defect still present on current main. No actionable patch defects were found, and the updated compatibility evidence resolves the previous review blocker.

Priority: P2
Reviewed head: 341190f5335b220debfc9f6959c946c0c039667d

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with meaningful regression coverage and no remaining substantive review blocker.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied repository state identifies maintainer-authored work, so the external-contributor proof gate does not apply. Reported SQLite regressions cover the schema owner and temporal fallback; this review did not independently execute them.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied repository state identifies maintainer-authored work, so the external-contributor proof gate does not apply. Reported SQLite regressions cover the schema owner and temporal fallback; this review did not independently execute them.
Evidence reviewed 7 items Current main still contains the defect: The schema lookup considers tables only. A body-index view with the same row count as canonical chunks is classified as missing, survives CREATE IF NOT EXISTS, and avoids the rebuild that would expose the collision.
Guard uses the existing fallback contract: The introduced view check throws before derived-index modification. Existing savepoints roll back, and ensureMemoryIndexSchema catches the error and returns ftsAvailable=false; the manager consumes that result.
Meaningful regression coverage: Tests exercise canonical body, canonical path, and custom body view collisions through the schema owner using real SQLite, asserting unavailable FTS and preservation of views and canonical rows. The existing malformed-index test now also covers ordinary tables.
Findings None None.
Security None None.

How this fits together

Memory Core searches indexed memory and session content stored in each agent’s SQLite database. The Memory Host SDK checks optional full-text indexes and reports their availability to the search manager, which selects keyword or semantic search behavior.

flowchart TD
  A[Memory and session content] --> B[Canonical SQLite rows]
  B --> C[Full-text schema check]
  C --> D{View occupies index name?}
  D -->|Yes| E[Preserve view and report unavailable]
  D -->|No| F[Reconcile full-text indexes]
  E --> G[Existing semantic fallback]
  F --> H[Keyword and hybrid search]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +5, Tests +49. Total +54 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 7 2 +5
Tests 1 52 3 +49
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 59 5 +54

Review metrics

None.

Stored data model

Persistent data-model change detected: vector/embedding metadata: packages/memory-host-sdk/src/host/memory-schema-fts.ts. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Technical review

Best possible solution:

Keep view rejection in the existing FTS schema owner while preserving canonical data, ordinary-table repairs, and semantic fallback behavior.

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

Yes, from source: replace the body FTS table with a view mirroring canonical chunks, then initialize with FTS enabled; current main can report it available because the row counts match. No runtime commands were executed during this review.

Is this the best way to solve the issue?

Yes. Detecting views before reconciliation repairs the existing availability contract without adding another owner or changing the persisted format.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This repairs incorrect memory-search fallback selection for a bounded SQLite index-name collision.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied repository state identifies maintainer-authored work, so the external-contributor proof gate does not apply. Reported SQLite regressions cover the schema owner and temporal fallback; this review did not independently execute them.

Evidence

What I checked:

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • steipete: 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-11T08:17:04.808Z sha df9e712 :: blocked before merge. :: none

Keep the existing cannot-modify message when rejecting a colliding view before FTS reconciliation. This preserves the status diagnostic checked by the merged #144761 temporal-ranking fixture without changing schema or recovery behavior.

Validated with 53 focused tests using the exact merged fixture. Incremental P2 review found no actionable issues; the previously recorded path-trigger recovery limitation remains unchanged.
@steipete
steipete merged commit fdd808c into main Sep 11, 2026
148 of 149 checks passed
@steipete
steipete deleted the codex/memory-fts-view-collision branch September 11, 2026 10:51
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 11, 2026
Preserve the reviewed harness while incorporating the landed benchmark prerequisite.

Punchcard-Session: coral-orchard-orchard-d4

* commit '4407ed19ac63b1c1c84a0cfe6eb4bbeca9c2322c': (1196 commits)
  fix(perf): isolate benchmark subprocess transport (#144159)
  refactor(auth): await Copilot cache persistence (#144810)
  refactor(web-fetch): exercise URL normalization through the public tool (#144887)
  fix(ollama): preserve hosted subdomain model context (#144891)
  fix(doctor): explain Codex plugin health failures (#144813)
  fix(channels): honor pinned accounts in Mattermost model menus (#144880)
  fix(update): failed-update records hide the triggering error behind the excerpt tail (#144729)
  fix(logging): preserve OpenClaw package references in diagnostics (#144808)
  fix: retain plugin detail tab selections while inspection loads (#144647)
  fix: keep discovered models when sign-in tokens renew (#144861)
  fix(update): preserve local package overrides (#89985)
  fix(update): resolve compatibility bridges within the runtime graph (#144831)
  chore(i18n): refresh native locales (#144856)
  fix: preserve child signal termination during CLI respawn (#144838)
  fix(text): hide encoded MiniMax tool envelopes (#126307)
  fix(subagents): deliver child replies that match the empty placeholder (#130647)
  fix(cli): reject blank message channel selectors (#144802)
  fix(telegram): preserve mixed text order and pending stop (#144839)
  fix(memory): restore FTS fallback for same-name view collisions (#144783)
  chore(release): close out 2026.9.4 on main (#144708)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 12, 2026
…claw#144783)

* fix(memory): restore FTS fallback for same-name view collisions

Detect SQLite views before FTS schema reconciliation so matching row counts cannot falsely report an available body index. Preserve colliding views, canonical rows, and existing ordinary-table repairs.

Regression context: openclaw#144641. Validated with 53 focused tests and the full changed gate. P2 review raised only an unchanged path-trigger recovery limitation, confirmed with paired original/candidate SQLite proof and retained as a separate follow-up.

* fix(memory): preserve SQLite view-collision diagnostics

Keep the existing cannot-modify message when rejecting a colliding view before FTS reconciliation. This preserves the status diagnostic checked by the merged openclaw#144761 temporal-ranking fixture without changing schema or recovery behavior.

Validated with 53 focused tests using the exact merged fixture. Incremental P2 review found no actionable issues; the previously recorded path-trigger recovery limitation remains unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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.

1 participant