fix(desktop): interrupt-first after Stop so edit/resend avoids session-busy - #84629
Closed
olympusbuildz wants to merge 1 commit into
Closed
olympusbuildz wants to merge 1 commit into
olympusbuildz wants to merge 1 commit into
Conversation
…n-busy Stop clears frontend busy immediately while the gateway may still wind down. Edit/restore then passed interruptFirst=false and raced 4009 session busy. Keep a short per-session cooldown after cancel so rewind still interrupt-first, and expire the submit-in-flight lock so a hung submit cannot block the session forever. Fixes NousResearch#83855 Co-authored-by: Olympusbuildz <Olympus.roots@outlook.com> Signed-off-by: Olympusbuildz <Olympus.roots@outlook.com>
2 tasks
Collaborator
|
Thank you for this fix! It was salvaged into #86594 (cherry-picked onto current main with your authorship preserved in the commit history) and is now merged. Closing this PR since the work has landed. |
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.
Problem
After Stop, editing a user message and resending often fails with session busy (or a silent no-op). Frontend
cancelRunclearsbusyimmediately while the gateway may still be winding down the interrupted turn.editMessage/restoreToMessagethen computedinterruptFirstonly frombusy, so rewind submitted without interrupt-first and raced 4009.A second footgun:
_submitInFlightwas a bareSetwith no TTL. A hungprompt.submitnever released the lock, so later sends silently returned false.Root cause
apps/desktop/src/app/session/hooks/use-prompt-actions/index.ts—cancelRunsetsbusy: falsebefore/while gateway interrupt settles; edit path usedbusyRef || $busyonly.session-tile-actions.ts).utils.ts— submit-in-flight lock never expired.Fix
markSessionRecentlyInterrupted/shouldInterruptBeforeRewind) so edit/restore still interrupt-first while the gateway settles. Idle rewinds (not busy, not recently interrupted) stay interrupt-free.acquireSubmitInFlight/releaseSubmitInFlight) so a hung submit cannot permanently block the session.Why it matters
Stop → edit/resend is a common recovery path. Users currently have to open a new session when the race hits.
Test plan
cd apps/desktop npm run test:ui -- src/app/session/hooks/use-prompt-actions/utils.test.ts src/app/session/hooks/use-prompt-actions/rewind.test.ts55 passed @
47dc9be63e364768b7381eb9c297c9f99ffd5e5e(Mini, Hermes-run after Cursor Auto).Covered: cooldown true/false at boundary;
shouldInterruptBeforeRewindtrue after Stop withbusy=false; idle stays false; lock blocks while fresh and reclaims after TTL; explicit release.Risk / blast radius
busy=true).finally.Closest work
none found (issue #83855 + keyword search for session-busy / recentlyInterrupted / edit after Stop).
Fixes #83855