Skip to content

fix(ai): reviews ask an unserved embedding model on every lookup and search with a hash fallback #945

Closed

Description

@dan-petty

Problem

A review against a gateway whose backends serve only the review model asks for the embedding model again and again, and every request fails. The owner's setup (2026-10-02) does exactly that:

  • Every backend serves devops-review, and Ollama loads one model.
  • The gateway routes bge-m3:latest to ollama-16gib and ollama-24gib, the same nodes that served review traffic in session 20261001-224227.
  • ai.tasks.embedding points at the gateway with bge-m3:latest.

Reproduced offline: _collect_rag_verification_blocks over five findings, with Qdrant reachable and the embeddings endpoint returning HTTP 400 for bge-m3:latest, gives:

  • five embedding requests, one per finding, each logging WARNING OpenAI embeddings failed: OpenAI embeddings HTTP 400: … Using fallback.
  • context blocks, built from a Qdrant search run with a hash vector rather than an embedding.

Cause

  1. No memory of the failure. Every RAG lookup sends a fresh embedding request, and only the query text is cached:

    • verification, per finding (ai/review/verification.py, _collect_rag_verification_blocks);
    • payloads, per file (ai/review/pipeline.py:1240);
    • pre-analysis (ai/analyze/outlines.py);
    • each persona agent prompt (ai/agents/agent.py).

    On a node that loads one model, a request for an embedding model that is installed there can also evict the review model.

  2. A failed embedding becomes a fake vector.

    • EmbeddingsEngine._embed_openai and the Ollama path (_embed_batch_with_subdivision) return _deterministic_fallback, a hash of the text, instead of failing.
    • _dispatch_embed does the same when no provider is configured.
    • Retrieval then searches Qdrant with noise and can hand unrelated chunks to the verifier as context.
    • Ingestion (devops rag ingest, devops ai ingest) would store the same noise.

Acceptance criteria

  • No fallback. Embeddings either come from a model or raise EmbeddingsError, which names the model, the endpoint or nodes, and the HTTP status or error. _deterministic_fallback, EmbeddingVector and EmbeddingList are deleted, with no shim.
  • Retrieval fails clearly. A query that cannot be embedded raises from SemanticRetriever.search / retrieve_context. The builtin RAG tool returns a message naming the failure, as it does when Qdrant is unreachable.
  • RAG stops for the run. The first EmbeddingsError in investigate_rag_context turns RAG off for the rest of the process. It logs one WARNING (text in lang/en) naming the model and the error, and saying how to fix it: serve the model, point ai.tasks.embedding at a backend that serves it, or set ai.rag.enabled: false. Later calls return None without building a retriever or sending a request. clear_investigation_cache() resets this.
  • Tests, offline:
    • Five findings make at most one embedding request and produce no context blocks: tests/test_review_embeddings_unserved.py, written first, which fails on today's code.
    • Exactly one warning is logged.
    • The Ollama path raises after every node fails.
    • No provider configured raises.
  • uv run devops ci passes.

Key questions

  • Keep RAG in reviews at all? Yes (proposed). It is still opt-out with ai.rag.enabled: false, and the run-wide stop limits a broken embedding setup to one request per run.
  • Drop the fallback, or only keep it out of retrieval? Drop it (proposed). It also writes noise into Qdrant on ingestion, and pre-1.0 takes no shims.

Activity

  1. added this to the v0.2.25 milestone on Oct 2, 2026
  2. added
    type/bug
    scope/ai
    priority/p1-high
    on Oct 2, 2026
  3. dan-petty commented on Oct 2, 2026

    @dan-petty
    OwnerAuthor

    Closed by #971, merged into release/v0.2.25.

    GitHub only acts on closing keywords when a pull request merges into the default branch, so this was closed by devops gh issues close-merged.

  4. added a commit that references this issue on Oct 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority/p1-highscope/aitype/bug

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions