Repository navigation
fix(app): no duplicate sessions when Enter is pressed again while a new chat starts (#2157) - #2159
Merged
Merged
Conversation
…essions on a second Enter (#2157)
Contributor
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
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.
Closes #2157. The delay that makes a second press likely is tracked separately in #2158.
Problem
Starting a new chat sometimes produced two or more identical sessions with the same first message, and each one generated its own response.
handleSubmitcallssession.createon every submit while the route is still a draft. The composer keeps its text until the create, the navigation transition and the first send have all finished, which took 10–30 s on Jackson's busy engine. So every extra Enter created another session, and each got the same text.The sessions database has three such clusters today: five "testing" sessions, all sent at the same moment, and two pairs (details in #2157).
Fix
new-session-gate.tsis a module-level gate keyed by draft (server scope, project directory, draft id). While one new-session submit from a draft is in flight, further submits from that draft do nothing.submit.ts:handleSubmitnow runs a draft submit under the gate. A submit in an existing session bypasses the gate, so follow-ups queue as before. The body of the oldhandleSubmitis unchanged and now lives insubmitPrompt.Verification
new-session-gate.test.ts, 7 tests:handleSubmitgoes through the gate.PASSafterrefresh_manifest../.notturno/gates: GREEN.prompt-inputsuite shows the same 4 failures with and without this change. They are import errors at module load (toaster,base64Decode) insubmit.test.tsandharness*.test.ts, unrelated to this diff.