[Bug] Wiki asset metadata not persisted after ingestion pipeline completes

Author: Mors-DeSuperCreated Sep 1, 2026Updated Sep 17, 2026
Labelsbuggood first issue线下活动专属

OpenClaw Version | OpenClaw 版本

none

Plugin Version | 插件版本

agentmemory/memory-hub:latest (2026-08-25 or newer)

Operating System | 操作系统

macOS Sonoma (Darwin 25.5.0) / Docker Desktop

System Specification | 系统配置

M4 Ultra, 48GB

Describe the bug | 问题描述

When ingesting a large batch of documents (700 markdown files) into a TencentDB wiki, the ingestion pipeline completes successfully, but the wiki asset metadata is never committed to the database. The asset exists on disk but is unretrievable via the API.

To Reproduce | 复现步骤

  1. Create wiki via API:

    bash
    curl -X POST http://localhost:8424/v3/wiki/create \
      -H "Content-Type: application/json" \
      -H "x-tdai-service-id: default" \
      -d '{
        "service_id": "default",
        "team_id": "test-team-123",
        "name": "Test Wiki"
      }'
    Response: {"data":{"wiki_id":"wiki-abc123"}}
  2. Upload files in batches (10 files per batch, as per API limit): curl -X POST http://localhost:8424/v3/wiki/raw/write
    -H "Content-Type: application/json"
    -H "x-tdai-service-id: default"
    -d '{ "service_id": "default", "team_id": "test-team-123", "wiki_id": "wiki-abc123", "files": [ {"filename": "doc1.md", "content": "..."}, {"filename": "doc2.md", "content": "..."}, ... ] }' All requests return 200 OK

  3. Trigger ingestion pipeline: curl -X POST http://localhost:8424/v3/wiki/ingest
    -H "Content-Type: application/json"
    -H "x-tdai-service-id: default"
    -d '{ "service_id": "default", "team_id": "test-team-123", "wiki_id": "wiki-abc123" }' Response: {"code": 0, "data": {"status": "pending"}}

  4. Wait for pipeline to complete (monitor logs for [wiki-ingest-llm] LLM 调用完成).

  5. Check wiki status: curl -X POST http://localhost:8424/v3/wiki/list
    -H "Content-Type: application/json"
    -H "x-tdai-service-id: default"
    -d '{"service_id": "default", "team_id": "test-team-123"}'

    Expected: { "data": { "items": [{ "wiki_id": "wiki-abc123", "status": "ready", "page_count": 700 }] } }

    Actual: { "data": { "items": [{ "wiki_id": "wiki-abc123", "status": "failed", "internal_status": "ingesting", "page_count": null }] } }

  6. Try to retrieve files (should work but doesn't): curl -X POST http://localhost:8424/v3/wiki/raw/list
    -H "Content-Type: application/json"
    -H "x-tdai-service-id: default"
    -d '{"service_id": "default", "team_id": "test-team-123", "wiki_id": "wiki-abc123"}'

    Response: 404 Not Found ❌

Expected behavior | 预期行为

After calling /v3/wiki/ingest, the wiki should:

  1. Accept file uploads (200 OK)
  2. Process documents via LLM pipeline (embedding, summarization)
  3. Persist asset metadata to knowledge.db** ← THIS FAILS
  4. Return the wiki with page_count populated
  5. Be retrievable via /v3/wiki/raw/list

After ingestion:

  • All 700 files uploaded successfully (70 batches, 200 OK each)
  • LLM processing completes (logs show: [wiki-ingest-llm] LLM 调用完成)
  • Wiki metadata never written to database
  • /v3/meta/asset/get returns 404 every time
  • /v3/wiki/raw/list returns 404 despite files physically stored on disk
  • ❌ MemoryPanel UI shows "Operation Failed: The knowledge base resource does not exist or has been deleted"

Impact: Files are safely stored on disk but completely inaccessible via API.

Error Logs / Screenshots | 报错日志/截图

Container Logs (Relevant Excerpt)

Successful ingestion processing: 2026-09-01 00:51:32.232 [INFO ] [wiki-ingest-llm] LLM 调用完成 [generate:.agents__rules__commits.md] {"ms":242906,"promptTokens":1830,"completionTokens":1310} 2026-09-01 00:51:32.245 [INFO ] [wiki-ingest] extractSource 完成 {"source":".agents__rules__commits.md","candidates":6,"warnings":0}

Metadata retrieval fails repeatedly: {"time":"2026-09-01T00:51:29.759Z","level":"warn","msg":"[...] api.remote.error","path":"/v3/meta/asset/get","durationMs":6,"envelopeCode":404,"envelopeMessage":"asset_not_found: not found: wiki-y546lzm3"}

Pattern: Every API call to retrieve the wiki gets 404, even though:

  • Files are on disk: docker exec tdai-memory-hub ls -lh /data/knowledge/default/team-ci3zd3we43/wiki-y546lzm3/ shows 700 files
  • Index exists: index.db is 300KB (actively being written to)
  • But metadata never registered in knowledge.db

Additional context | 补充信息

Disk Evidence

Files ARE stored successfully: $ docker exec tdai-memory-hub find /data/knowledge/default/team-ci3zd3we43/wiki-y546lzm3/ -type f | wc -l 700 files present

$ docker exec tdai-memory-hub du -sh /data/knowledge/default/team-ci3zd3we43/wiki-y546lzm3/ 316K total (301K index.db + 15K supporting files)

Root Cause Analysis

The gap is in the metadata layer:

  • Ingestion worker: Processes files, writes to /data/knowledge volume
  • Knowledge.db transaction: Never commits the asset record
  • API layer: Queries working, but finding no asset in metadata

This suggests the ingestion worker completes without finalizing the metadata transaction that would make the asset discoverable.

Source: TencentCloud/TencentDB-Agent-Memory