knowhere icon indicating copy to clipboard operation
knowhere copied to clipboard

Agentic retrieval: evidence rendering bugs — orphan nesting, outline leakage, and non-English agent reasoning

Open EricNGOntos opened this issue 6 months ago • 0 comments

Problem Description

When using the agentic retrieval pipeline to query documents, several rendering and behavioral anomalies have been observed in the evidence output:

Bug 1: Evidence Tree Orphan Nesting Failure

When a document section is collected via COLLECT and its parent is created via _build_outline_subtree, pre-existing child nodes are not migrated under the new parent. This causes leaf sections to appear as orphans at the wrong tree depth in the evidence text, producing duplicated and incorrectly nested headings.

Example: Querying "深信服安全GPT的技术方案" returns:

  • (四) 深信服安全 GPT floating at L1 as an orphan instead of nesting under 六、 解决方案与案例
  • Echo structures where 六、 解决方案与案例 appears redundantly inside child subtrees

Bug 2: Outline-Only Evidence Leakage

When the navigation agent determines a document is irrelevant (returns collect=[], action=STOP), the evidence rendering still outputs 950+ characters of the document's top-level outline skeleton. This is because render_evidence() checks has_content() which returns True for outline-only trees (populated during the initial load_child_sections call), even though no content was actually selected.

Expected behavior: If no chunks are collected and no discovery selections are made, evidence_text for that document should be empty.

Bug 3: Non-English Agent Reasoning

The reason field in navigation responses and reasoning_summary in workflow planner responses are written in the source document's language (e.g., Chinese) rather than English, making traces harder to analyze for international teams.

Impact

  • Bug 1 causes incorrect evidence structure, confusing downstream answer synthesis agents
  • Bug 2 wastes context window budget on irrelevant documents
  • Bug 3 reduces trace readability and debugging efficiency

Reproduction

Run the E2E debug suite:

cd apps/worker && python scripts/debug_retrieval.py --test T2 --test T4
  • T2 (Deep Drill Vendor) reproduces Bug 1
  • T4 (No Relevant Doc) reproduces Bug 2

EricNGOntos avatar Jun 01 '26 06:06 EricNGOntos