Skip to content

blocker(kb): 6,741 documentation chunks and 11,241 code chunks are vectorised and chat's retrieval path queries neither #17625

Open
0 of 3 issues completed

Description

@mrveiss

The gap, measured on the live deployment

The owner's v0.9.0 directive is that knowledge "gets vectorised, graphed so it makes
sense when accessed via chat or via the llc module"
. It is vectorised. Chat cannot
reach it.

Measured on the local deployment, commit 9027bf7e6 before and after the run:

Chroma collection vectors
autobot_code 11,241
autobot_docs 6,741
autobot_memory 359
23 others 0, except three caches (79/10/10) and one with 1

POST /api/knowledge_base/search with {"query": "autobot"} returns total_results: 0 — HTTP 200, 29.6s.

So 6,741 chunks of AutoBot documentation and 11,241 of the codebase are indexed, and
the retrieval path the chat uses returns nothing for the most obvious query against
them.

What retrieval can see

A control proves the path works over the collection it does query. A fact created
through POST /api/knowledge_base/add_text was returned at score: 1.0 by a search
for its own wording, with full metadata. So the route, the embedding model, the
ranking and the metadata pass-through are all functioning — over autobot_memory
and the Redis fact store.

autobot_docs and autobot_code are not in that set. Nothing is broken inside the
search; the wrong collections are wired to it.

The documentation that cannot be reached is the best-described data in the system

A sample chunk from autobot_docs:

text: "# AutoBot Development Instructions  Index plus the rules that are catastrophic to miss..."
meta: file_path=CLAUDE.md  doc_type=project_rules  section="Introduction"
      chunk_index=0  total_chunks=10  tier=1  priority=critical
      source=autobot_documentation  indexed_at=2026-09-25T19:56:57Z
      lineage_version=1  title="AutoBot Development Instructions"  tags=...

Chunked with section titles, tiered, prioritised, lineage-versioned. That is richer
provenance than any of the five KB write legs produces (#17527) — and it is in the
collection retrieval does not query.

Why this was not obvious

GET /api/knowledge_base/stats reports:

total_documents: 359   total_chunks: 359   total_vectors: 359   total_facts: 1
categories: ["round-trip-17527"]

359 is autobot_memory's count alone. The endpoint names the field
total_documents and answers for one of at least three populated collections, so the
17,982 vectors in the other two are invisible to it. Reading that number as the store
is how I first concluded the knowledge base was empty — filed separately, because an
instrument that under-reports by 98% is its own defect.

Acceptance criteria

  • KnowledgeBase.search() queries the documentation and code collections, or the
    reason it does not is recorded where a reader will find it. If the split is
    deliberate — memory versus corpus — then chat needs a path that reaches the
    corpus, and that path is the deliverable.
  • A query for a phrase present in autobot_docs returns the chunk, demonstrated
    on the host with the deployed SHA recorded.
  • The LLC module's retrieval is checked the same way, not assumed to follow —
    Umbrella: knowledge base intake is built but two legs are severed — upload has no UI, transcriber output cannot land #17527's criterion is chat and LLC.
  • A test asserts which collections the retrieval path queries, so a collection
    added later is either included or explicitly excluded rather than silently
    unreachable.

The last criterion is the one that keeps this from recurring

Three collections exist, one is queried, and nothing anywhere states that as a
decision. A test naming the queried set turns it into a claim someone has to maintain.

Related

#17527 (the intake umbrella — its provenance criterion is not the blocker; this is).
#12733 (facts wiped in Redis while ChromaDB vectors remained — the same
two-stores-disagreeing family, from the other direction).

Activity

  1. added this to the v0.9.0 milestone on Sep 27, 2026
  2. mrveiss commented on Sep 27, 2026

    @mrveiss
    OwnerAuthor

    Root cause: the search path queries five collections and all five are empty

    The live log shows the request entering npu_semantic_search:

    15:06:29,205  api.knowledge_search - INFO - Search: 'RTRIP...' (mode=hybrid)
    15:06:29,619  npu_semantic_search  - INFO - Enhanced search: 'RTRIP...' (top_k=7)
    

    npu_semantic_search.py:224 defines every collection it will look in:

    self.collection_names = {
        "text":       "autobot_text_embeddings",
        "image":      "autobot_image_embeddings",
        "audio":      "autobot_audio_embeddings",
        "multimodal": "autobot_multimodal_fused",
        "code":       "autobot_code_embeddings",   # Issue #207
    }

    Those five, against the host's actual counts:

    collection the search queries vectors
    autobot_text_embeddings 0
    autobot_image_embeddings 0
    autobot_audio_embeddings 0
    autobot_multimodal_fused 0
    autobot_code_embeddings 0

    And the three that hold data, none of them in the map:

    populated collection vectors
    autobot_code 11,241
    autobot_docs 6,741
    autobot_memory 359

    The semantic search path queries five empty collections. That is the whole of why
    {"query": "autobot"} returns total_results: 0 while 6,741 documentation chunks are
    indexed.

    Why nobody caught it, and this is the part worth keeping

    The names are near-misses of each other:

    autobot_code_embeddings   (queried, empty)   vs   autobot_code   (11,241)
    autobot_text_embeddings   (queried, empty)   vs   autobot_docs   (6,741)
    

    A reader asking "does the search query a code collection?" sees
    autobot_code_embeddings and answers yes. A reader asking "is the code indexed?"
    sees 11,241 in autobot_code and answers yes. Both are right, and nothing in either
    view shows that the two names are different collections. The failure needs both halves
    in front of you at once, which is only true on the host.

    This also explains the result that looked contradictory: my probe fact was returned at
    score: 1.0 by a prose query. It came back through the hybrid mode's other half —
    the Redis fact store — not from any of the five. So one half of hybrid retrieval works
    over a corpus of one fact, and the vector half searches five empty collections.

    A second instrument disagrees with the host too

    cli/doctor.py:83 verifies ChromaDB collections exist:

    expected = {"autobot_docs", "code_kb"}

    There is no code_kb on the host, and code_kb appears nowhere else in the
    repository. So the doctor reports Missing collections: {'code_kb'} and offers a
    fixable repair that creates an empty sixth collection while 11,241 code vectors
    sit in autobot_code, which it does not check for. Three different names for the code
    corpus across three components, and no two agree.

    Revised acceptance criteria

    • The search path queries the collections that hold the corpus. Whether that means
      pointing the map at the populated names, or populating the mapped names, is the
      decision — and it needs stating, because the two produce different systems.
    • Collection names come from one place. Three components name the code corpus
      three ways (autobot_code, autobot_code_embeddings, code_kb); a constant or
      SSOT entry makes a mismatch a failed import rather than an empty result.
    • A startup or health check fails when a queried collection is empty or absent,
      rather than returning zero results. An empty collection currently produces a
      successful search with no hits, which is indistinguishable from a corpus that
      genuinely has no match.
    • cli/doctor.py checks the collections the application actually uses, and its
      repair does not create a collection nothing reads.
    • A test asserts the queried set against the written set, so an indexer writing a
      name the searcher does not query fails in CI.

    The third criterion is the one that would have caught this on day one

    Everything here reported success. The indexer wrote 17,982 vectors successfully. The
    search returned HTTP 200 successfully. The doctor would have offered a successful fix.
    Nothing asserted that the collection being searched had anything in it.

  3. mrveiss commented on Sep 27, 2026

    @mrveiss
    OwnerAuthor

    Correction to my root-cause comment above. The five empty collections are not what the search queries — I traced the map and not the call path.

    What I said, and why it was wrong

    I wrote that npu_semantic_search.collection_names is "every collection it will look in". It is not. That map is used in exactly one place — the init loop at :1100, which creates each collection if absent. Nothing queries self.collections.

    The actual chain, followed to the collection this time:

    api/knowledge_search.py            search request
      -> npu_semantic_search.enhanced_search        (the log line I anchored on)
        -> _execute_search_pipeline
          -> _perform_vector_search                 :339
             if self.knowledge_base.vector_store and self.knowledge_base.vector_index:
                 return await self._vector_similarity_search(...)
    

    and the knowledge base's vector store is one collection, named by config:

    # knowledge/base.py:90
    self.chromadb_collection = self.config_manager.get("memory.chromadb.collection_name", "autobot_memory")
    # knowledge/base.py:406
    self.vector_store = ChromaVectorStore(chroma_collection=raw_collection)

    ChromaVectorStore takes one collection. So:

    The retrieval path queries exactly one collection — autobot_memory, 359 vectors. Not five, not zero-of-five. autobot_docs (6,741) and autobot_code (11,241) have no reader anywhere in the retrieval path.

    What the five collections actually are

    Dead weight, created at startup by the init loop and never written or read. Their existence is a real defect — they are the reason a reader checking "does search cover code?" sees autobot_code_embeddings and answers yes — but they are not the cause of zero results.

    So my near-miss-naming observation stands as why this was hard to see, and is wrong as the mechanism. The mechanism is simpler and worse: one collection, single-collection by construction.

    Why the distinction changes the fix

    If the search had queried five wrong names, the fix would be a name map. It does not. ChromaVectorStore(chroma_collection=...) is one collection per store, so reaching the documentation corpus is a design question, not a rename:

    1. Index the docs into autobot_memory. No retrieval change; the corpus flows through the existing path. Costs a re-index of 17,982 vectors and merges three corpora with different chunking and metadata shapes into one collection.
    2. A second retriever over autobot_docs/autobot_code, fused at the search layer. Keeps the corpora separate, which their metadata already assumes — autobot_docs carries tier, priority, doc_type, section; autobot_memory carries fact provenance. Most work, and the only option where "which corpus answered" stays visible in a result.
    3. Point memory.chromadb.collection_name at autobot_docs. One config change, and wrong: it would make the documentation reachable and the fact store unreachable, trading one empty result for another.

    My recommendation is 2, because the two corpora are genuinely different — one is chunked documentation with section and tier metadata, the other is facts with ingest provenance — and #17527's criterion is that a retrieved thing can say where it came from. Fusing them into one collection (option 1) discards the distinction that criterion depends on.

    What I am fixing now, and what I am not

    Not the design. It needs the owner's call between 1 and 2, and picking wrong bakes in a retrieval architecture.

    Fixing, because each is unambiguous and independent of that call:

    • the init loop creating five collections nothing writes or reads;
    • no check that a queried collection is non-empty, so a successful search over an empty corpus is indistinguishable from no match;
    • cli/doctor.py expecting code_kb, which exists nowhere, and offering to create it.

    Method note

    I anchored on a log line, found a plausible mechanism twelve lines from it, and published before following the call path to the collection. The measurement — five collections, all empty — was correct; the claim about what queries them was not. Same shape as the stats endpoint that started this: correct number, wrong question.

  4. mrveiss commented on Sep 27, 2026

    @mrveiss
    OwnerAuthor

    Company tiering changes this, and it retires the recommendation I made two comments ago. Raised by the owner asking whether the design considers company-tiered knowledge and whether it covers the whole subtree. Two answers: yes, and no.

    Yes — a tiered, multi-collection, weighted retriever already exists

    llc/kb/inheritance.py, KbInheritanceResolver:

    async def get_query_collections(...)   # -> [(collection_name, weight), ...]
    async def search_with_collections(collections, ...)  # parallel RAG, re-ranked by weight

    It resolves a chain of per-company collections with weight decay per hop
    (current.kb_inheritance_weight), guards against circular parent_org_id, and searches
    them in parallel before re-ranking. The host confirms the collection shape exists:
    company_<uuid>, company_<uuid>_decisions, company_<uuid>_agents,
    project_<uuid>, work_item_<uuid>.

    And KnowledgeBase is built for it — knowledge/base.py:109:

    # Async ChromaDB client for callers that create/read sibling collections
    # (e.g. LLC per-company KB collections) — populated during _init_vector_store.
    self._async_chroma_client = None

    So multi-collection retrieval is not something to build. It exists, it is weighted,
    and it is tiered.
    What is true is that there are two retrieval architectures and
    only one of them is tiered:

    path mechanism collections
    chat KnowledgeBase.vector_store one — autobot_memory
    LLC rag_assembler + search_with_collections a weighted chain

    That retires my option 2 above ("build a second retriever, fuse at the search layer").
    The second retriever is already there; chat does not use it.

    No — it does not contain the subtree

    The walk is strictly upward:

    current = company
    while current:
        collections.append((f"{str(current.id)}:company", weight))
        if current.parent_org_id:
            ... current = <parent>;  weight *= weight_multiplier
        else:
            current = None

    Company → parent → grandparent → root. Ancestors only. A company sees what it
    inherits from above and never what its own sub-companies hold.

    I checked for a downward traversal before asserting the negative: nothing in
    autobot-backend/llc or autobot-backend/user_management queries organizations by
    parent_org_id == <node>. The children relationships that exist are on goals and
    work items, not organizations. So there is no subtree query to fix — there is none to
    begin with.

    The module's own docstring states the intent as one-directional: "Sub-companies
    automatically inherit parent company KB collections via read-through."
    That is a
    deliberate design, and "knowledge contains the whole subtree" is a different one.

    And the tiered collections are empty too

    Every per-company, per-project and per-work-item collection on the host holds 0
    vectors. So the tiered path has never carried anything either — the same condition as
    the five collections I misattributed earlier, and for the same reason: created, never
    written.

    Revised options

    1. Point chat's retrieval at the existing tiered resolver, and add the documentation
      and code corpora as tiers with their own weights. Reuses the weighting, the parallel
      query and the re-rank. Needs a decision on what weight a global corpus carries
      relative to a company's own knowledge.
    2. Add downward traversal, so a node's collections include its subtree. Independent
      of (1) and needed if "whole subtree" is the requirement — with two things to settle:
      the weight direction for descendants (inheritance decays upward today; a subtree
      needs its own rule), and whether a parent seeing a child's knowledge is an access
      decision rather than only a retrieval one.
    3. Index docs into autobot_memory — still the cheapest and still discards the corpus
      distinction, and now also bypasses the tiering entirely.

    Recommendation: 1 and 2 are separate pieces of work and 2 is the one that needs a
    ruling first
    , because it is a visibility question. Upward inheritance is safe by
    construction — a child seeing its parent's shared knowledge. Downward is not
    symmetric: a parent company reading a subsidiary's decisions collection may be exactly
    right or exactly wrong depending on what the tiers mean, and that is not a retrieval
    decision.

    Method note, third on this issue

    I recommended building a retriever that already existed, because I traced the chat path
    and stopped. The tiered one is in a sibling package I had already read for a different
    purpose — context_builder.py's sources came from this same module's resolver. Each
    correction here has narrowed the claim; each was caused by publishing before following
    the chain to its end.

  5. mrveiss commented on Sep 27, 2026

    @mrveiss
    OwnerAuthor

    Consolidated state, after the owner corrected two premises of mine. Two of my earlier claims were wrong and the blocker narrows to one sentence.

    What each collection actually holds

    collection vectors contents who reads it
    autobot_docs 6,741 AutoBot's own documentation, chunked with file_path, doc_type, section, chunk_index, tier, priority, lineage_version nothing in the retrieval path
    autobot_code 11,241 code-analysis findings, not code — "Problem: performance_nested_loop_complexity Severity: medium File: ... Line: 54", keyed by severity/problem_type/suggestion the LLC project findings feature
    autobot_memory 359 the KB's own vector store chat, via KnowledgeBase.vector_store
    5 × autobot_*_embeddings / _fused 0 nothing — created at startup by npu_semantic_search's init loop nothing
    company / project / work-item 0 nothing KbInheritanceResolver, when populated

    Correction 1 — there is no code corpus, so nothing about code retrieval is broken

    I reported "11,241 code chunks are vectorised and chat's retrieval path queries neither".
    Wrong. autobot_code is a findings index: 11,241 embedded problem reports with
    severity and suggestions, produced by the LLC project findings scan
    (POST /api/llc/projects/{id}/findings/scan). That is a product feature working as
    designed. Wiring it into chat retrieval would surface lint findings in answers to
    questions about code, which is not what anyone wants.

    Correction 2 — the documentation is not duplicated

    I expected autobot_docs content to also appear inside the codebase ingest, since the
    repository contains docs/. It does not: of 200 sampled autobot_code entries, 0
    have a docs/ or .md path, because that collection indexes findings keyed to source
    files rather than file contents. So there is no double-ingest to reconcile.

    What the blocker actually is

    AutoBot ships knowing about itself — 6,741 chunks of its own documentation, indexed by
    default — and chat cannot reach any of it.
    That is the whole of #17625 now. The code
    collection is a different feature; the tiered company collections are empty; the five
    *_embeddings collections are dead.

    Why tiering does not apply to this corpus, which narrows the fix

    The owner's note that an end user would not have AutoBot's codebase in their LLC settles
    the design question I was holding open. AutoBot's documentation is global: every
    deployment ships the same corpus, it is not company-scoped, and it does not belong in a
    company_<uuid> collection or inherit along a parent_org_id chain. So
    KbInheritanceResolver's weighted ancestor walk is the right mechanism for company
    knowledge and the wrong frame for this corpus.

    That removes option 2 from my previous comment (add docs as tiers in the inheritance
    chain) and leaves the question much smaller:

    1. A global corpus retriever alongside the company path, queried for every user,
      weighted below their own knowledge so a company's own answer wins a tie.
    2. Index the docs into autobot_memory. One re-index, no retrieval change, and the
      corpus distinction is lost — autobot_docs carries tier and priority that
      autobot_memory has no field for.

    Recommendation: 1. The documentation is the one corpus every deployment has, and
    option 2 discards the metadata that makes it useful — tier: 1, priority: critical on a
    CLAUDE.md chunk is exactly what a retrieval layer should rank on.

    Still open for the owner, and separate from the above

    Does knowledge cover the whole subtree? Today: no, ancestors only. That is a
    visibility decision, not a retrieval one, and it is independent of the documentation
    blocker. It stays open regardless of which option above is taken.

    Method note

    Four corrections on this issue, each narrowing the claim, three caused by publishing
    before following the chain to its end and one by reading an endpoint as the store. The
    measurements were right every time; the question each answered was not the one I
    reported it against.

  6. mrveiss commented on Sep 27, 2026

    @mrveiss
    OwnerAuthor

    The blocker is smaller than every framing I have given it, including the last one. The merge exists and is skipped.

    The owner's target: three default buckets

    bucket intent today
    AutoBot documentation ships by default, every deployment autobot_docs, 6,741 chunks, reader exists
    System knowledge the systems AutoBot interacts with no collection
    User knowledge every intake source autobot_memory — the one collection chat queries

    The reader and the merge both already exist

    DocIndexerService.COLLECTION_NAME = "autobot_docs" writes it, and search() reads it
    — with its docstring stating this exact purpose:

    Issue #4953: expose doc search so RAGService can merge results with the main KB,
    giving the agent access to AutoBot's own documentation.

    And services/rag_service.py:787 does the merge:

    if categories is None or "autobot_docs" in categories:
        doc_svc = get_doc_indexer_service()
        if doc_svc._initialized:
            doc_results = await doc_svc.search(query, n_results=max_results)
            if doc_results:
                combined = results + doc_results
                combined.sort(key=lambda r: r.hybrid_score, reverse=True)

    So #4953 built the reader, the merge was wired, and the embedding question I was about
    to guard against does not arise: search() embeds with the same _embed_model that
    wrote the collection, and _create_collection records embedding provenance (#10420).

    Measured: the merge is skipped, and the endpoint that skips it entirely is faster

    POST /api/knowledge_base/rag/advanced_search, {"query": "what are the 8 core rules"}:

    HTTP 200 in 1.99s
    results: []   total_results: 0
    documents_considered: 0   documents_loaded: 0   hybrid_search_enabled: false
    

    documents_considered: 0 — it never reached the corpus. The merge is gated on
    doc_svc._initialized, and DocIndexerService.search() has the same guard internally:

    if not self._initialized or self._collection is None or self._embed_model is None:
        return []
    doc_count = self._collection.count()
    if doc_count == 0:
        return []

    Three reasons to return [], all indistinguishable to the caller from "searched and
    found nothing" — over a collection holding 6,741 chunks.

    Meanwhile POST /api/knowledge_base/search never merges at all: autobot_memory only,
    29.6s, zero results.

    So the fix is not what I said three times

    Not a rename, not a second retriever, not a new RRF view. The narrow statement:

    The documentation merge exists and its initialisation gate is closed in the serving
    process, so 6,741 chunks are skipped silently while the endpoint that skips them by
    design answers faster.

    Revised acceptance criteria

    • Establish why _initialized is false in the serving process. The startup step
      logs ✅ [ 85%] Doc Index: Checking documentation index... and no outcome line
      follows it, so the check's result is not recorded either way.
    • search() distinguishes its three empty-return reasons. Not initialised,
      collection absent and collection empty are three different facts and one
      return value — the caller cannot tell any of them from "no match", which is why
      this survived with a populated collection.
    • The gate reports when it closes. if doc_svc._initialized: with no else branch
      means the documentation bucket silently leaves the result set.
    • POST /api/knowledge_base/search either merges the buckets or says it does not.
      Two endpoints with different corpora and no visible difference is how I spent an
      afternoon measuring the wrong one.
    • The system knowledge bucket exists, since the target is three and there are two.

    Method note, fifth correction

    Each framing was narrower and each was caused by the same thing: I measured an endpoint
    and reported it as the retrieval path. /api/knowledge_base/search and
    /api/knowledge_base/rag/advanced_search have different corpora, and nothing in either
    name says so.

  7. mrveiss commented on Sep 27, 2026

    @mrveiss
    OwnerAuthor

    Why the gate is closed: established facts, and one contradiction I am not going to paper over.

    Established

    1. The startup step's outcome is unrecorded on every boot. _auto_index_documentation
    in initialization/lifespan.py has four possible outcomes and logs a line for each:

    logger.info("✅ [ 85%] Doc Index: Checking documentation index...")     # entry
    if not await indexer.initialize():
        logger.warning("⚠️ [ 85%] Doc Index: Failed to initialize (non-critical)")
        return
    if not indexer.needs_indexing():
        logger.info("✅ [ 85%%] Doc Index: Collection has %d vectors, skipping", ...)
    ...                                    # and "Doc Index: done — %d indexed" elsewhere

    Counted across today's five backend starts (09:36, 10:09, 10:33, 12:16, 12:21):

    line occurrences
    Doc Index: Checking documentation index... 5
    Doc Index: Failed to initialize 0
    Doc Index: Collection has N vectors, skipping 0
    Doc Index: done — N indexed 0

    Five entries, zero outcomes. Whatever happens after that first line, it has never been
    recorded on this deployment.

    And the entry line carries a ✅. A reader scanning the startup log for ✅ / ⚠️ sees a
    green check for a step whose result is unknown. The tick is printed before the work.

    2. The gate is closed at serve time. rag/advanced_search returns
    documents_considered: 0 in ~2s, both before and after the documentation re-index was
    triggered from the GUI. rag_service.py:793's if doc_svc._initialized: has no else
    branch, so the documentation bucket leaves the result set with nothing said.

    3. The indexer is pointed at a persistent Chroma path, and that path is empty.
    initialize() opens its client with db_path=<project>/data/chromadb, and on the
    deployment that directory has been empty since June. The 18,341 vectors live in a Chroma
    HTTP server — a separate process, chroma run --host 127.0.0.1, with its store
    elsewhere.

    4. It is not an unreachable embedding service. Ollama answers in 6ms.

    The contradiction, stated rather than resolved

    DocIndexerService is what writes autobot_docs, and autobot_docs holds 6,741 vectors
    in the server. If the indexer read and wrote the empty persistent path, those vectors
    could not be where they are.

    So one of these is true and I have not established which:

    • get_chromadb_client resolves to the HTTP server regardless of the db_path argument,
      in which case fact 3 is a red herring and the closed gate has another cause;
    • or the 6,741 vectors were written by a different process or an earlier configuration,
      and the serving process genuinely reads an empty store.

    That distinction determines the fix, so it is the next thing to establish and I am not
    guessing at it. Naming it because I have published five successive framings of this issue
    and each was narrower than the last — the pattern was publishing at the first plausible
    mechanism.

    What is actionable regardless of which it is

    • The startup step records its outcome. Four branches, zero of them observed on five
      boots, is a step nobody can audit.
    • The ✅ moves to the outcome, not the entry. A tick before the work is a status
      claim about nothing.
    • if doc_svc._initialized: says something when it is false. A bucket silently
      leaving a result set is the defect this whole issue is about.
    • DocIndexerService.search() distinguishes not initialised, no collection and
      empty collection from each other and from no match — four facts, one [].
  8. mrveiss commented on Sep 28, 2026

    @mrveiss
    OwnerAuthor

    Framing correction from a read-only audit: this is not the source_id defect and not a backfill. It is a wiring defect, and the issue's own text says so.

    Checked against origin/main @ 7adaca8c29 because this was being triaged as stored-data work whose fix had already merged. It is not that.

    What this issue actually reports, in its own words: "Nothing is broken inside the search; the wrong collections are wired to it." The control it documents proves the machinery works — a fact added through POST /api/knowledge_base/add_text comes back at score: 1.0 with full metadata. The route, the embedding model, the ranking and the metadata pass-through all function over autobot_memory and the Redis fact store. autobot_docs (6,741 vectors) and autobot_code (11,241) are simply not in the set the retrieval path queries.

    So:

    Where the collections come from, for whoever wires it: autobot_code is created and written by the codebase-analytics side — api/codebase_analytics/storage.py:59 and :91 create it, api/codebase_analytics/chromadb_storage.py:471 writes to it. So the work is deciding whether KB retrieval federates over those collections or whether their contents are projected into a collection it already queries — a design question with an owner, not a missing line.

    One cross-link before anyone edits that writer: api/codebase_analytics/chromadb_storage.py is also one of the three still-unguarded content→ChromaDB write paths in #17025 (measured: 2 of its 5 paths are now in the redaction chokepoint guard, that one is not). Same file, two open issues, two unrelated defects.

  9. mrveiss commented on Sep 28, 2026

    @mrveiss
    OwnerAuthor

    Owner ruling 2026-09-28: federate — query across the collections

    Asked and answered directly by the repository owner today, relayed by the coordinating session. Recorded here rather than left in a session transcript.

    KB retrieval fans out over the additional collections. Contents are not projected or copied into a collection the KB already queries.

    Why this is the shape of the fix, per this issue's own measurement

    This issue established that nothing is broken inside the search — a fact added via add_text returns at score: 1.0 with full metadata. The wrong collections are wired to a working retrieval path. So the repair is wiring, not ingestion, and specifically not a backfill or a rewrite of stored data.

    That also means the approval-gate rule for stored data (#17041, #17038) does not apply here. It was assumed to, and the assumption was wrong: federation reads existing rows and writes nothing. Stating that explicitly so nobody parks this behind an approval queue it never needed.

    What federation buys and what it costs

    The rejected alternative was projecting both collections into one the KB already queries. That would give faster queries and a second copy requiring synchronisation on every analytics write — a durable store plus a rebuildable projection, which the store-authority convention permits but which nobody asked for here. Federation keeps one copy of each collection and pays its cost per query instead, scaling with the number of collections rather than with write volume.

    The implementer should state the measured query-cost change rather than assuming it is negligible.

    Ownership note, which is not settled by this ruling

    autobot_code is created at api/codebase_analytics/storage.py:59 and :91 and written at chromadb_storage.py:471 — the codebase-analytics side, not the KB. So the collection's writer and the query that must now reach it have different owners. This ruling settles the direction; it does not assign the work, and coordination across that boundary is still required.

    Before editing the writer

    api/codebase_analytics/chromadb_storage.py carries two unrelated open defects: it writes the collection this issue cannot reach, and it is one of three still-unguarded redaction bypass paths under #17025. One file, two issues, different causes — check the other before editing it.

  10. added
    phase:M1.8Knowledge base: upload, web sources and chat retrieval work end to end
    on Oct 26, 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

    backendbugSomething isn't workingphase:M1.8Knowledge base: upload, web sources and chat retrieval work end to endpriority: high

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions