OpenViking icon indicating copy to clipboard operation
OpenViking copied to clipboard

Overview generation failure silently persists "[Directory overview is not generated]" placeholder as success, with no retry

Open pengfus opened this issue 4 months ago • 3 comments

Environment

  • OpenViking v0.4.5 (docker, ghcr.io/volcengine/openviking), also verified present in current main (as of 2026-07-10)
  • VLM: OpenAI-compatible endpoint, Qwen3-VL-8B-Instruct

Bug

When directory overview generation fails (in our case: VLM Request timed out on a large prompt), the exception handler in openviking/storage/queuefs/semantic_processor.py (_single_generate_overview, and the same pattern in _batched_generate_overview) swallows the error and returns a placeholder string:

except Exception as e:
    logger.error(f"Failed to generate overview for {dir_uri}: {e}", exc_info=True)
    return f"# {dir_uri.split('/')[-1]}\n\n[Directory overview is not generated]"

The placeholder is then persisted to .abstract.md exactly as if generation had succeeded. The semantic message completes normally, status reports complete, and there is no retry and no pending/failed marker. The directory permanently has no usable abstract until something else happens to re-trigger a refresh — content/abstract keeps serving the placeholder.

Reproduction

  1. Configure a VLM endpoint/model such that a large overview prompt exceeds the client timeout (default 60s; a directory with ~180 children abstracts against an 8B model reliably does).
  2. Trigger a semantic refresh of that directory (e.g. register a file into it).
  3. Log shows ERROR - Failed to generate overview for <uri>: Request timed out.
  4. .abstract.md of the directory now contains [Directory overview is not generated], no .overview.md; queue reports the message as processed successfully.

In our production instance this happened 17 times in a single day across different directories/sessions before we noticed.

Expected behavior

  • Recoverable errors (timeout, connection errors, 5xx) should be retried / requeued, not persisted as a fake result.
  • If a placeholder must be written, it should be an explicit failure marker that a later refresh (or a status API) can detect and repair — not indistinguishable-from-success.

Notes

  • Possibly related to #2797 (missing .abstract.md/.overview.md after reindex).
  • Workaround we use: raise the VLM client timeout via the timeout key in the vlm config section (default is 60.0 in models/vlm/base.py), then force a refresh by registering a temp file into the directory (upload path) and deleting it.

pengfus avatar Jul 11 '26 05:07 pengfus

单次生成失败:整次任务失败并进入现有重试流程。 批量生成部分失败:不能保存残缺摘要,整次任务也应失败。 最终合并失败:不能退化成第一批结果并标记成功。

wdsjjs avatar Jul 12 '26 10:07 wdsjjs

我准备处理这个问题。计划先补回归测试,覆盖单次 overview 生成失败、批次部分/全部失败以及最终 merge 失败;实现上让原始 VLM 异常穿过 SemanticDagExecutor,交给现有 classify_api_error / circuit breaker 流程处理,避免把占位或残缺摘要持久化为成功结果。本 PR 会保持范围聚焦,不同时重构通用重试上限或死信队列。

wdsjjs avatar Jul 12 '26 10:07 wdsjjs

Reproduced on v0.5.5 (bare metal, OpenAI-compatible local VLM) at a scale that makes the persistence aspect concrete.

What happened. A sitemap crawl (~50 page trees) was ingested as viking://resources/openviking-docs-* on 2026-11-04. Under the load spike, overview generation hit ModelError: Request timed out. for 174 distinct directory URIs. Per the URIs in the log, each failed exactly once — no second attempt ever.

Current state, ~3.5 weeks later: 366 .abstract.md sidecars whose body is still exactly the placeholder, i.e. treated as successfully generated:

grep -rl --include='.abstract.md' 'Directory overview is not generated' <data-dir> | wc -l
→ 366

(The count exceeds the original 174 because later rollups hit the same failure path too.) A minority of the originally-failed directories are fine now — but only where an unrelated later operation happened to re-trigger a refresh of that same directory. Nothing detects or repairs the placeholder systematically.

Two confirmations for this issue:

  1. The batching-gate fix from #3153 / #5243 is present in 0.5.5 (I verified entry_count = len(file_summaries) + len(children_abstracts) in semantic_processor.py), yet this defect persists unchanged — the gate reduces oversized prompts but does nothing on the failure path, as expected.
  2. semantic_processor._enqueue_semantic_retry + add_resource_processor._requeue_lock_handoff show the requeue machinery already exists in the codebase; what's missing is routing recoverable generation errors (timeout / connection / 5xx) into it with a bound, instead of _single_generate_overview / _batched_generate_overview catching Exception and returning a placeholder that the executor then persists as a success.

Related: #7034 (persistently-failing messages requeue without a cap). The two issues are complementary halves of one design: bounded retry for transient errors + an explicit pending/failed marker detectable by a status API or reconciler for permanent ones. Happy to work on a PR implementing that if the direction is agreed — we hit this in production and would maintain it.

mintleaf84 avatar Nov 29 '26 19:11 mintleaf84