fix: preserve bookId when proposed action creates new session - #314
Open
404-Page-Found wants to merge 1 commit into
Open
fix: preserve bookId when proposed action creates new session#314404-Page-Found wants to merge 1 commit into
404-Page-Found wants to merge 1 commit into
Conversation
…o#312) When handleProposedAction creates a new session (non-sameSession path), activeBookId was not passed to createSession or sendMessage, causing the server to compute agentBookId as null. After switching channels, the agent cache was evicted and a new Agent was created with null bookId, making the auditor throw 'requires bookId when there is no active book'. Pass activeBookId through both createSession and sendMessage in the new-session branch to preserve the book context across channel switches.
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 #312
Summary
When handleProposedAction creates a new session (non-sameSession path), �ctiveBookId was not passed to createSession() or sendMessage(). This caused the server to compute �gentBookId = null, and after switching channels (e.g. due to an upstream error), the agent cache was evicted and a new Agent was created with
ull bookId — making the auditor throw:
Fix
In ChatPage.tsx, pass �ctiveBookId through both createSession() and sendMessage() in the new-session branch of handleProposedAction:
This ensures the book context is preserved when a proposed action creates a new session and the user subsequently switches channels.
Testing