Skip to content

Umbrella: knowledge base intake is built but two legs are severed — upload has no UI, transcriber output cannot land #17527

Open
12 of 43 issues completed

Description

@mrveiss

Owner directive (2026-09-26)

knowledgebase is what holds everything together … all that gets vectorised, graphed so it makes sense when accessed via chat or via llc module that helps to do the everyday work

that would need to be highest priority currently — v0.9.0 has to be functional

The knowledge base has four intake paths. Three reach vectorise+graph; one produces output that goes nowhere, and one has a working backend with no way to use it.

Measured state (origin/main)

Intake path State
Manual one-time entry present
File upload POST /knowledge/upload exists (api/knowledge.py:1213, UploadFileResponse) — no UI reaches it
Audio / video → transcriber transcriber present; its KB push is broken — #17022, kb_push.py imports a non-existent DocIndexerService
Watch folders services/kb_folder_watcher.py, surfaced in KnowledgeEntries.vue
Connectors (fileservers, databases, web) api/knowledge_connectors.py + knowledge_connector_oauth.py, routed at /knowledge/manage?tab=connectors

So the gap is not "build ingestion". Ingestion is built. Two legs are severed at different ends:

  • upload: finished backend, orphaned — nothing calls it
  • transcriber: working producer, broken consumer — output cannot land

Children

  • Upload UI — wire /knowledge/manage to the existing POST /knowledge/upload. Frontend-only; the backend half is done. Confirm the endpoint's accepted content types and size limits rather than assuming them.
  • bug(transcriber): kb_push.py imports a non-existent DocIndexerService -- push_to_kb is dead on arrival #17022 — unblock the transcriber's KB push. Until this lands, audio and video are transcribed into nothing.
  • DOCUMENT entity type — see Umbrella: knowledge/memory is the relation system of record and every module a consumer — today nothing outside knowledge calls it #17526. ENTITY_TYPES has no CODE, no DOCUMENT, no FILE (only FILE_ACTIVITY, a user action). Every path above ingests an artifact with a source, and without DOCUMENT a fact cannot point back at the document, page or recording it came from. Provenance is what makes the KB trustworthy when the LLC module leans on it, and it is the edge that cannot be expressed today.
  • Classification — owner note, same session: "knowledge would benefit of classification." Entries arrive from four sources with no taxonomy, so retrieval cannot filter by kind, trust or domain, and the graph cannot express "this is a spec" versus "this is a transcript" versus "this is a scraped page". Needs a decision on whether classification is assigned at ingest, inferred, or both — recorded before implementation, not during.
  • End-to-end acceptance: a document added by each of the four paths is retrievable via chat and via the LLC module, with its source identifiable. If any path cannot demonstrate that, it is not done.

Why this is the acceptance test

Counting wiring has misled repeatedly on this subsystem — an endpoint can exist and be unreachable, a producer can run and its consumer be broken, and an import count says nothing about whether a traversal returns. The test is the round trip: ingest by each path, then retrieve from chat and from LLC with provenance intact.

Related

#17526 (relation/entity substrate — CODE/DOCUMENT types, cross-store edges), #17022 (transcriber push), #17215 (retrieval fusion).

Activity

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

    @mrveiss
    OwnerAuthor

    Correcting this issue: the upload premise is false. I wrote it, and it was wrong.

    The table above says "File upload — POST /knowledge/upload exists, no UI reaches it." Both halves of that are wrong.

    • autobot-frontend/src/components/knowledge/KnowledgeUpload.vue exists — 1,633 lines, drag-drop, per-file progress, category and tags.
    • It is mounted in KnowledgeEntries.vue as a tab and is the default one, so /knowledge/manage opens on it.
    • It reaches the endpoint: KnowledgeUpload.vue:855 → KnowledgeController.ts:179 addFileDocument → KnowledgeRepository.ts:341 → POST .../knowledge_base/upload.
    • router/index.ts:208 redirects /knowledge/upload → /knowledge/manage, so KnowledgeBrowser.vue:1108's import button lands there too.

    How I got it wrong: I grepped frontend filenames matching knowledge.*manage.*\.vue and searched for the path /knowledge/upload. KnowledgeUpload.vue matches neither — the frontend spells the base /knowledge_base/upload. I then reported the absence as a finding. A search that cannot find a thing is not evidence the thing is missing, which is the same error this repo keeps cataloguing, committed here in the issue that sets the priority.

    The real defect, found by the session I misdirected

    The upload path works and discards every reason the backend gives for a failure. ApiRepository.request throws new Error(`HTTP ${status}: ${statusText}`) without reading the JSON body:

    Backend computes User sees
    "File too large. Maximum size is 10MB" (knowledge.py:838) HTTP 400: Bad Request
    "File type not allowed. Allowed: .txt, .md, .pdf, .docx, .json, .csv, .html, .xlsx, .pptx, .odt, .ods, .odp" (:846) HTTP 400: Bad Request
    "Could not read X within Ns… try splitting it" (:1274) HTTP 422: Unprocessable Entity
    "No text layer found in any of the N page(s)… needs OCR" (_no_text_detail, :1191) HTTP 400: Bad Request

    The last row is the sharpest: #13884 exists specifically to tell a user "scanned, needs OCR" rather than "empty", and that message has never been able to reach anyone. It is rendered at KnowledgeUpload.vue:302 and never populated.

    Two more in the same path:

    • The accept list disagrees with the server in both directions. KnowledgeUpload.vue:193 offers .doc .yaml .yml .xml which the server refuses, and omits all five office types (.xlsx .pptx .odt .ods .odp) the server accepts (knowledge.py:128).
    • The 100-char preview is stored as the document. knowledge.py:1320 truncates content to 100 chars + "..." on the 200 path, and KnowledgeController.ts:182 writes that into the client store as the document's content — so a 50-page PDF is a 103-character document locally until something refetches it.

    Revised children

    • Wire the upload UI — already wired. Replaced by: read the error body in ApiRepository, align the accept list to the server's allow-list, and stop storing the truncated preview as content. Constraint established by the implementer: 16 call sites match on the thrown string (err.message.includes('HTTP 503') and similar, ErrorHandler.js:71-158, ApiClient.ts:425, useKnowledgeGraphRAG.ts:310, MemoryPrivacyPanel.vue:206, …), so the detail must be appended — HTTP 400: Bad Request — File too large… — never substituted, or all 16 break silently.
    • bug(transcriber): kb_push.py imports a non-existent DocIndexerService -- push_to_kb is dead on arrival #17022 — unchanged and still the severed leg. See its own thread; it is three defects, not one.
    • DOCUMENT entity type — unchanged, see Umbrella: knowledge/memory is the relation system of record and every module a consumer — today nothing outside knowledge calls it #17526.
    • Classification — input from the UI side: source / ingest-path is what users filter by (uploaded vs transcribed vs watch-folder vs connector), and half of it already exists as the free-text category with an "uploads" default. Provenance needs no decision and is nearly free; inferred topic labels are the part that needs a ruling.
    • End-to-end round trip — unchanged.

    Note for anyone reading the table above

    Two of the five rows in the original assessment were produced by greps that could not have found what they were looking for. The round-trip acceptance test is in this issue precisely because reference-counting keeps producing confident wrong answers about this subsystem — including mine.

  3. mrveiss commented on Sep 26, 2026

    @mrveiss
    OwnerAuthor

    Second correction, and it invalidates the method behind the whole table: three of the five "works" rows were asserted from file existence, and at least one of them is false.

    Watch folders are severed too. services/kb_folder_watcher.py:484 calls await kb.add_fact(...). There is no add_fact anywhere in the repository — git grep "def add_fact" returns zero definitions, and that line is its only call site. No class-level __getattr__ rescues it either; the two __getattr__s in knowledge/__init__.py and knowledge_base.py are PEP 562 module-level lazy loaders. The real method is add_document (knowledge/documents.py:42). Filed as #17531 by the session that found it.

    I marked watch folders as working. I had checked that kb_folder_watcher.py exists and is referenced from KnowledgeEntries.vue. That is a file, not a function. I then told another session it was a working reference implementation to copy — and they discovered the reference was broken only because they went to read it.

    Corrected intake table

    Path State Evidence
    Manual entry unverified — I never checked it —
    File upload UI works and is wired; every backend error reason is discarded before display #17528 / PR #17529
    Audio / video → transcriber severed — kb_push.py calls an API DocIndexerService has never had #17022 / PR #17536
    Watch folders severed — calls a method that does not exist #17531
    Connectors unverified — I checked that knowledge_connectors.py and the OAuth module exist, nothing more —

    Two of five are confirmed severed. Two are unverified and were previously reported here as working. One works with its error reporting broken.

    The #13551 detail is the one to keep

    That issue fixed a missing await on get_knowledge_base(). Before: AttributeError: 'coroutine' object has no attribute 'add_fact'. After: AttributeError: 'KnowledgeBase' object has no attribute 'add_fact'.

    Same exception class, same attribute name, same except Exception handler, same errors += 1. No log line and no counter distinguished the repaired code from the broken code. The fix was real, correct, and completely unobservable — so the file reads as a closed bug while the leg has never ingested anything. A repair whose success and failure are indistinguishable at the only place anyone looks.

    Correct call sequence, established rather than assumed

    kb = await get_knowledge_base()                                    # knowledge/_composed.py
    result = await kb.add_document(content, metadata)                  # DocumentsMixin, documents.py:42
    await kb.add_facts_to_collection(collection_id, [result["fact_id"]])  # CollectionsMixin, :338

    Both mixins compose onto the same object (_composed.py:36) — two calls, not two services. add_document → _add_document_internal → store_fact returns {"status", "fact_id", "action", "content"}, so the id passes straight through. A status: "duplicate" still carries a fact_id, so duplicates must still join the collection or a re-push routes fewer segments than the first.

    Related defects surfaced by asking the same question of the other writers

    What this means for the acceptance test

    The round trip in this issue is not optional and not a formality. Every row above that I marked "works" was a file-existence check, and the two that have since been read by someone were both broken. Manual entry and connectors have still not been exercised by anyone. Until a document ingested by each path is retrieved via chat and via LLC with its source identifiable, the state of that path is unknown — not working.

  4. mrveiss commented on Sep 27, 2026

    @mrveiss
    OwnerAuthor

    Measured all five intake legs for the last criterion — "a document added by each path is retrievable via chat and via the LLC module, with its source identifiable". Every leg writes provenance. No two write it the same way, and one writes no source key at all.

    What each leg actually stores

    leg keys written what source holds
    File upload (api/knowledge.py:1292) source, type: "file", filename, + page offsets via _page_provenance_metadata the filename
    Transcriber (transcriber/knowledge/kb_push.py, #17536) source_type: "transcript", source, recording_id, recording_filename a URN, recording:<id>
    Watch folder (services/kb_watch_ingest.py, #17531) source: "watch_folder", folder_id, filename, file_path, collection a literal category string
    Connector (knowledge/connectors/base.py:596) source_type: "connector", source_connector_id, connector_type, source_id, content_type nothing — no source key
    Manual entry (api/knowledge.py:563) source, title, category whatever the caller passed

    source_type is present on two legs and absent on three. filename is present on two. source means four different kinds of value where it exists, and for connectors it does not exist.

    So the criterion is true per leg and false across legs

    Each leg, read on its own, satisfies "its source is identifiable" — the information is there. But a consumer cannot answer "where did this come from" without first knowing which leg wrote the fact, and there is no field that tells it that consistently. For a connector-ingested fact, a consumer reading source gets nothing at all.

    The upload leg is the strongest of the five and worth copying rather than replacing: _page_provenance_metadata stores offsets derived from the same render_plain call that produced the stored content, so a retrieved span resolves to a page without the page number entering the embedding, and it returns {} for unpaginated formats rather than inventing page: 1.

    Retrieval, both surfaces

    • Chat reaches KnowledgeBase.search(), whose results carry "metadata" — so whatever a leg wrote is reachable. The chat leg's problem is not availability.
    • LLC normalises to {chunks, sources} in llc/kb/context_builder.py, and builds that list from result["source_company_id"] — a tenancy id, not a document origin. The document's metadata rides along inside each chunk and is never surfaced as a source. A caller reading the key named sources gets the company, with no signal that it answered a different question.

    Why this is one finding and not five

    The three defects found across this criterion are the same shape at three layers:

    layer what occupies the provenance slot
    graph "source": "ecl_pipeline", a constant (#17588)
    LLC retrieval source_company_id, a tenancy answer under a provenance-shaped name
    ingest vocabulary five different meanings of source, one leg with none

    In each case a caller asking about origin receives something plausible and gets no signal that it means something else. That is why counting wiring has misled on this subsystem, as this issue already says.

    The decision this needs, which is not mine to make

    A canonical provenance vocabulary across five legs is an architecture call, so recording it rather than choosing it. The options:

    1. A required shape at the write chokepoint. store_fact/add_document reject a write with no source_type, and each leg declares its own. Strongest, and it fails every existing caller until they are updated.
    2. A derived accessor. Leave the legs alone and add one function that answers "what is this fact's origin" by knowing each leg's dialect. Cheapest, no migration, and the dialects stay — so the next leg invents a sixth.
    3. Canonical keys plus a migration. source_type mandatory, source defined as a URN with a per-leg scheme (file:, recording:, connector:, watch:). Correct, and it touches every leg plus the stored facts already written.

    My recommendation is 3 for new writes with 2 as the read path during migration — the accessor is needed anyway so that retrieval has one thing to call, and it makes the migration observable rather than a flag day.

    What I am doing under the assignment, and what I am not

    Doing: surfacing document provenance in the LLC's sources alongside the tenancy field rather than instead of it; a contract test pinning what each leg writes today and asserting it survives retrieval to both surfaces; a host procedure for the real ingest-and-retrieve, written and not executed — running against a deployed instance is not something I have sanction for, and a host-behaviour criterion cannot be closed by a CI test.

    Not doing: choosing the vocabulary. The contract test will pin today's five dialects, so whichever option is chosen, the test shows what changed.

  5. 46 remaining items

  6. mrveiss commented on Nov 6, 2026

    @mrveiss
    OwnerAuthor

    Local branch issue-17527-provenance-accessor (not on GitHub), inspected 2026-11-06

    Verdict: LANDED (triage said REAL-UNIQUE)

    Intent: One accessor for five provenance dialects in the KB, every reader migrated, and a guard (filed under #17618).

    Result: Corrected from REAL-UNIQUE. All three commits are on main (1fce5cd, 10a6c0d, 96e478f); provenance_test.py and the context-builder test are identical on main. Pending lines are guard/doc wording main reworded.

    Commits not on main (3 non-merge, 0 merge):

    Pending hunks (added lines not on main): 4 hunks in 4 files; largest:

    • autobot-backend/knowledge/provenance.py:(top level) (5 lines) — # The only leg that writes no source. Its identity is the connector
    • docs/developer/KB_ROUND_TRIP.md:(top level) (5 lines) — > LLC module, with its source identifiable. If any path cannot demonstrate that,
    • repo_tests/_reach_policy.py:ALLOWANCE_VERDICTS: dict[str, tuple[str, str, str]] = { (3 lines) — "provenance-accessor-scan": (
    • repo_tests/provenance_accessor_17527_test.py:(top level) (3 lines) — return sum(1 for node in ast.walk(ast.parse(source)) if _reads_key(node))
  7. mrveiss commented on Nov 6, 2026

    @mrveiss
    OwnerAuthor

    Local branch issue-17527-round-trip (not on GitHub), inspected 2026-11-06

    Verdict: LANDED (triage said REAL-UNIQUE)

    Intent: First version of the provenance accessor plus the KB round-trip acceptance procedure (KB_ROUND_TRIP.md).

    Result: Corrected from REAL-UNIQUE. The accessor is superseded by main's #17618 version; main's KB_ROUND_TRIP.md has the "What this procedure leaves behind, and who can remove it" section from d2912d7. Pending hunks are docstring wording. Do NOT revive. The criterion itself (a live four-path round trip) is still open on this umbrella.

    Commits not on main (2 non-merge, 0 merge):

    Pending hunks (added lines not on main): 4 hunks in 3 files; largest:

    • autobot-backend/knowledge/provenance.py:(top level) (13 lines) — _UNKNOWN = Origin(leg=None, reference=None)
    • autobot-backend/llc/kb/context_builder.py:class HeartbeatContextBuilder: (7 lines) — sources holds company ids and always has — it answers which tenant
    • docs/developer/KB_ROUND_TRIP.md:(top level) (5 lines) — > LLC module, with its source identifiable. If any path cannot demonstrate that,
    • autobot-backend/llc/kb/context_builder.py:class HeartbeatContextBuilder: (3 lines) — # Five intake legs write provenance in five dialects; the accessor
  8. mrveiss commented on Nov 20, 2026

    @mrveiss
    OwnerAuthor

    Branches issue-17527-round-trip (PR #21811, head 663b9df) and issue-17527-provenance-accessor (PR #21818, head 29cdae8) were deleted as zero-change branches: their content is already on main. None of the five ACs is ticked: I found no /knowledge/manage wiring to POST /knowledge/upload (only a /knowledge/upload route push in KnowledgeBrowser.vue:17,1109), and the end-to-end retrieval AC needs run evidence.

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

    backendenhancementNew feature or requestfrontendphase:M1.8Knowledge base: upload, web sources and chat retrieval work end to end

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions