fix(desktop): delete of an already-gone session removes the row instead of resurrecting it#159
Merged
Merged
Conversation
…d of resurrecting it Deleting a session whose backend row no longer exists (deleted on another device, or a remote profile's session this device only remembers via a pin) 404s "Session not found" — and removeSession's catch rolled back the optimistic removal INCLUDING the pin. Result: a ghost pinned row that renders forever and can never be deleted (every retry 404s and resurrects it again); the operator hit exactly this with a 3-day-old pinned <think> session. Treat "Session not found" as already-deleted: keep the optimistic removal (row, total, pin) and finish local cleanup instead of rolling back. Other delete failures still roll back and surface the error. Also sweeps two pre-existing lint errors in this file's import block (#152-era debt). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
🔎 Lint report:
|
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.
Operator-reported: a pinned 3-day-old
<think>session shows Delete failed: Session not found and can never be removed.Root cause: the session's backend row no longer exists (it was a remote-profile/foreign row this device only remembers via its localStorage pin — confirmed absent from every
state.db, no lineage children). The REST delete 404s, andremoveSession's catch rolls back the optimistic removal including the pin — resurrecting the ghost row on every attempt, forever.Fix: classify
Session not foundas already deleted (isSessionGoneError) — keep the optimistic removal (row, totals, pin) and finish local cleanup. All other delete failures still roll back + surface the error exactly as before. Also sweeps two pre-existing lint errors in this file's import block (#152-era debt).Tests: 3 cases for the error classifier (the exact electron-wrapped 404 shape, case variants, and non-matching failures that must still roll back).
tsc+eslintclean; vitest green.