Skip to content

fix: ingest file diffs for shared-KB bots updated outside the shared flow - #1130

Open
NitroBoss wants to merge 1 commit into
aws-samples:v3from
NitroBoss:fix/shared-kb-file-diff-ingestion
Open

fix: ingest file diffs for shared-KB bots updated outside the shared flow#1130
NitroBoss wants to merge 1 commit into
aws-samples:v3from
NitroBoss:fix/shared-kb-file-diff-ingestion

Conversation

@NitroBoss

Copy link
Copy Markdown
Contributor

Fixes #1129.

On the MapQueuedBots update path, a bot backed by a shared knowledge base reaches finalize_custom_bot_build with a valid FilesDiff but no DataSources in the event, and its per-bot BrChatKbStack{botId} exposes no KnowledgeBaseId output (that only exists for dedicated KBs). The handler therefore returned DataSources: [], the ingestion Map state iterated over zero items, and the sync finished SUCCEEDED while the added files were never ingested.

What this PR does

When the handler has file diffs to process but ended up with no data sources, it falls back to the knowledge_base_id and data_source_ids that update_knowledge_base_id() already persisted on the bot record at creation time. Dedicated bots and the SharedKnowledgeBases creation flow are untouched (they populate data_sources before the fallback is consulted).

Verified

Reproduced live on a v3.17.0 deployment: adding two PDFs to an existing shared-KB bot produced a successful sync with DataSources: [] in the execution history and no new documents in the knowledge base. Ingesting the same two documents with the exact call this fallback generates (IngestKnowledgeBaseDocuments against the bot record's KB and data source) indexed them correctly and retrieval picked them up.

…flow

On the MapQueuedBots update path a shared-KB bot has no DataSources in
the event and no KnowledgeBaseId output in its per-bot stack, so
finalize_custom_bot_build returned an empty DataSources list and the
sync succeeded without ingesting anything. Fall back to the
knowledge_base_id and data_source_ids already stored on the bot record.
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.

[BUG] Adding files to an existing shared-KB bot never ingests them: sync succeeds with an empty DataSources list

1 participant