fix: ingest file diffs for shared-KB bots updated outside the shared flow - #1130
Open
NitroBoss wants to merge 1 commit into
Open
fix: ingest file diffs for shared-KB bots updated outside the shared flow#1130NitroBoss wants to merge 1 commit into
NitroBoss wants to merge 1 commit into
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1129.
On the
MapQueuedBotsupdate path, a bot backed by a shared knowledge base reachesfinalize_custom_bot_buildwith a validFilesDiffbut noDataSourcesin the event, and its per-botBrChatKbStack{botId}exposes noKnowledgeBaseIdoutput (that only exists for dedicated KBs). The handler therefore returnedDataSources: [], the ingestion Map state iterated over zero items, and the sync finishedSUCCEEDEDwhile 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_idanddata_source_idsthatupdate_knowledge_base_id()already persisted on the bot record at creation time. Dedicated bots and the SharedKnowledgeBases creation flow are untouched (they populatedata_sourcesbefore 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 (IngestKnowledgeBaseDocumentsagainst the bot record's KB and data source) indexed them correctly and retrieval picked them up.