Files
magpie/internal/sessions
yetone 502674abb7 sessions: a Claude copy made after /compact is one row with its session
Neo (Discord #feedback, on v0.1.1803, used /compact and /rewind): one
conversation was still listed as many rows of the same title.

Claude Code 2.1.312's /branch (and --resume --fork-session) after a
compaction copies only the compaction's summary and what follows it,
under the same uuids. 1803 grouped copies by the file's first message,
so such a copy (its first message the summary) never met the session it
was copied from and was a row of its own; opened, it read from the
summary on. Each Claude file now also records its compact summaries'
uuids (state Compacts, cacheVersion 24, so every file is read again),
and files are judged together when one starts with a message the other
starts with or holds as a summary. Of two files that hold each other's
last message, the one that also holds the other's first message is kept
(a post-compact copy written last no longer stands in for the whole
conversation), then the newer, as before.

/rewind writes in place: "Restore conversation" and "Summarize from
here" both append to the same file (a new branch under an earlier
parent, a new compact summary), no new file. Its summary is recorded
with /compact's, so a /branch made after it folds too.

Fixtures (testdata/claude-forks/compacted*.jsonl): Claude Code
2.1.312's own files from a sandbox HOME with a fake API: a session of
/compact, a /rewind restore, a /rewind summarize, a /branch after them,
that branch gone on with a turn of its own, and a /branch made after
the session's last turn; trimmed of request records, cost lines and
attachment text, paths rewritten to /w.

Run (mote) at this tree, 8eaf10cac on 4655e1659: go test -tags nogui
-timeout 45m ./... 75 packages ok, internal/gateway red on
TestPluginStreamsPastTheBudgetWait only (connection reset, vendor saw
182 of 192), which is #3946: alone it is red 2 of 3 here and 1 of 3 on
origin/main 4655e1659, which this change doesn't touch. gofmt -l clean;
go build ./... ok; GOOS=linux and GOOS=windows go vet -tags nogui
./internal/sessions ok.
Broken by hand, each red: grouping by the first message only (the
copies' rows came back: [11111111… 7b1e0c2a…]); keeping the newer of two
files that hold each other without the first-message rule (the branch
made last was the row, edc82b93…).
GUI: no file reaches it; the sessions page's JSON is unchanged
(Compacts is in the cache only, Copies is json:"-"), not run.
Not tried: Neo's own files; the ten copies of one moment he saw 16h
before are taken to be /branch or fork copies made after a compaction,
which he confirmed he used (/compact, /rewind). Copies made by a
compaction that ran in each copy on its own would each start with a
summary of their own and still be rows. The calls ledger (FindCall)
still holds a copy's calls.
2026-10-28 11:53:24 +08:00
..
test: every package's tests pass on Windows, and none writes outside its sandbox (the user: 把 Windows 上那几个失败的测试修掉) — on a Windows box the suite failed in most packages, and the root package hung for 25 minutes. Tests set HOME, which os.UserHomeDir ignores on Windows (it reads USERPROFILE), so they read and wrote the runner's own home; each now sets USERPROFILE beside HOME, and Devin's, Goose's, Crush's and Claude Desktop's tests set APPDATA/LOCALAPPDATA, where those keep their files there. said() read the command's output only once it returned, and a pipe holds a few KB on Windows, so magpie model --help blocked forever; it reads while the command writes. Unix permission bits (the gateway key store's 0600 too), exec bits and symlinks Windows lacks are checked only off Windows; TOML strings hold Windows paths as literal strings, JSON as marshalled ones; a URL's path is compared as one. The provider and usage packages run in a home of their own (TestMain, as the gateway's already does), since a CLI's identity kept by a refresh still going when its test ended landed in the runner's ~/.config/magpie — and on a Mac in the user's own. Two product fixes came out of it: imagemcp took a file:///C:/… root or image for the path /C:/…, which doesn't exist on Windows, and now makes a Windows path of it (a host for a UNC share); and session discovery could keep a new Cowork session hidden on Linux, where a folder's mtime is a kernel tick and its size doesn't change, so an entry added within the tick of the last listing left both as they were — a listing made within 2s of its folder's last change is read again, as git does for racy files. TestFilePath and TestRacyDirectoryListedAgain fail without the change. On Windows 11 every package passes (32 of 32) and a run of each package in a fresh home leaves nothing in home, APPDATA or LOCALAPPDATA; on Linux (WSL) and macOS go test -tags nogui ./... passes. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build pass.
2026-10-01 23:15:07 +08:00
test: every package's tests pass on Windows, and none writes outside its sandbox (the user: 把 Windows 上那几个失败的测试修掉) — on a Windows box the suite failed in most packages, and the root package hung for 25 minutes. Tests set HOME, which os.UserHomeDir ignores on Windows (it reads USERPROFILE), so they read and wrote the runner's own home; each now sets USERPROFILE beside HOME, and Devin's, Goose's, Crush's and Claude Desktop's tests set APPDATA/LOCALAPPDATA, where those keep their files there. said() read the command's output only once it returned, and a pipe holds a few KB on Windows, so magpie model --help blocked forever; it reads while the command writes. Unix permission bits (the gateway key store's 0600 too), exec bits and symlinks Windows lacks are checked only off Windows; TOML strings hold Windows paths as literal strings, JSON as marshalled ones; a URL's path is compared as one. The provider and usage packages run in a home of their own (TestMain, as the gateway's already does), since a CLI's identity kept by a refresh still going when its test ended landed in the runner's ~/.config/magpie — and on a Mac in the user's own. Two product fixes came out of it: imagemcp took a file:///C:/… root or image for the path /C:/…, which doesn't exist on Windows, and now makes a Windows path of it (a host for a UNC share); and session discovery could keep a new Cowork session hidden on Linux, where a folder's mtime is a kernel tick and its size doesn't change, so an entry added within the tick of the last listing left both as they were — a listing made within 2s of its folder's last change is read again, as git does for racy files. TestFilePath and TestRacyDirectoryListedAgain fail without the change. On Windows 11 every package passes (32 of 32) and a run of each package in a fresh home leaves nothing in home, APPDATA or LOCALAPPDATA; on Linux (WSL) and macOS go test -tags nogui ./... passes. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build pass.
2026-10-01 23:15:07 +08:00
2026-10-02 08:20:33 +08:00