Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

fix(resource): preserve synchronous ingestion errors (#3698)

Qin Haojied30f49be6fb9
diff --git a/openviking/service/resource_service.py b/openviking/service/resource_service.py
index a5cff97fd..f7cc59ca5 100644
--- a/openviking/service/resource_service.py
+++ b/openviking/service/resource_service.py
@@ -1038,6 +1038,8 @@ class ResourceService:
get_current_telemetry().set("resource.flags.wait", wait)
if not wait:
return result
+ if result.get("status") == "error":
+ return result
from openviking.service.task_tracker import TaskStatus, get_task_tracker
task_id = result["task_id"]
diff --git a/tests/server/test_api_resources.py b/tests/server/test_api_resources.py
index 9ddecf0cc..5c3b14422 100644
--- a/tests/server/test_api_resources.py
+++ b/tests/server/test_api_resources.py
@@ -352,14 +352,18 @@ async def test_add_resource_business_error_uses_error_envelope(
service,
monkeypatch,
):
- async def fake_add_resource(**kwargs):
+ async def fail_during_ingestion(**kwargs):
return {
"status": "error",
"errors": ["Parse error: boom"],
"source_path": kwargs["path"],
}
- monkeypatch.setattr(service.resources, "add_resource", fake_add_resource)
+ monkeypatch.setattr(
+ service.resources,
+ "_execute_resource_ingestion",
+ fail_during_ingestion,
+ )
resp = await client.post(
"/api/v1/resources",