Notice broken sessions in the bar, and offer to repair them there

Nothing tells you a session is unresumable until you try to resume it, and by
then you have usually forgotten which one it was. The widget now scans every
project on a timer and whenever the panel opens, marks its icon when something
needs fixing, and lists the affected sessions with a repair button that says
what it will drop and what it will keep before doing anything.

The scan had to get roughly eighty times cheaper first. Classifying a transcript
needs two facts - what its last message id is, and whether any Anthropic id
exists at all - and the first settles the common case alone. Reading the tail of
each file and only opening the whole thing when the tail already looks wrong
takes the sweep from ~5s to ~60ms across 59 transcripts, which is the difference
between something that can sit on a timer and something that cannot. `--all`
uses the same path, and `--json` exposes it.

The badge is a dot beside the mark rather than a recolouring of it: this widget's
job is to report which provider is active, and tinting it red to mean something
else entirely would be a lie about that.

Verified by planting a genuinely corrupted transcript, watching the scan find it
and the dot appear, then removing it and watching both clear.
This commit is contained in:
smoido
2026-08-31 02:28:24 +03:00
parent 43cef6bf9e
commit 4c36f4d00b
5 changed files with 393 additions and 32 deletions
+17
View File
@@ -388,6 +388,23 @@ session untouched.
It refuses to touch a transcript written to in the last 90 seconds, since that
one belongs to a session still alive.
### The bar notices for you
Nothing tells you a session is unresumable until you try to resume it, by which
point you have usually forgotten which one it was. So the widget scans every
project on a timer (and whenever the panel opens) and puts a dot on its icon
when there is something to fix. Clicking through lists the affected sessions and
offers to repair each one, after saying what it will drop and what it will keep.
The dot is a dot rather than a colour change, because recolouring the mark would
misreport the active mode — which is the widget's actual job.
That scan is only affordable because it reads the *tail* of each transcript
first: if the last message is Anthropic's, the transcript is healthy and the
rest of the file is never opened. Since that is the overwhelmingly common case,
the whole sweep costs ~60ms for 59 transcripts, against ~5s for the obvious
version that reads every byte of every one.
This is why a switch now asks before it writes rather than reporting afterwards.
So restart affected sessions — and `claude-mode sessions --restart` will do it
for you: