Skip to content

Memory embeddings: no periodic backfill — failed one-shot leaves vectors at zero #1069

Description

@alexeyleshchenko

Problem

The memory embedding pipeline only runs once at startup. If the embedding API is unreachable or misconfigured at boot time, documents are permanently un-embedded until the next restart. There is no retry mechanism.

Additionally, documents created or modified mid-session (new daily memory logs, updated brain files) are never embedded — the freshness check on memory_search triggers FTS reindex but explicitly skips embedding (embedded_at stays NULL).

Current behavior

Phase When Embeds?
Startup backfill Once at boot (cli/ui.rs:323) Yes — but only for docs missing embedded_at
Freshness check Every memory_search call No — FTS only, skips embedding
Config reload config_manager reload No — embedding config is cached at startup

Impact

Proposed fix

Add a background periodic task (e.g. every 5 minutes) that:

  1. Queries docs where embedded_at IS NULL
  2. Attempts to embed them with the configured model
  3. Logs successes/failures
  4. Does NOT crash the agent if embedding fails (best-effort, retry next cycle)

This is especially important because config_manager reload should be able to pick up a newly fixed embedding API key without requiring a restart.

Environment

  • OpenCrabs v0.3.80
  • Embedding model: text-embedding-v4 (Aliyun DashScope)
  • DB: ~/.opencrabs/profiles/ops/memory.db (43 MB, 589 chunks, 1 vectorized)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions