Skip to content

fix: preserve bookId when proposed action creates new session - #314

Open
404-Page-Found wants to merge 1 commit into
Narcooo:masterfrom
404-Page-Found:fix/312-switch-channel-loses-bookid
Open

fix: preserve bookId when proposed action creates new session#314
404-Page-Found wants to merge 1 commit into
Narcooo:masterfrom
404-Page-Found:fix/312-switch-channel-loses-bookid

Conversation

@404-Page-Found

@404-Page-Found 404-Page-Found commented Jun 22, 2026

Copy link
Copy Markdown

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:

auditor requires bookId when there is no active book

Fix

In ChatPage.tsx, pass �ctiveBookId through both createSession() and sendMessage() in the new-session branch of handleProposedAction:

  • createSession(activeBookId ?? null, ...) instead of createSession(null, ...)
  • Added �ctiveBookId to the sendMessage() options object

This ensures the book context is preserved when a proposed action creates a new session and the user subsequently switches channels.

Testing

  • Typecheck passes
  • Build passes
  • Core tests pass (2 pre-existing flaky failures unrelated to this change)

…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.
@404-Page-Found 404-Page-Found changed the title fix: preserve bookId when proposed action creates new session (#312) fix: preserve bookId when proposed action creates new session Jun 22, 2026
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.

多渠道同模型切换后会丢失booid导致无法进入下一行为

1 participant