Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.
Python agent-contextagent-memoryagent-pluginsagentic-ragcontext-databasedsh-pluginknowledge-basememorymemory-managementself-evolvingvector-database
fix(resource): report a queued reason commit as accepted (#6157)
马云祥f64fb5ba7783
diff --git a/docs/en/api/02-resources.md b/docs/en/api/02-resources.mdindex 74ad605f1..10d0d5138 100644--- a/docs/en/api/02-resources.md+++ b/docs/en/api/02-resources.md@@ -622,7 +622,7 @@ task_id uuid-xxx| `errors` | array | List of errors encountered during processing || `warnings` | array | Optional warnings, including partial processing or memory-linking failures || `queue_status` | object | Queue summary when waiting synchronously or reading a completed task result; grouped by queue with `processed`, `requeue_count`, `error_count`, and `errors` |-| `memory_linking` | object | Optional result of linking the resource URI to memories generated from `reason` |+| `memory_linking` | object | Optional result of linking the resource URI to memories generated from `reason`. `status="accepted"` means the memory commit is queued, not finished: poll `commit_task_id` via `/api/v1/tasks/{task_id}` for its result |**Completed add-resource task result**diff --git a/docs/zh/api/02-resources.md b/docs/zh/api/02-resources.mdindex 9e4686cb5..4a56b6e2e 100644--- a/docs/zh/api/02-resources.md+++ b/docs/zh/api/02-resources.md@@ -621,7 +621,7 @@ task_id uuid-xxx| `errors` | array | 处理过程中的错误列表 || `warnings` | array | 可选警告,包括部分处理失败或资源记忆关联失败 || `queue_status` | object | 同步等待或已完成任务结果中的队列汇总,按队列返回 `processed`、`requeue_count`、`error_count` 和 `errors` |-| `memory_linking` | object | (可选,仅当 `reason` 触发记忆生成时)本次资源 URI 与用户记忆的关联结果 |+| `memory_linking` | object | (可选,仅当 `reason` 触发记忆生成时)本次资源 URI 与用户记忆的关联结果。`status="accepted"` 表示记忆提交已入队、尚未完成,需轮询 `/api/v1/tasks/{task_id}`(`commit_task_id`)获取结果 |**完成后的资源添加任务结果**diff --git a/openviking/service/resource_memory_link_service.py b/openviking/service/resource_memory_link_service.pyindex aa73a77c2..d28ac37db 100644--- a/openviking/service/resource_memory_link_service.py+++ b/openviking/service/resource_memory_link_service.py@@ -155,9 +155,11 @@ class ResourceMemoryLinkService:) -> Dict[str, Any]:"""Queue add-resource reason extraction as a normal session commit.- Returns once the commit is queued. Every reason commit serializes on one- shared session, so waiting for it here held the caller behind all earlier- reason commits (one stalled commit could block resource ingestion).+ Returns ``status="accepted"`` once the commit is queued; poll+ ``commit_task_id`` through the Task API for its result. Every reason commit+ serializes on one shared session, so waiting for it here held the caller+ behind all earlier reason commits (one stalled commit could block resource+ ingestion)."""reason = (reason or "").strip()if not reason:@@ -209,7 +211,7 @@ class ResourceMemoryLinkService:)return {- "status": "success",+ "status": "accepted","session_id": session_id,"commit_task_id": commit_result.get("task_id"),"archive_uri": commit_result.get("archive_uri"),diff --git a/tests/service/test_resource_memory_link_service.py b/tests/service/test_resource_memory_link_service.pyindex 51058a8f0..7136ca46d 100644--- a/tests/service/test_resource_memory_link_service.py+++ b/tests/service/test_resource_memory_link_service.py@@ -224,7 +224,7 @@ async def test_on_resource_added_bridges_reason_through_fixed_session(request_co)session_id = result["session_id"]- assert result["status"] == "success"+ assert result["status"] == "accepted"assert session_id == _RESOURCE_REASON_SESSION_IDassert session_service.got == [{@@ -285,7 +285,7 @@ async def test_on_resource_added_returns_once_reason_commit_is_queued(request_cotimeout=3,)- assert result["status"] == "success"+ assert result["status"] == "accepted"assert result["commit_task_id"] == "reason-task"@@ -338,7 +338,7 @@ async def test_on_resource_added_reuses_same_reason_session(request_context):release.set()results = await asyncio.wait_for(asyncio.gather(first, second, worker), timeout=3)- assert all(result["status"] == "success" for result in results)+ assert all(result["status"] == "accepted" for result in results)assert all(result["session_id"] == _RESOURCE_REASON_SESSION_ID for result in results)assert [call["session_id"] for call in session_service.committed] == [_RESOURCE_REASON_SESSION_ID