fix(desktop): recover first-submit draft when session.resume 404s (#67502) - #67539
fix(desktop): recover first-submit draft when session.resume 404s (#67502)#67539JonthanaHanh wants to merge 1 commit into
Conversation
…usResearch#67502) The sleep/wake recovery calls session.resume without try/catch. For a never-persisted draft (no DB row because the first prompt.submit never landed), the resume itself throws 4007 session not found — surfacing as the dead-end "Prompt failed / session not found" toast. Wrap the resume in try/catch. When resume fails with session-not-found, mint a fresh backend session via createBackendSessionForSend so the message lands instead of being dropped. Fixes NousResearch#67502
Related to #67503, which covers the same first-submit double-404 recovery but also rehomes optimistic state and attachments and guards timeout/queued sends. This narrower patch needs a maintainer consolidation choice. |
|
Thanks for isolating the no-row first-submit recovery path. The premise is present on current main: Problems
Suggested changes
Automated hermes-sweeper review. |
|
Superseded by #81261. Thanks for this — the resume-itself-404s guard for never-persisted drafts is carried over there, with you credited via Consolidating because this is one bug class across several PRs: |
Summary
Submitting the first message of a new chat fails with "Prompt failed / session not found" when the gateway's in-memory session is cleared between
session.createand the firstprompt.submit(sleep/wake, network blip, gateway restart).The sleep/wake recovery path calls
session.resumewithout try/catch. For a never-persisted draft (no DB row because_ensure_session_db_rowonly runs on the first successful submit), the resume itself throws 4007 "session not found" — the error escapes to the outer catch and surfaces as the dead-end toast. Every retry hits the same loop.Fix
Wrap the recovery
session.resumein try/catch. When resume fails with session-not-found (the never-persisted-draft signature), mint a fresh backend session viacreateBackendSessionForSendso the message lands instead of being dropped.Testing
Fixes #67502