Files
magpie/internal/sessions
yetone 4f40a1061e sessions: a turn of a long Claude session reads none of its copies again (shangyuan0818 on X)
Usage → Sessions took ~20s on Windows for long Claude Code sessions
(tens to ~100 MB each, few rows). A session resumed or forked into new
files leaves whole copies of it, listed as one row, and the live one is
the file they are kept in. Each turn it gained re-read every copy whole,
twice:

- ccFamily dropped the uuids read of a group whose verdict it found on
  disk, so the next change judged the group by reading every file's
  uuids from the start. It now keeps them while the files start alike,
  as ccUUIDMemo's comment says, and reads on from where it stopped.
- ccRest read each copy whole again whenever the keeper changed. It now
  keeps the uuids of a copy's own messages, and while the copy didn't
  change and the keeper only grew and holds none of them, the rest
  stands. A keeper that took one of them has the rest read again
  (TestClaudeKeeperTurnTheBranchHeldIsCountedOnce, red with that check
  turned off: 90 in, want 80).

Timings, Windows (xiaomi-gpu), a 100 MB Claude session from a real one
with its text scrambled, copied under new ids:
- in process, 4 copies, /api/sessions after a turn: 261 ms and 332 ms,
  now 26 ms and 27 ms; after a start and a turn 523 ms, now 239 ms.
- the real dev backend (magpie app, sandbox HOME), 8 copies, the page's
  three calls after a turn: 607 ms, now 31 ms. Cold start 1.9 s both.
These scale with the copies and their size; the reporter's machine is
slower than this one.

Run:
- TestClaudeKeeperTurnReadsNoCopy red on the old code (copies and
  keeper read whole each turn); red with each half undone alone.
- win-run go test ./internal/sessions ./internal/gui: 14 reds, the same
  14 on origin/main 4a4424ea8 run alone (#6071, #6068, #5324, #5928,
  #6059).
- wsl-run go test ./internal/sessions at this head (on 4a4424ea8): ok. TestCCListingKeepsItsNames
  passes on Linux at base and head.
- go vet ./internal/sessions for linux, windows, darwin; gofmt clean.

Not tried: the reporter's own files; WSL-hosted Claude sessions; mote and
mica were over load, so no macOS run. After a start, the first change to
a group still reads each file's uuids once.
2026-11-15 18:56:34 +08:00
..
2026-10-02 08:20:33 +08:00