OpenViking icon indicating copy to clipboard operation
OpenViking copied to clipboard

[Bug] Silent context-size drops: INPUT_TOO_LARGE semantic jobs are dropped with no queue-visible error trace

Open procesd opened this issue 3 months ago • 2 comments

Summary

When a VLM model returns a context-length error (input exceeds the model's maximum context window), the semantic processor silently drops the job — no requeue, no failed-queue entry, and queue status shows 0 errors. The only trace is a log line. Operators have no way to discover that semantic coverage is missing from affected directories.


Code

# semantic_processor.py:483-494
error_class = classify_api_error(e)
if error_class == ERROR_CLASS_INPUT_TOO_LARGE:
    logger.error(
        f"Input too large processing semantic message, dropping: {e}",
        exc_info=True,
    )
    if msg is not None:
        self._merge_request_stats(msg.telemetry_id, error_count=1)
        get_request_wait_tracker().mark_semantic_failed(
            msg.telemetry_id, msg.id, str(e)
        )
    self.report_error(str(e), data)
    # Returns None — job is gone

ERROR_CLASS_INPUT_TOO_LARGE is matched from patterns in model_retry.py:26–41 including "context window exceeded", "maximum context length", "too many input tokens", "exceeds the context length".

The error IS tracked internally — _merge_request_stats at line 490 increments error_count and mark_semantic_failed updates the wait tracker. But the observer queue's queue status shows error_count: 0 because the job simply disappears: there is no failed-queue retention, and the per-request stats are transient (consumed on poll).

For comparison: transient errors (lines 507–517) ARE re-enqueued; permanent/auth errors (lines 495–506) are dropped but logged critically. Context-size drops are the only category that is both dropped AND invisible to operator tooling.

Real-world impact

On a deployment using qwen2.5vl with a 32K context window, large resource directories routinely exceed the limit. Logs show:

WM creation failed with 34,843 / 39,574 / 60,974 tokens > 32768 ctx

These directories get no L0 semantic coverage (no abstract.md, no overview.md), but the queue reports clean — no errors, no pending retries. The gap is only discoverable by manually inspecting the filesystem or running a full reindex and watching for the same failures to repeat.

Reproduction

  1. Import a resource directory with enough children that the combined content + image tokens exceed the VLM's context window
  2. Wait for the semantic queue to process it
  3. Observe: queue status shows no errors, but the directory has no .abstract.md / .overview.md

Environment

  • OpenViking v0.4.12 (AGPL-3.0), self-hosted
  • VLM: llama.cpp qwen2.5vl Q4_K_M (32K ctx, RTX 2060 6GB, single slot)
  • Config: max_concurrent=2, timeout=900

Desired behavior

At minimum, INPUT_TOO_LARGE drops should be visible in queue status — the error_count should reflect them, or a separate dropped_count field should track them. Better: annotate the affected directory with an error marker (e.g., a .semantic_error.md sidecar or a metadata field) so that ov system consistency can flag the gap without a full reindex. Even better: fall back to a text-only L0 generation for directories that exceed the VLM context window (skip images, generate from file summaries alone).

procesd avatar Aug 08 '26 17:08 procesd

Related: #3891 (coalesce persistence bug). These two issues multiply each other: the per-file enqueue creates the flood, and the in-memory-only coalesce map means a restart makes every queued job live again.

procesd avatar Aug 08 '26 17:08 procesd

Thanks for your contribution. We will fix this in a future release.

As a temporary workaround, you can adjust the turns of commit, or add a threshold to limit the maximum usage of the model in advance.

yeshion23333 avatar Aug 14 '26 02:08 yeshion23333