Describe the bug
Adding (or replacing) files on an existing bot that uses a shared knowledge base never ingests them. The sync completes with SyncStatus: SUCCEEDED, the UI looks healthy, but the new documents are absent from the knowledge base, so retrieval keeps answering only from the files present at bot creation. There is no error anywhere.
Root cause
On the update path (SyncSharedKnowledgeBasesRequired: false → MapQueuedBots flow), backend/embedding_statemachine/bedrock_knowledge_base/finalize_custom_bot_build.py builds the DataSources list for ingestion from exactly two sources:
event["DataSources"] — only present when coming through the SharedKnowledgeBases creation flow.
- The
BrChatKbStack{botId} CloudFormation outputs — a KnowledgeBaseId output only exists for dedicated knowledge bases.
For a shared-KB bot being updated, neither source exists, so the handler returns DataSources: []. The downstream ingestion Map state iterates over zero items and the state machine finishes successfully, dropping the file diff on the floor.
Confirmed from a live execution history: the FinalizeCustomBotBuild input contains the correct diff ("FilesDiff": {"Added": ["fileA.pdf", "fileB.pdf"], ...}) and no DataSources key; its output contains "DataSources": []; MapIngestionJobsForCustomBot schedules no tasks; UpdateSyncStatusSuccess then records SUCCEEDED.
Verified at v3.17.0 and on current v3 HEAD.
Steps to reproduce
- Create a bot with a shared knowledge base and some files; wait for the sync to complete (works).
- Edit the bot and add one more file; save. Sync completes successfully.
aws bedrock-agent list-knowledge-base-documents on the bot's KB/data source: the new file is not there (not even as FAILED), and retrieval never uses it.
Expected behavior
Files added to an existing shared-KB bot are ingested, or the sync fails loudly.
Fix
The bot record already stores everything needed: update_knowledge_base_id() persists knowledge_base_id and data_source_ids on the bot at creation time. When the event carries file diffs but no DataSources, and the stack outputs expose no KnowledgeBaseId, fall back to the bot record. PR to follow.
Related: #1126 (same observability gap: the sync status reports success while nothing was ingested).
Describe the bug
Adding (or replacing) files on an existing bot that uses a shared knowledge base never ingests them. The sync completes with
SyncStatus: SUCCEEDED, the UI looks healthy, but the new documents are absent from the knowledge base, so retrieval keeps answering only from the files present at bot creation. There is no error anywhere.Root cause
On the update path (
SyncSharedKnowledgeBasesRequired: false→MapQueuedBotsflow),backend/embedding_statemachine/bedrock_knowledge_base/finalize_custom_bot_build.pybuilds theDataSourceslist for ingestion from exactly two sources:event["DataSources"]— only present when coming through the SharedKnowledgeBases creation flow.BrChatKbStack{botId}CloudFormation outputs — aKnowledgeBaseIdoutput only exists for dedicated knowledge bases.For a shared-KB bot being updated, neither source exists, so the handler returns
DataSources: []. The downstream ingestion Map state iterates over zero items and the state machine finishes successfully, dropping the file diff on the floor.Confirmed from a live execution history: the
FinalizeCustomBotBuildinput contains the correct diff ("FilesDiff": {"Added": ["fileA.pdf", "fileB.pdf"], ...}) and noDataSourceskey; its output contains"DataSources": [];MapIngestionJobsForCustomBotschedules no tasks;UpdateSyncStatusSuccessthen recordsSUCCEEDED.Verified at v3.17.0 and on current
v3HEAD.Steps to reproduce
aws bedrock-agent list-knowledge-base-documentson the bot's KB/data source: the new file is not there (not even as FAILED), and retrieval never uses it.Expected behavior
Files added to an existing shared-KB bot are ingested, or the sync fails loudly.
Fix
The bot record already stores everything needed:
update_knowledge_base_id()persistsknowledge_base_idanddata_source_idson the bot at creation time. When the event carries file diffs but noDataSources, and the stack outputs expose noKnowledgeBaseId, fall back to the bot record. PR to follow.Related: #1126 (same observability gap: the sync status reports success while nothing was ingested).