Auto-restart session on expiry, extend test coverage to 93%, add CI workflow - #11
Merged
chintandesai-cimulate merged 7 commits intoSep 16, 2026
Merged
Conversation
When the SDK emits SESSION_EXPIRED, silently reset the widget to idle (clear stored session, reset hasUserSentRef, clear error) so the next user interaction triggers a fresh handshake via ensureConnected.
3 tasks
Add new test files for event-emitter, logger, errors, and SSE reader. Extend existing client and tokens tests to cover reconnect paths, typing events, error edge cases, and JSON extraction branches.
If the session expires while the agent is mid-response, agentTyping or streamingText could remain set. Since hasUserSentRef is reset to false, the follow-up typing_stopped/message events that would clear them are blocked, leaving the composer disabled. Dispatch SET_ANSWER to clear both before resetting to idle.
chintandesai-cimulate
approved these changes
Sep 16, 2026
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.
Summary
SESSION_EXPIRED, the widget silently resets to idle instead of showing an error. Clears the stored session, resetshasUserSentRefto drop the new welcome greeting, and sets status back toidle. The user's next message transparently triggers a fresh handshake viaensureConnected.agentTypingandstreamingTextare now cleared by dispatchingSET_ANSWERwith empty content before resetting to idle — prevents the composer from staying disabled..github/workflows/ci.yml) that runs unit tests with coverage on PRs and pushes to main (Node 20.x).Test plan
npm test— all 132 tests pass with coverage above thresholds