[Bug]: v0.5.3 — memory files written by session_commit sometimes get no vector record, and nothing is logged
Issue Origin
Observed or reproduced in a real environment
Bug Description
Some memory files that a session_commit writes to the memory tree never get a vector record. The file is on disk and readable via read/ls, but GET /api/v1/debug/vector/count?uri=<file> returns 0, so semantic search and auto-recall never return it. The server logs nothing for these files: no embedding error, no enqueue failure, no vectorize failure.
In one ~41-hour window (one server process, 2026-11-05 21:12 → 2026-11-07 14:46, local time UTC+8) 35 of the memory files written in that window had no vector record. Files written after that window are complete in the index.
I compared every memory file on disk with every URI returned by GET /api/v1/debug/vector/scroll, then looked at the per-archive memory_diff.json. The 35 files fall into two groups:
Group A: 21 files written by commits that completed successfully.
In each affected commit most files were indexed and only 1–2 were skipped. All of them are listed under operations.adds in that commit's memory_diff.json; none of them appear in any commit's operations.deletes. The skipped files were written in the same second as indexed siblings (see Actual Behavior).
Group B: 14 files that appear in no memory_diff.json at all.
Each was written shortly before a commit of the same session failed, for example:
events/2026/11/06/cleanup_window_error.mdwritten 14:12; that session's commit failed at 14:17 withMemory extraction aborted: Response was cut off by the output-token budgetevents/2026/11/06/视频题目定为Windows沙盒.mdwritten 16:08; that session's commit failed at 16:10 withAll credentials failed(429 from the VLM)
So files written early in apply_operations stay on disk after the commit fails, but they are never vectorized: vectorization only runs at the end (memory_updater.py line 1122), and a failed commit never gets there.
Steps to Reproduce
There is no deterministic repro; it happens intermittently under normal use:
- Run a single-node server (0.5.3, local vectordb, file task store) with
agent_evolutionenabled, so that onesession_commitwrites many files (events, cases, trajectories, experiences), several of them in the same second. - Let several clients (Claude Code / Codex / DSH plugins) commit sessions continuously for a day or two. Some commits will also fail (VLM 429, output-token cut-off, parse errors).
- Diff the memory tree on disk against
GET /api/v1/debug/vector/scroll(all pages). Some.mdfiles undermemories/have no vector record;GET /api/v1/debug/vector/count?uri=<file>returns0for them.
Expected Behavior
- Every memory file that ends up on disk after a commit has a vector record, or the skip is logged at WARNING with the URI and the reason.
- If a commit fails after some files were written, either those files are vectorized or the writes are rolled back.
Actual Behavior
Example timelines from two successful commits (times are UTC):
commit extracted_at 04:44:47Z (archive status: .done)
file mtime vector created path
04:40:26 04:40:26 events/2026/11/06/凭证获取迁入容器要求提出.md
04:40:26 (none) events/2026/11/06/首次登录方式确认.md <- no vector
04:40:26 04:40:26 events/2026/11/06/授权回调限制确认.md
04:40:26 04:40:26 events/2026/11/06/粘贴回调地址方案提议.md
04:44:47 (none) cases/凭证获取迁入容器.md <- no vector
04:44:47 04:44:47 experiences/容器凭证自动续期核实.md
04:44:47 04:44:47 experiences/第三方授权回调限制核实.md
commit extracted_at 06:47:53Z (archive status: .done)
06:47:53 06:47:53 experiences/开源仓库功能解读.md
06:47:53 06:47:53 experiences/协议端组件定位解释.md
06:47:53 (none) experiences/协议端对接框架评估.md <- no vector
06:47:53 06:47:53 experiences/同类插件补选核验.md (update)
06:47:53 06:47:53 experiences/群聊图片未唤醒诊断.md (update)
What the logs rule out. The server's stdout (stdlib logging) and stderr (loguru, which does record memory_updater errors in this window, e.g. write_stored_links: Failed to apply links ... File not found) contain none of:
Failed to vectorize memory(memory_updater.py:1941,tracer.error)Failed to enqueue memory for vectorization(memory_updater.py:1932)Error enqueuing embedding message/rejected work for Embedding(the #6322 path)Failed to generate embedding(embedding provider errors)
So Group A did not go through any branch of _vectorize_memories that logs something. In 0.5.3, the branches that skip a written/edited URI without any log are:
memory_updater.py:1841:if uri in deleted_set: continuememory_updater.py:1910-1911:EmbeddingMsgConverter.from_context()returnsNonewhen the vectorization text is empty (embedding_msg_converter.py:41-42), andif embedding_msg:has noelse. This happens whenviking_fs.read_file(uri)returns empty content.
I could not tell which of the two happened, because neither leaves a trace. Two possibly related observations: (2) would fit reading a file back while a concurrent same-second write is still landing; and twice in that window write_stored_links failed with File not found for other experience files in the same batch (2026-11-06 15:22:06 and 2026-11-07 14:00:35, local time), which matches the timestamps of skipped files.
Error Logs
# Nothing is logged for the affected files. The only memory_updater errors in that process's logs:
2026-11-06 15:22:06.957 | ERROR | openviking.session.memory.memory_updater:write_stored_links:162 - Failed to apply links to viking://user/default/memories/experiences/上游修复pr发布核对.md: File not found: ...
2026-11-06 15:22:06.972 | ERROR | openviking.session.memory.memory_updater:write_stored_links:162 - Failed to apply links to viking://user/default/memories/experiences/提交前脱敏扫描.md: File not found: ...
2026-11-07 14:00:35.434 | ERROR | openviking.session.memory.memory_updater:write_stored_links:162 - Failed to apply links to viking://user/default/memories/experiences/上游最小修复提交.md: File not found: ...
2026-11-07 14:00:35.466 | ERROR | openviking.session.memory.memory_updater:write_stored_links:162 - Failed to apply links to viking://user/default/memories/experiences/上游fork分支推送与pr创建.md: File not found: ...
OpenViking Version
0.5.3
Python Version
3.11
Operating System
Windows
Model Backend
Other (OpenAI-compatible: SiliconFlow BAAI/bge-m3 for embedding; OpenAI-compatible gateway with deepseek-v4-1-flash as VLM)
Additional Context
- Single-node self-hosted,
auth_mode=dev, local vectordb backend, file task store,agent_evolutionenabled. Clients: Claude Code plugin 0.7.22, Codex plugin, DSH memory plugin. - Workaround:
POST /api/v1/content/reindexwith{"uri": "<file or directory>", "mode": "vectors_only"}rebuilds the missing records; all 35 were restored this way. To find affected files, diff the memory tree againstGET /api/v1/debug/vector/scroll. - Suggestions:
- Log the two silent skip branches in
_vectorize_memoriesat WARNING (URI + reason, e.g.deleted_in_batch/empty_vectorization_text). - Right after
read_file, retry once when the content is empty but the file size is non-zero. - When a commit fails after
apply_operationshas written files, vectorize what was written (or roll it back), so that Group B cannot happen. - Optionally, a maintenance check (doctor or observer) that reports memory files without vector records.
- Log the two silent skip branches in
- Related: #6322 (closed) has the same symptom, but that path logs
Failed to enqueue memory for vectorization, which does not appear here. #7104 (open PR) touches_vectorize_memories(abstract building) but not these branches.
I’ll work on the missing diagnostic for the empty embedding-input path in _vectorize_memories and verify it with a regression case. This is a logging-only change for Group A. The intermittent cause and the partial-write behavior in Group B remain separate investigations. AI assistance is being used.
I reproduced a narrower path to an unindexed partial write on current main (14ce455d90c1) and the openviking==0.5.3 wheel, without a model call.
One ResolvedOperation can contain several URI targets (the isolation handler can produce these for multi-target memories). _apply_upsert writes them sequentially, but apply_operations records their successes only after the entire operation returns. If a later target fails, the earlier successful write is reported as an error too and never reaches _vectorize_memories.
Using the real StreamingMemoryUpdater.submit → append-only apply → MemoryUpdater → EmbeddingMsgConverter, an in-memory storage fixture, and a recording embedding-queue boundary:
| Controlled input | Stored files | Reported writes | Enqueued embeddings |
|---|---|---|---|
| Three nonempty targets, no failure | 3 | 3 | 3 |
Second target read raises PermissionError |
1 | 0 | 0 |
Second target write raises OSError |
1 | 0 | 0 |
Explicitly refreshing the first stored file's embedding then enqueues it successfully. This confirms a per-target bookkeeping gap, rather than empty embedding input, in this reproduction.
A focused fix is to account for each target as it succeeds and retain errors for failed targets, so successful files still follow the existing indexing path. The overall strict commit should continue to fail when a target fails; this does not require rollback or automatic re-extraction of already-applied work (consistent with the recovery boundary described in #6854).
This is not yet evidence that the reported 35 files followed this path, especially the successful-commit Group A or the VLM failures in Group B. The reproduction checks enqueueing, not vector-consumer completion, Windows storage, or a full server deployment. AI-only investigation, without human review.
Thanks for the detailed report. The output-token limit and VLM 429 errors explain why those session commits failed. They do not yet identify why particular stored files lack vector records, especially the files from successful commits.
To continue investigating the reported paths, could you provide:
- For one failed commit (Group B), the complete exception traceback, including nested causes, and a bounded server-log excerpt from the first memory write through the commit failure.
- For one successful commit (Group A), a server-log excerpt covering writes and indexing for one missing URI and one indexed sibling from that commit.
Please include the session/task/archive identifiers, affected URIs, and timestamps with timezone so the records can be correlated. If available, include the embedding message ID, processing outcome, and vector-store write result for the affected URI. Please retain surrounding log lines rather than only lines matching known error strings.
Please redact credentials and conversation content while keeping identifiers consistent. If enqueue/consumer details were not recorded, please say so; that is a diagnostic gap we need to distinguish from evidence that no message was enqueued.
Thanks for the detailed report. We’re closing this for now because the available evidence does not yet establish why the affected memory files lack vector records.
Please reopen if you have further evidence, such as a reproducible case or correlated logs tracing one affected URI from session commit through indexing to the vector-store write result. The session/task identifiers and timestamps would help connect those records; the previous comment lists the details needed.