Skip to content

fix(desktop): delete of an already-gone session removes the row instead of resurrecting it#159

Merged
OmarB97 merged 1 commit into
mainfrom
fix/ghost-pin-delete-404
Jun 10, 2026
Merged

fix(desktop): delete of an already-gone session removes the row instead of resurrecting it#159
OmarB97 merged 1 commit into
mainfrom
fix/ghost-pin-delete-404

Conversation

@OmarB97

@OmarB97 OmarB97 commented Jun 10, 2026

Copy link
Copy Markdown
Owner

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, and removeSession's catch rolls back the optimistic removal including the pin — resurrecting the ghost row on every attempt, forever.

Fix: classify Session not found as 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 + eslint clean; vitest green.

test (5) is baseline-red on main (stale npm-argv assertion in test_tui_npm_install.py, verified failing on main locally) — unrelated to this TS-only change.

…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>
@github-actions

Copy link
Copy Markdown

🔎 Lint report: fix/ghost-pin-delete-404 vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 10689 on HEAD, 10689 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 5599 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@OmarB97 OmarB97 merged commit 7f13865 into main Jun 10, 2026
24 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant