Skip to content

fix(multimodal-rag): preserve ingestion state and clean up requests - #1366

Merged
Shubhamsaboo merged 1 commit into
Shubhamsaboo:mainfrom
Afloat16:fix/multimodal-rag-ingestion-correctness
Dec 2, 2026
Merged

Shubhamsaboo merged 1 commit into
Shubhamsaboo:mainfrom
Afloat16:fix/multimodal-rag-ingestion-correctness

Conversation

@Afloat16

Copy link
Copy Markdown
Contributor

Problem

This groups the multimodal_agentic_rag correctness fixes from #1334, #1335 and #1336 into one app-scoped PR, following the consolidation request in #1361 (comment).

A text ingestion failure currently leaves a source and any previously embedded chunks in the store, even though the request failed. Each answer request also leaves its private ADK session behind, and the upload handler reads the whole file before applying its existing size limit.

Changes

  • Stage text chunks under the existing lock and publish the source, chunks and event only after every embedding succeeds.
  • Delete the request's ADK session in finally, preserving success, model errors and cancellation while leaving unrelated sessions intact.
  • Read at most the existing 120 MiB upload limit plus one byte, then reject oversized files before calling the store. This bounds the handler's bytes allocation; it does not change multipart parsing or transport limits.

The change touches two production files and one 136-line standard unittest file. Tests import the real modules normally and use real ADK sessions, SDK event types and FastAPI uploads; external embedding/model execution is replaced at those boundaries.

Validation

cd rag_tutorials/multimodal_agentic_rag/backend
python -m unittest test_request_correctness -v
  • Installed the declared backend dependencies on Python 3.12; pip check passes.
  • Upstream main plus these regressions fails in all three areas (7 failing assertions/subtests).
  • Patched code: 8/8 tests pass, covering first/later embedding failures with existing data, complete publication, seed events, session success/error/cancellation, exact upload limits and bounded oversized reads.
  • git diff --check passes.

The closed individual PRs remain closed; this PR is their consolidated replacement.

@Shubhamsaboo
Shubhamsaboo merged commit 86026c2 into Shubhamsaboo:main Dec 2, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants