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:
- Queries docs where
embedded_at IS NULL
- Attempts to embed them with the configured model
- Logs successes/failures
- 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)
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_searchtriggers FTS reindex but explicitly skips embedding (embedded_atstays NULL).Current behavior
cli/ui.rs:323)embedded_atmemory_searchcallconfig_manager reloadImpact
api_keymisconfig (bug: three API keys in keys.toml silently dropped — never merged into runtime config #1065), the fix has no effect until restartmemory/YYYY-MM-DD.mdfiles created during a long-running session never get vectorsProposed fix
Add a background periodic task (e.g. every 5 minutes) that:
embedded_at IS NULLThis is especially important because
config_manager reloadshould be able to pick up a newly fixed embedding API key without requiring a restart.Environment
text-embedding-v4(Aliyun DashScope)~/.opencrabs/profiles/ops/memory.db(43 MB, 589 chunks, 1 vectorized)