Ingest stores the fake LLM's echo as chunk descriptions when `llm.provider` is `fake`, and no op clears them

Aperta
#1,557 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@orshih6 ci sta già lavorando.

Dal 28/11/2026.

  • #1679 di @orshih6 — aperta

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
clickhouse, python
Ambito
databases, search

Direzione di ricerca

Start with the named paths server/settings/catalog.py, pass_stream.py, server/llm/fake.py, describe, and ingest.py to trace how provider selection reaches chunk storage. Then read the code.index_status, health, and loom code describe entry points named in the issue. Done means fake or unavailable providers cannot store echoed text as LLM descriptions, status reports the condition, and an in-place reset can restore structural context and re-embed affected chunks.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug help wanted up-for-grabs

TL;DR: With the fake LLM provider, ingest stores the fake client's echo text as chunk descriptions and embeds it (39,506 of 1,387,613 chunks on our deployment), and there is no in-place way to clear them. This asks that the writer skip a fake provider, that status warn, and for a reset operation.

Company

Lumnus

Component

Code index

Describe the situation

Two parts, one cause.

Bug. With llm.provider = fake (the setting for a deployment without an LLM, and the test default), ingest still writes LLM context descriptions. LOOM_CODE_CONTEXT_DESCRIPTION_ENABLED defaults to true (server/settings/catalog.py:1596), and pass_stream.py:99 reads only that flag before it calls get_llm_client(), which returns the FakeLLMClient for provider fake. The fake client's default branch answers [fake-synthesis: <model>] <user[:200]> (server/llm/fake.py:267). describe._describe_new_chunks keeps that string as the chunk's description, and ingest.py:621 stores it with context_source='llm'. The description is part of context_text, which is what gets embedded, so the vector is computed from text containing the echo.

llm_is_fake() (server/llm/client.py:116) exists, but only health.py:98-105 and identity/app/namespace_inventory.py:105 read it, both informational. No writer checks it, and nothing in code.index_status or the health output says that the description writer is on while the provider is fake. The same applies when a keyed provider's API key is missing: _build_llm_client falls back to the fake client with a log line, and the writer carries on.

Measured on our deployment (loom.code_chunks FINAL, live rows, tombstoned_at IS NULL): 39,506 of 1,387,613 chunks (2.8%) have context_source='llm', and every one of those descriptions starts with the fake prefix; none has another. They sit in five namespaces: mirrors and forks of vLLM, vllm-xpu-kernels and OpenClaw, and one more repository. Only function and class chunks of commits a pass ingested are described (describe._DESCRIBE_KINDS), so the share is small. Search results show the echo as the unit's description.

Missing recovery. Once the rows exist there is no way back in place. Ingest is content-addressed (server/code/domain/extract/chunker.py:118, chunk_id from path, scope and a content hash; ingest.py:516-517 inserts only ids that are not live), so a re-index or a backfill --paths-file repair keeps the described rows unchanged, since the description is not part of the id. loom code describe only adds descriptions and skips rows that are already llm. loom code answers-purge covers code_answers only. The route that does clear them is code.repo.remove, then erasure.request with scope namespace, then re-adding the repository and a full backfill --phase index and --phase embed, which re-embeds everything.

Does it reproduce on the latest release or main?

Yes

How to reproduce
  1. Settings: llm.provider: fake (or LOOM_LLM_PROVIDER=fake), no LOOM_CODE_CONTEXT_DESCRIPTION_ENABLED override, a small repository added with code.repo.add.

  2. Let the worker's ingest pass index a commit of that repository (or run code.refresh for the namespace). loom code backfill --phase index stores stubs through ingest_file without a client and describes nothing.

  3. Count the contaminated rows:

    SELECT count()
    FROM loom.code_chunks FINAL
    WHERE context_source = 'llm'
      AND startsWith(context_description, '[fake-synthesis:')
      AND tombstoned_at IS NULL
    

    The count is non-zero and rises with each commit a pass indexes; it counts the function and class chunks of those commits. The same query without the startsWith line returns the same number, so no llm row has a real description. GET /health reports fake_llm, and code.index_status reports nothing about it.

  4. A second ingest of the same commit, or backfill --paths-file over the same files, changes nothing: the rows are kept.

Expected performance
  1. A fake or absent provider does not run the description writer. In pass_stream.py, a describe flag that is true while llm_is_fake() is true falls back to llm=None (structural context, context_source='structural') with a clear log line, or refuses the pass with a clear error. Either way the fake echo is never stored as llm. The same check fits loom code describe, which calls get_llm_client() directly.
  2. code.index_status and health warn when the writer is enabled while the provider is fake (or a keyed provider's key is missing), and report the number of context_source='llm' rows whose description came from the fake client, if that is cheap to know.
  3. An op to reset or re-describe descriptions in place, for example loom code describe --reset or code.describe_reset, with a dry run by default and --apply, like answers-purge. It returns context_source='llm' rows (optionally filtered by --llm-model fake-echo-1, namespace or path) to structural context, rebuilds context_text, and re-embeds only the affected chunks. Recovery then needs neither erasure nor a full re-index, and the same op serves a provider or model upgrade, the way answers-purge serves code.ask.
Environment

Loom 1.3.0 (Helm chart 0.3.0), ClickHouse 26.10 self-managed, Kubernetes. The code paths cited are as of upstream 8ce2640dd and match 1.3.0.

Related issues and pull requests

Related: https://github.com/ClickHouse/loom/pull/810 documents that the fake LLM returns deterministic text for development and tests. This issue is that text reaching the code index.

How this was found

Found and reproduced on our deployment with AI assistance.

Redaction
  • I removed tokens, keys, passwords and personal or customer data from everything above.
Lingua principale
Python
Stelle
263
Fork
47
Merge medio
14h 21m
PR unite (30g)
873

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ClickHouse/loom

Tutte le issue di ClickHouse/loom

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.