Scan every project for broken transcripts, and stop crying wolf

repair-session only ever listed the project you were standing in, which is a
poor place to start from when the thing you cannot resume is a session whose
project you no longer remember. --all drops the working-directory scoping and
checks all of them. (A named session id was already looked up across every
project; only the listing was scoped.)

The first version of that scan reported 16 of 59 transcripts as unresumable,
which was true in the narrowest sense and useless in every other. Checking them:
5 had never received an assistant reply at all, and 10 had run start to finish
on a gateway, so every id in them is that provider's by design. Those resume
perfectly well under the provider they were born on, have nothing to truncate
back to, and are only a problem if you try to resume them as Anthropic. Calling
either of them damage buries the one case that is.

So the verdict now carries a kind - healthy, repairable, gateway-native,
synthetic-only, no-messages - and only `repairable` is reported or acted on: a
transcript with a genuine msg_ message and junk after it. Across the same 59 it
now correctly reports nothing to repair, while still classifying the real
corrupted transcript from the incident as repairable with 108 lines to drop.

A gateway-native session asked about directly now says what it is and that there
is nothing to fix, rather than failing with "no Anthropic-issued message".
This commit is contained in:
smoido
2026-08-31 02:22:01 +03:00
parent a14418b5d9
commit 43cef6bf9e
3 changed files with 79 additions and 4 deletions
+18
View File
@@ -750,6 +750,23 @@ def cmd_repair_session(argv):
if lines[i].strip() and _msg_id(_safe(lines[i])) is not None]
healthy = (last_good >= 0 and not tail_ids)
# Not every transcript without an Anthropic id is damaged, and saying so
# turns the scan into noise. A session that ran start to finish on a gateway
# has `gen-` ids throughout by design: it resumes perfectly well under the
# provider it was born on, has nothing to truncate back to, and is only a
# problem if you try to resume it as Anthropic. Likewise a session that never
# got a reply at all has no ids and nothing wrong with it.
if healthy:
kind = "healthy"
elif last_good >= 0:
kind = "repairable"
elif foreign:
kind = "gateway-native"
elif synthetic:
kind = "synthetic-only"
else:
kind = "no-messages"
out = {
"path": path,
"lines": len(lines),
@@ -758,6 +775,7 @@ def cmd_repair_session(argv):
"foreignIds": foreign,
"syntheticIds": synthetic,
"healthy": healthy,
"kind": kind,
"repairable": (not healthy) and last_good >= 0,
"applied": False,
"backup": "",