knowhere icon indicating copy to clipboard operation
knowhere copied to clipboard

Agentic retrieval drops Root-section discovery hits

Open suguanYang opened this issue 6 months ago • 1 comments

Summary

Agentic retrieval can return zero referenced chunks for a query even when the matching content exists, if the matching document was published entirely under the synthetic Root section.

Observed query:

whats the Diluted earnings per share in the documents?

Observed Behavior

The API returns a successful response, but agentic retrieval produces no referenced chunks and the answer path reports empty evidence.

Relevant runtime behavior:

  • Bottom discovery finds candidate rows and selects the relevant documents.
  • Navigation immediately stops at root with no outline items, no hydrated leaves, and no drill paths.
  • attempt_answer receives empty evidence and returns NOT_FOUND.
  • Workflow response contains zero referenced chunks.

Data Evidence

The matching content exists in the active document chunks. Examples found in the published chunks:

Diluted earnings per share: $4.78
Diluted earnings per share: $12.20

The affected documents were published with all chunks attached to the synthetic Root section, with no non-root sections.

Likely Cause

The agentic path handles root-only documents poorly:

  • _load_child_sections() expects navigable section paths. For the synthetic Root path, split_section_path("Root") returns no parts, so there is no useful child tree to navigate.
  • discovery_select_step() explicitly skips discovery hints whose normalized section path is Root.
  • A naive fix that simply allows selecting Root may still be incorrect because _hydrate_paths_to_rows() deduplicates rows by section path, which can collapse a root-only document to one chunk instead of preserving the matched discovery chunks.

Expected Behavior

If bottom discovery finds matching chunks in a root-only document, agentic retrieval should hydrate those matched chunks and include them as evidence/referenced chunks.

Proposed Fix

Handle root-only discovery hits as a direct hydration fallback in the agentic path:

  • Preserve matched discovery chunk rows when section_path == "Root".
  • Hydrate by matched chunk identity or pass the discovery rows through, instead of asking the section-tree navigator to select Root.
  • Add a regression contract test using a root-only document with multiple chunks where the target answer is not the first root chunk.
  • Ensure stale zero-result retrieval cache entries do not hide the fix after deployment.

suguanYang avatar May 14 '26 04:05 suguanYang

this document shoud not be parsed to the status that all chunks belong to the root

EricNGOntos avatar May 14 '26 04:05 EricNGOntos