Fix: Surface session_terminated event in CLI and Web UI - #351
Open
VectorCipher wants to merge 6 commits into
Open
Fix: Surface session_terminated event in CLI and Web UI#351VectorCipher wants to merge 6 commits into
VectorCipher wants to merge 6 commits into
Conversation
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.
Fix: Issue #345
This PR fixes a critical bug where a context compaction failure would emit a session_terminated event that was completely unhandled by consumer layers, resulting in a silent hang/death for both CLI and Web UI users.
This PR implements the missing event handlers across the stack to ensure the agent fails loudly and gracefully.
Changes Made:
a) Added an explicit handler for session_terminated to stop the shimmer, print the user-facing error message, and correctly unblock the event loop.
b) Regression Guard: Replaced the silent # Silently ignore other events fallback with a logger.warning to ensure any future unhandled event types are surfaced in the logs instead of failing silently.
a) Added 'session_terminated' to the EventType union for end-to-end type safety.
a) Added the session_terminated case to the SSE event switch statement.
b) Connected the event to the existing onError and onProcessingDone side-channels so the Web UI now correctly drops out of the loading state and displays the terminal error banner to the user.
a)Added backend tests (test_session_terminated_dispatch.py) to verify the CLI explicitly handles the event and that unknown events trigger the new warning guard.