You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The change moves emit(sessionId, { type: "message", role: "user", ... }) from before the status(running) emit + API call to after the postRequestStatus killed-session guard. This correctly aligns the stream with DB state.
Killed path (old → new): message(user), status(running) → status(running) ✓ (user row deleted from DB, no stream event emitted — now consistent)
[nit] api-session-runtime.ts:118 — the user message event is now emitted after a potentially long API round-trip. Clients that render the user's own message via the stream (rather than optimistically) will see a blank turn until the response arrives. Not a bug given the current architecture, but worth a comment if the intended streaming consumer ever changes.
[should-fix] No test covers the !result.ok (provider HTTP error) path. In that path the user message IS kept in the DB and IS now emitted at line 118 before error/status(failed) — which is correct — but there's no regression guard for it. Fix this →
No correctness bugs, type-safety issues, or security concerns found. The logic is tight and the existing test updates accurately capture both the success and killed-session orderings.
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
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
Tests