Problem
In packages/shared-python/shared/services/retrieval/hydration/result_assembly.py, image chunks referenced by text chunks via connect_to metadata are silently dropped from retrieval results.
Root Cause
-
Line 46-50: All chunks referenced via connect_to are marked as embedded_targets and excluded from the final results list (line 54: if row.get('chunk_id') in embedded_targets: continue)
-
Line 71: When assembling text chunk content, only table type targets are inlined:
if normalize_chunk_type(target_row.get('chunk_type')) != 'table':
continue # images are skipped here
This means connected images are:
- Excluded from the results array (treated as "embedded")
- Never actually embedded/inlined into the parent text content
Impact
- Affected paths:
_run_classic_topk_route (new) and _try_run_small_corpus_route (existing, runs in production daily)
- Not affected: Agentic route — the evidence renderer (
agentic/evidence/renderer.py) has its own image handling that correctly inlines [Image: {asset_url}]\n{description}
- Standalone image chunks (not referenced by any text via
connect_to) are unaffected — they appear in results with correct asset_url
Suggested Fix
In assemble_retrieval_results, when processing text chunks' connected targets, add handling for image type alongside table:
if normalize_chunk_type(target_row.get('chunk_type')) == 'table':
# existing table summary logic
elif normalize_chunk_type(target_row.get('chunk_type')) == 'image':
# inline image reference: [Image: {asset_url or file_path}]\n{description}
Alternatively, exclude image chunks from embedded_targets so they appear as standalone results with their own asset_url.
Problem
In
packages/shared-python/shared/services/retrieval/hydration/result_assembly.py, image chunks referenced by text chunks viaconnect_tometadata are silently dropped from retrieval results.Root Cause
Line 46-50: All chunks referenced via
connect_toare marked asembedded_targetsand excluded from the final results list (line 54:if row.get('chunk_id') in embedded_targets: continue)Line 71: When assembling text chunk content, only
tabletype targets are inlined:This means connected images are:
Impact
_run_classic_topk_route(new) and_try_run_small_corpus_route(existing, runs in production daily)agentic/evidence/renderer.py) has its own image handling that correctly inlines[Image: {asset_url}]\n{description}connect_to) are unaffected — they appear in results with correctasset_urlSuggested Fix
In
assemble_retrieval_results, when processing text chunks' connected targets, add handling forimagetype alongsidetable:Alternatively, exclude image chunks from
embedded_targetsso they appear as standalone results with their ownasset_url.