[Bug]: add_resource --wait timeout returns no task_id; background pipeline keeps running with no way to poll
Issue Origin
Observed or reproduced in a real environment
Bug Description
add_resource (both HTTP API and ov add-resource --wait) returns a bare timeout error when the wait budget is exceeded, but the underlying embedding / summarization pipeline keeps running in the background and eventually succeeds. The client has no task_id in the timeout response, so there is no way to:
- Poll the actual completion status of the still-running task.
- Distinguish "timed out but succeeded in the background" from "genuinely failed".
- Cancel the task if we no longer want it.
The only workaround today is to fire a search against the expected content some time later and infer success from a hit — which is not deterministic and forces callers to hard-code arbitrary sleep loops.
Steps to Reproduce
- Import a mid-size resource (~5–20 MB of mixed text) with
--waitand a short-ish timeout that is realistic for a slow VLM backend:
ov add-resource /path/to/repo \
--to viking://resources/test-import/ \
--wait --timeout 60
- Wait for the client to return with a timeout error.
- Poll
viking_search "<known-content-from-repo>"in a loop.
Expected Behavior
When --wait times out but the task is still running, the response body should include a task_id (and ideally a poll_url), so the caller can:
ov task info <task_id> # -> pending | running | succeeded | failed
ov task cancel <task_id> # optional
This is already the shape of the connector_import TaskRecord introduced in v0.4.10 (#3084). Extending the same TaskRecord contract to all add_resource paths — not just Connector-delegated imports — would close the loop.
Minimum acceptable outcome:
- Timeout response contains
task_id. - A public
GET /tasks/<task_id>(andov task info <task_id>) returns terminal state. - The CLI prints a copy-pasteable follow-up hint on timeout:
Timeout after 60s. Task 8f3c...c1 still running.
Poll: ov task info 8f3c...c1
Cancel: ov task cancel 8f3c...c1
Actual Behavior
On timeout:
- HTTP response body carries only a timeout / deadline-exceeded error.
- CLI prints the timeout message and exits non-zero.
- No
task_idis surfaced. - The embedding pipeline continues in the background;
viking_searchcan eventually confirm success — but only if the caller keeps polling and knows what to search for.
Minimal Reproducible Example
try:
client.add_resource(
source="/path/to/repo",
to="viking://resources/test-import/",
wait=True,
timeout=60,
)
except TimeoutError as e:
# No task_id anywhere; nothing to poll.
print("failed?", e)
# The actual write may still land ~2-5 minutes later.
Error Logs
Timeout waiting for add_resource to complete (deadline=60s)
(No task_id or handle attached to the exception.)
OpenViking Version
0.4.7
Python Version
3.10
Operating System
Linux
Model Backend
Volcengine (Doubao)
Additional Context
- v0.4.10 already introduced
connector_importTaskRecord in #3084 for external Connector imports. This issue asks to unify: everyadd_resourceinvocation should own a TaskRecord that outlives the client wait window. - Related but distinct: #2383 (repeated
add_resourcestill re-embeds unchanged content) — orthogonal, sameadd_resourcefamily. - Companion issues in this batch: #3305 (
viking_readon directory URIs returning bareINVALID_ARGUMENT), and #3307 (content-awareadd_resourcewith--if-newer/--if-changed). All three sit under "makeadd_resource/readlifecycle observable and idempotent". - Contribution: happy to work on the CLI wiring for
ov task info/ov task cancelonce the server-side TaskRecord contract is extended.
我会去掉 add-resource wait timeout 的逻辑,如果需要timeout,可以在请求级设置超时
Thanks for reporting this! #4888 preserves the background task ID when add_resource --wait reaches its deadline. The HTTP error includes details.task_id, and the error message explains that only the wait ended and provides the status command:
ov task status <task_id>
The background task is not cancelled by this timeout. Closing as resolved on main. If a version containing #4888 still loses the ID, please reopen, or comment requesting reopening, with the server/client versions, request or CLI command and sanitized timeout response.