Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
Back to tool/Back to issues
#15077·onyx

Silent ingestion and retrieval defects: mail bodies, undecoded attachments, HTML-only tables, legacy .xls, a discarded temperature, a missing email envelope, and a file owner presented as the author

Author: rbales79Created Sep 24, 2026Updated Sep 25, 2026

Defects in document ingestion, one in LLM sampling, and one in how a retrieved document is described to the model — all of which fail silently. Each is reproducible on main with a self-contained script, and two already have branches with tests.

(Updated: items 7 and 8 added. 7 is folded into the existing #15073 branch rather than sent separately, because it interacts with items 2 and 3 — see the ordering note there. 8 is not an ingestion defect at all and is the one I would most like a view on.)

They share a shape, which is why they are in one issue: none of them produces an error, a failed indexing attempt, or anything visible in the UI. A document is created and indexed, so everything downstream reports success — the content is just not in it. Retrieval quality degrades and nothing says why. I found them because a corpus scored worse than it should have, not because anything surfaced them.

I'm happy to split this into separate issues if you'd rather, and to open PRs once approved — CONTRIBUTING.md says to start here, which I should have done first (see Status of the two PRs at the bottom). Per that doc, tagging @yuhongsun96 for a read. None of this touches ee/, so no IP assignment applies.


How everything below was measured

Every number is from a script run against the code, not from reading it. Two environments, and I say which for each claim:

  • main (2c2b98154) — the file under test replaces its counterpart in the v4.7.8 image, so imports resolve and only the changed module differs.
  • the pinned v4.7.8 image, unmodified, for the sampling defect. I use it only where the relevant line is character-identical to main, and I show the line.

Every probe is synthetic — example.com addresses, invented product names. Where I cite our own corpus it is described only by shape and size.


1. A base64-encoded mail body is indexed as base64 text

eml_to_text reads part.get_payload() without decode=True, so a body in base64 is stored as the base64 string. Quoted-printable is fine — it's specifically base64.

Measured on main:

  quoted-printable body  -> True    indexed text: 'Total is 1250.50 EUR for Widget Pro'
  base64 body            -> False   indexed text: 'VG90YWwgaXMgMTI1MC41MCBFVVIgZm9yIFdpZGdldCBQcm8='

The document exists, has content, and is unsearchable. Nothing in the pipeline distinguishes a base64 blob from prose.

2. HTML-only mail is indexed as the empty string

eml_to_text collects text/plain parts only. Mail with no text/plain alternative — common for anything sent from a marketing tool, a CRM, or a mobile client — yields "".

Measured on main, same run:

  HTML-only mail         -> False   indexed text: ''

An empty document is still a document: it indexes, it counts, it reports success.

3. An attachment's base64 payload is inlined into the document, undecoded

Attachments aren't parsed, which is a reasonable scope decision. But the payload isn't skipped either — it lands in the body text as base64:

  txt attachment         -> False   indexed text: 'See attached.\n\nQVRUQUNITUVOVC1CT0RZOiByZW5ld2FsIGRhdGUgMjAyNi0wOS0zMA='

So the attachment's content is absent and its encoded form is occupying chunk space and being embedded.

Proposed fix for 1–3 — branch ready

rbales79:fix/eml-decode-html-attachments (also visible as #15073, which now also carries item 7). Decodes transfer encodings; falls back to parse_html_page_basic only when there is no text/plain part, so existing multipart mail is unchanged; extracts attachments through extract_file_text_locally behind an extension allowlist and a 25 MB cap.

Same probe with the branch applied:

  quoted-printable body  -> True    indexed text: 'Total is 1250.50 EUR for Widget Pro'
  base64 body            -> True    indexed text: 'Total is 1250.50 EUR for Widget Pro'
  HTML-only mail         -> True    indexed text: 'Total is 1250.50 EUR for Widget Pro'
  txt attachment         -> True    indexed text: 'See attached.\n\n[attachment: notes.txt]\nATTACHMENT-BODY: renewal date 2'

16 unit tests. Two things worth flagging from building it: it uses extract_file_text_locally, not extract_file_text, because the latter reaches Postgres for the Unstructured key and an attachment shouldn't need a DB session — three tests failed with Engine not initialized before I switched. And I initially had .htm in the allowlist; no parser handles it, so it would have indexed raw markup. It's excluded, and a test pins that the allowlist can't contain anything extract_file_text_locally doesn't handle.


4. A table that exists only in the HTML alternative is lost entirely

Distinct from #2 and not fixed by that branch. For multipart/alternative mail with a text/plain part, the plain part wins — correctly, as a rule. But the plain-text alternative of a data table is routinely a placeholder, and the table lives only in the HTML part, which is never read.

Measured on main, and again with the branch from 1–3 applied — identical both times:

----- indexed text -----
Please see the pricing below.

[View this email in HTML to see the pricing table]

Regards.
------------------------
  Widget Pro   present in index: False
  1250.50      present in index: False
  2520         present in index: False
  Unit Price   present in index: False

Worth noting parse_html_page_basic already renders tables well — rows on separate lines, cells tab-separated. The structure isn't the problem; nothing routes the HTML part to it when a text/plain sibling exists.

Proposed fix: when a text/plain part is present but the HTML alternative contains <table> elements absent from it, append the rendered tables as an extra section rather than replacing the plain body. We run this and it is additive by construction — existing text is never displaced.

Scale, stated carefully: on our corpus, 72 of 362 documents carry a table section extracted this way. That is the population where the mechanism applies — not a claim that all 72 lost a table on stock Onyx, since some will have an adequate text/plain alternative. I have not measured how many of the 72 are genuine losses.

Status: we run this against v4.7.8; not yet re-derived against main. Happy to.


5. A legacy .xls workbook is dropped before a document exists

.xls is in no member of OnyxFileExtensions, so every connector's accept check rejects it. The only trace is Skipping file '<name>' with unrecognized extension '.xls'. No document, no chunk, no failed indexing attempt.

Measured on main:

  .xls in SPREADSHEET_EXTENSIONS        : False
  .xls in TABULAR_EXTENSIONS            : False
  .xls in DOCUMENT_EXTENSIONS           : False
  .xls in TEXT_AND_DOCUMENT_EXTENSIONS  : False
  .xls in ALL_ALLOWED_EXTENSIONS        : False
  extract_file_text_locally     : raised ValueError 'Unknown file extension or not recognized as text data'

Proposed fix — branch ready

rbales79:fix/xls-legacy-workbooks (also #15075). 14 tests.

No package is added. pyproject.toml already asks for markitdown[pdf, docx, pptx, xlsx, xls], and that xls extra is xlrd — so xlrd is installed in every image today, just unreferenced. I did not add it to pyproject.toml, because importing it directly arguably makes it a direct dependency and I couldn't regenerate uv.lock with my uv version without unrelated sys_platform churn in the diff. Say the word and I'll add xlrd==2.0.2 to the backend group and let the hooks regenerate.

markitdown is deliberately not used for this: the .docx/.pptx paths call it because they want markdown, whereas every spreadsheet path renders through _sheet_to_csv because TabularSection staging needs one CSV per sheet.

Three gates had to open and the first two alone changed nothing, so each has its own test: the extension set, the extract_file_text_locally dispatch, and stage_xlsx_sheets (renamed stage_spreadsheet_sheets — single caller, no other reference anywhere in the repo).

The part that is easy to get wrong: xlrd returns every number as a float and every date as a float too, separated only by cell type. Read naively a renewal date indexes as 46295.0. There's a test pinning that a .xls and an .xlsx holding the same values render identically.

suite run passed failed
main, unchanged 164 10
with the branch 178 10

Exactly +14. The 10 failures are pre-existing in test_archive_limits.py on this runtime, identical before and after — I confirmed that by running them against the untouched tree rather than assuming.


6. An explicitly requested temperature is silently discarded for reasoning models

multi_llm.py:

python
optional_kwargs["temperature"] = 1 if is_reasoning else self._temperature

is_reasoning comes from model_is_reasoning_model, i.e. the registry's supports_reasoning. Supporting reasoning is not the same as requiring temperature=1. That constraint belongs to OpenAI's o-series; it's applied here to everything the registry marks as reasoning, including OpenAI-compatible and self-hosted models that accept any temperature.

The caller's value isn't merged, clamped or warned about — it's replaced. Measured, with the caller explicitly passing temperature=0.0:

  caller explicitly asks for temperature=0.0:
    nvidia/nemotron-3-super-120b-a12b      openai_compatible  -> provider receives temperature=1
    nvidia/nemotron-3.5-lightning-30b-a3b  openai_compatible  -> provider receives temperature=1
    kimi-k2-thinking                       openai_compatible  -> provider receives temperature=1
    deepseek/deepseek-r1                   openrouter         -> provider receives temperature=1
    gpt-4o                                 openai             -> provider receives temperature=0.0

(litellm's completion stubbed to capture kwargs; gpt-4o is the non-reasoning control. Run on the unmodified v4.7.8 image, where the line is character-identical to main — 775: optional_kwargs["temperature"] = 1 if is_reasoning else self._temperature.)

This reaches real callers. backend/ee/onyx/server/gateway/api.py passes temperature=request.temperature — an OpenAI-compatible surface where a caller's temperature is accepted and then discarded. Onyx's own eval harness sets temperature=0.0 in EvalConfigurationOptions; its default model is gpt-4o, so that one is honoured, but point the harness at any reasoning model and the 0.0 is discarded.

Why this is worse than it looks. An uncontrolled temperature doesn't raise — it returns a confident, plausible, differently-ordered answer. We lost a model benchmark to exactly this: at provider defaults one model scored 0/5 on format compliance and was about to be discarded as unusable; with sampling pinned it scored 5/5 and was the fastest thing tested. The ranking inverted in both directions and nothing errored. Anything measuring Onyx's own output through a reasoning model inherits that.

The safety net already exists. _BEST_EFFORT_KWARG_KEYS includes temperature, and _completion retries a provider rejection with it stripped, with _KWARG_ERROR_ALIASES["temperature"] already mapping the 400. So honouring an explicit temperature can't hard-fail a model that rejects it — the ladder recovers, exactly as it does today for reasoning_effort.

Proposed fix: track whether a temperature was explicitly supplied and honour it; keep 1 as the default when none was. One-line condition plus a constructor flag. That leaves current behaviour unchanged for every caller that doesn't ask.

There's also no per-provider way to send an arbitrary body field such as chat_template_kwargs. LITELLM_EXTRA_BODY is container-global, so in a mixed-provider deployment it goes to providers that reject it, and _PROVIDER_CUSTOM_CONFIG_KWARGS covers only BEDROCK / BEDROCK_CONVERSE / LM_STUDIO / AZURE — not the OpenAI-compatible providers where the gap actually bites. We close this through custom_config, which is already per-provider, already persisted, already in the admin UI. Happy to propose that separately if the temperature fix alone is preferable.

Status: we run both against v4.7.8; not yet re-derived against main.


7. An email's own envelope is never emitted, so the nearest From: belongs to another message

eml_to_text emits no From, To, Cc, Date or Subject. The .eml branch of extract_file_text also returns metadata={}, so the envelope has no second route into the index.

Absent attribution would be safe — a model with no sender says it does not know. What makes this worse than a missing field is that the only From: an extracted email can contain is body text: the quoted header block of an earlier message in the thread. So the nearest sender to any sentence belongs to a different message than the one containing it.

Measured on main, a reply whose own sender differs from the sender it quotes:

----- indexed text -----
Hi <name>,

Thank you for the detail, this is approved.

________________________________
From: <a mailbox that is NOT the approver>
Sent: <date>
To: <a third person>
------------------------
  the message's own From:   present in index: False
  a quoted, earlier From:   present in index: True

The document that records a decision does not name who made it, and does name someone who did not.

Fix — reference diff, same branch as items 1–3: rbales79:fix/eml-decode-html-attachments. Folded into that branch rather than carried separately, because the ordering interacts with items 2 and 3. The envelope must be prepended after the HTML-only fallback — that fallback fires on not text_content, so an envelope added earlier makes an HTML-only message look like it already has a body and its real content is dropped. Reversing the order makes the test fail on the body:

AssertionError: HTML-only body was dropped once the envelope was prepended
assert '12345.67' in 'From: Approver One <[email protected]>\nSubject: Quarterly figures'

Known limit, stated: the block leads the document, so it lands in the first chunk. A chunk from the middle of a long thread still carries no sender. That needs per-chunk metadata and is not attempted.

No sibling path to fix: there is no .msg extractor — .eml is the only email type extract_file_text handles, so this omission has no twin.


8. primary_owners is presented to the model as authors, so a file owner reads as an email's sender

Not an ingestion defect, and the one that actually produced a wrong answer for us. Filing it here rather than separately because it only bites in combination with item 7.

onyx/tools/tool_implementations/utils.py labels every search result handed to the model:

python
authors = None
if chunk.primary_owners or chunk.secondary_owners:
    authors = []
    if chunk.primary_owners:
        authors.extend(chunk.primary_owners)
    ...
result["authors"] = authors

primary_owners does not mean "author". What it means depends on which connector ingested the document, and nothing tells the model which:

Ingested by primary_owners holds So authors means
Gmail connector (gmail/connector.py) the From header the sender — correct
IMAP connector (imap/connector.py) the From header the sender — correct
SharePoint / file connectors the file owner whoever owns the file — false

Measured on a corpus of ~18,700 chunks ingested by the SharePoint connector: primary_owners is the same single name on every chunk, because one account owns the export. The field carries no per-document information at all while looking exactly like per-document attribution.

Read from the stored tool-call payload — what was actually sent to the model, not what the code appears to send:

payload: 47,251 chars | that name appears 9 times
carried by:  results[N].authors[0]   (on every result)
occurrences in any retrieved section content: 0

So when asked who approved an exception, the model received an unattributed "this is approved" sentence (item 7 removed the real sender), a quoted From: belonging to a different message, and an explicit authors field naming one person on every document. It answered with that person. Given those inputs that is correct reasoning — the false attribution was asserted by the pipeline, not invented by the model.

Item 7 alone leaves attribution absent, which is safe. This one fills the gap with something plausible wearing the right label, which is how a confidently wrong, well-cited answer gets produced.

No fix proposed yet, deliberately — the right shape is a product decision, not a patch. Options: drop authors for connectors where it is file ownership; rename it to something honest such as file_owners; or qualify it per source so the model can weigh it. I would rather hear which you want than send a rename that diverges every downstream comparison.


Status of the two PRs

#15073 and #15075 are open, and greptile says "PR author is not in the allowed authors list." I opened them before reading CONTRIBUTING.md properly — the issue should have come first. Treat this issue as the artifact and the branches as reference diffs; close the PRs if that's cleaner, or tell me the process you'd like and I'll follow it.

What I'd find useful

Which of these you'd take, and in what form. If there's appetite for all of it I'd rather send them as separate small PRs than one large one.

Generated with Claude Code

Source: onyx-dot-app/onyx

View original on GitHubView discussion on GitHub