Skip to content

fix(memory-core): emit one degraded sqlite-vec warning per manager#67898

Merged
obviyus merged 7 commits into
openclaw:mainfrom
rubencu:codex/dedupe-memory-vector-warning
Apr 17, 2026
Merged

fix(memory-core): emit one degraded sqlite-vec warning per manager#67898
obviyus merged 7 commits into
openclaw:mainfrom
rubencu:codex/dedupe-memory-vector-warning

Conversation

@rubencu
Copy link
Copy Markdown
Contributor

@rubencu rubencu commented Apr 17, 2026

Summary

  • Problem: when sqlite-vec is unavailable, memory indexing can emit the same degraded-state warning repeatedly across many file writes in the same manager lifecycle.
  • Why it matters: gateway:watch gets flooded with duplicate degraded-memory warnings, which makes it harder to spot the first failure and any unrelated follow-on errors.
  • What changed: memory-core now emits a single manager-level degraded warning and suppresses duplicate repeats for the same manager instance.
  • What did NOT change (scope boundary): this does not restore vector indexing or change fallback behavior when sqlite-vec is missing; it only fixes repeated warning emission.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #
  • Related #
  • This PR fixes a bug or regression

Root Cause (if applicable)

  • Root cause: the degraded-vector warning was emitted from the per-write path, so one unavailable vector backend could produce many identical warnings during a single sync pass.
  • Missing detection / guardrail: there was no focused test pinning the warning-emission contract for the degraded sqlite-vec path.
  • Contributing context (if known): large memory corpora make the duplicate warning volume much worse because one degraded pass can touch many files.

Regression Test Plan (if applicable)

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file: extensions/memory-core/src/memory/manager-vector-warning.test.ts
  • Scenario the test should lock in: once sqlite-vec is known unavailable for a manager, repeated writes do not re-emit the same degraded-state warning.
  • Why this is the smallest reliable guardrail: the bug is in warning emission policy, so a focused unit test is the narrowest stable place to catch it.
  • Existing test that already covers this (if any): None.
  • If no new test is added, why not: N/A

User-visible / Behavior Changes

When vector indexing is degraded because sqlite-vec is unavailable, the gateway now logs that degraded state once per manager instead of repeating it for every file write.

Diagram (if applicable)

Before:
[sqlite-vec unavailable] -> [many file writes] -> [same degraded warning repeated]

After:
[sqlite-vec unavailable] -> [first degraded write] -> [one warning]
                                     -> [later writes] -> [duplicates suppressed]

Security Impact (required)

  • New permissions/capabilities? No
  • Secrets/tokens handling changed? No
  • New/changed network calls? No
  • Command/tool execution surface changed? No
  • Data access scope changed? No
  • If any Yes, explain risk + mitigation:

Repro + Verification

Environment

  • OS: macOS
  • Runtime/container: local dev checkout
  • Model/provider: N/A
  • Integration/channel (if any): memory-core indexing / gateway:watch
  • Relevant config (redacted): vector recall enabled with sqlite-vec unavailable

Steps

  1. Start the gateway with memory indexing enabled and sqlite-vec unavailable.
  2. Trigger memory sync for multiple files.
  3. Watch the logs.

Expected

  • One degraded vector warning for the manager.

Actual

  • Before this fix, the same degraded warning repeated across many file writes.

Evidence

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

  • Verified scenarios: focused unit coverage plus manual gateway:watch verification with the same degraded sqlite-vec condition.
  • Edge cases checked: the first degraded warning still emits; only duplicate repeats are suppressed.
  • What you did not verify: restoration of vector recall itself when sqlite-vec becomes available again.

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

Compatibility / Migration

  • Backward compatible? Yes
  • Config/env changes? No
  • Migration needed? No
  • If yes, exact upgrade steps:

Risks and Mitigations

  • Risk: operators see fewer repeated reminders about the same degraded state.
    • Mitigation: the first warning remains explicit and unchanged in meaning; only duplicate repeats are suppressed.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 17, 2026

Greptile Summary

This PR fixes repeated sqlite-vec degraded-state warnings in the memory-core extension by extracting the warning logic into a pure, testable function (logMemoryVectorDegradedWrite) and adding a per-manager boolean latch (vectorDegradedWriteWarningShown) that suppresses duplicate emissions. It also consolidates scattered vector-state resets into a single resetVectorState() method, ensuring the latch is cleared whenever the database connection is reopened (readonly recovery, atomic reindex, path migration).

Confidence Score: 5/5

Safe to merge — clean, well-scoped fix with no behavioral regressions and targeted test coverage for the changed warning policy.

All changed logic is correct: the latch is initialised to false, set on first degraded write, preserved across no-op early exits, and reset in every DB-reopen path. The resetVectorState consolidation is behaviorally equivalent to the three inline blocks it replaces. No P0 or P1 issues found.

No files require special attention.

Reviews (2): Last reviewed commit: "fix(memory-core): reset degraded warning..." | Re-trigger Greptile

Comment thread extensions/memory-core/src/memory/manager-vector-warning.test.ts
@obviyus
Copy link
Copy Markdown
Contributor

obviyus commented Apr 17, 2026

@greptile-apps review

Copy link
Copy Markdown

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

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: e8c2881a52

ℹ️ 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".

Comment thread extensions/memory-core/src/memory/manager-sync-ops.ts
@obviyus obviyus self-assigned this Apr 17, 2026
@obviyus obviyus force-pushed the codex/dedupe-memory-vector-warning branch from b659115 to 5f8e10a Compare April 17, 2026 05:38
Copy link
Copy Markdown
Contributor

@obviyus obviyus left a comment

Choose a reason for hiding this comment

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

Verified the degraded sqlite-vec warning path in memory-core and confirmed the fix now dedupes repeated per-file warnings without reintroducing spam after safe reindex rollback.

Maintainer follow-up: reset the warning latch only on real vector-state resets, preserved it across safe-reindex rollback, and added the unreleased changelog entry for this user-facing logging fix.

Local gate: pnpm test extensions/memory-core/src/memory/manager-vector-warning.test.ts extensions/memory-core/src/memory/manager.readonly-recovery.test.ts. Rebased-head pnpm tsgo still fails in unrelated qa-lab aimock files inherited from origin/main, not in the touched memory-core surface.

@obviyus obviyus merged commit 7b0e950 into openclaw:main Apr 17, 2026
26 checks passed
@obviyus
Copy link
Copy Markdown
Contributor

obviyus commented Apr 17, 2026

Landed on main.

Thanks @rubencu.

Copy link
Copy Markdown

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

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: 5f8e10a8ee

ℹ️ 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".

state.vectorReady = null;
state.vector.available = null;
state.vector.loadError = undefined;
state.resetVectorState();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep vector dims when readonly recovery lacks metadata

Switching readonly recovery to resetVectorState() clears vector.dims before readMeta() runs. If the reopened DB has a missing/corrupt meta row (so readMeta() returns undefined), we lose the last-known dimension and proceed with vector.dims unset; later ensureVectorTable only drops mismatched chunks_vec schemas when vector.dims is set, so an old-dimension table can survive and subsequent inserts fail after model/dimension changes. The previous code path preserved in-memory dims as a fallback in this exact recovery scenario.

Useful? React with 👍 / 👎.

kvnkho pushed a commit to kvnkho/openclaw that referenced this pull request Apr 17, 2026
…bencu)

* Agents: dedupe bootstrap truncation warnings

* Memory: dedupe sqlite-vec degradation warnings

* Memory: align degraded vector warning

* test(memory-core): remove stale vector warning arg

* fix(memory-core): reset degraded warning on vector reset

* fix(memory-core): preserve warning latch across reindex rollback

* fix: dedupe degraded sqlite-vec warnings (openclaw#67898) (thanks @rubencu)

---------

Co-authored-by: Ayaan Zaidi <hi@obviy.us>
Mquarmoc pushed a commit to Mquarmoc/openclaw that referenced this pull request Apr 20, 2026
…bencu)

* Agents: dedupe bootstrap truncation warnings

* Memory: dedupe sqlite-vec degradation warnings

* Memory: align degraded vector warning

* test(memory-core): remove stale vector warning arg

* fix(memory-core): reset degraded warning on vector reset

* fix(memory-core): preserve warning latch across reindex rollback

* fix: dedupe degraded sqlite-vec warnings (openclaw#67898) (thanks @rubencu)

---------

Co-authored-by: Ayaan Zaidi <hi@obviy.us>
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
…bencu)

* Agents: dedupe bootstrap truncation warnings

* Memory: dedupe sqlite-vec degradation warnings

* Memory: align degraded vector warning

* test(memory-core): remove stale vector warning arg

* fix(memory-core): reset degraded warning on vector reset

* fix(memory-core): preserve warning latch across reindex rollback

* fix: dedupe degraded sqlite-vec warnings (openclaw#67898) (thanks @rubencu)

---------

Co-authored-by: Ayaan Zaidi <hi@obviy.us>
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
…bencu)

* Agents: dedupe bootstrap truncation warnings

* Memory: dedupe sqlite-vec degradation warnings

* Memory: align degraded vector warning

* test(memory-core): remove stale vector warning arg

* fix(memory-core): reset degraded warning on vector reset

* fix(memory-core): preserve warning latch across reindex rollback

* fix: dedupe degraded sqlite-vec warnings (openclaw#67898) (thanks @rubencu)

---------

Co-authored-by: Ayaan Zaidi <hi@obviy.us>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
…bencu)

* Agents: dedupe bootstrap truncation warnings

* Memory: dedupe sqlite-vec degradation warnings

* Memory: align degraded vector warning

* test(memory-core): remove stale vector warning arg

* fix(memory-core): reset degraded warning on vector reset

* fix(memory-core): preserve warning latch across reindex rollback

* fix: dedupe degraded sqlite-vec warnings (openclaw#67898) (thanks @rubencu)

---------

Co-authored-by: Ayaan Zaidi <hi@obviy.us>
globalcaos pushed a commit to globalcaos/tinkerclaw that referenced this pull request May 13, 2026
…bencu)

* Agents: dedupe bootstrap truncation warnings

* Memory: dedupe sqlite-vec degradation warnings

* Memory: align degraded vector warning

* test(memory-core): remove stale vector warning arg

* fix(memory-core): reset degraded warning on vector reset

* fix(memory-core): preserve warning latch across reindex rollback

* fix: dedupe degraded sqlite-vec warnings (openclaw#67898) (thanks @rubencu)

---------

Co-authored-by: Ayaan Zaidi <hi@obviy.us>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
…bencu)

* Agents: dedupe bootstrap truncation warnings

* Memory: dedupe sqlite-vec degradation warnings

* Memory: align degraded vector warning

* test(memory-core): remove stale vector warning arg

* fix(memory-core): reset degraded warning on vector reset

* fix(memory-core): preserve warning latch across reindex rollback

* fix: dedupe degraded sqlite-vec warnings (openclaw#67898) (thanks @rubencu)

---------

Co-authored-by: Ayaan Zaidi <hi@obviy.us>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants