yetone
78cd4e6dd4
sessions: a call through magpie in Cindy is counted once, as the gateway's (jealousy03888)
...
jealousy03888 on Discord: "cindy里用Zcode订阅 同一个请求两个记录是特性吗".
Their Routing list had one ZCode GLM-5.3 request twice: the gateway's row
(ZCode · api.z.ai, 135/37/84,736 tokens, ~$0.026) and five seconds later
a "local session" row on the provider "magpie-beedee1a" with the same
tokens and cost, so Usage and the Requests totals counted it twice too.
Cause: Cindy's import parser gives a custom provider the link's id plus
eight hex digits of a new UUID (`${id.slice(0,24)}-${randomUUID()
.slice(0,8)}`, read in Cindy 0.1.94's app.asar), so magpie's link (id
"magpie") becomes "magpie-<8 hex>", and Cindy's Pi writes that id on
every reply. The Pi reader left out only "magpie"/"dial", so Cindy's
calls through magpie were read as Cindy's own beside the gateway's.
Now piGateway(agent, provider) also takes "magpie-" + eight lowercase
hex digits as magpie's entry, in Cindy's files only (Pi's own and omp's
providers are named by the user; magpie writes "magpie" there). A
provider the user adds by hand in Cindy under the name Magpie gets the
slug "magpie" or "magpie-2", never this shape. callParseVersions raises
cindy to 1, so Cindy's call shards written before are read again once
on update and the duplicates already shown go away (usage's request and
heat caches key on CallCacheVersion, so they are rebuilt too); no other
agent's shards are re-read.
Every other agent's reader was checked for the same gap (an id the app
chooses rather than magpie): OpenCode and ZCode ("magpie", written by
magpie), dsh (magpie's three route names), MiniMax Code
(custom_provider:magpie), Kimi ("magpie/" model prefix), WorkBuddy and
CodeBuddy (models.json vendor magpie), Grok Build (its config.toml
tables), Pi, omp and Raft (models.json "magpie"), Claude Code, Codex
and Antigravity (paired with the gateway's rows by session, response id
or tokens and time). Cindy is the only one whose provider id is made by
the app; Lody and AionUi also import a link but their sessions aren't
read.
TestCindyGatewayCallsCountedOnce puts a Cindy Pi session shaped like
the report (provider magpie-beedee1a, zcode/GLM-5.3, 135/37/84,736,
durationMs 5292) and a reply on a user's own "magpie-relay" into
Cindy's session folder; the first must not be a call, the second must
be one. TestCallParseVersionRaiseReadsThatAgentAlone now restores the
real versions after it.
Run (on mote): gofmt -l internal/sessions (nothing); go vet;
GOOS=linux go vet -tags nogui ./...; GOOS=windows go vet ./...; go build
./... all ok. go test -tags nogui -timeout 45m ./... at 40a287b21+this:
86 packages ok, internal/cli red on two filed reds outside this change:
TestEveryRouteHasACommandOrIsNamed (GET /api/context/reply, #5026 ,
red alone too) and TestLibraryMCPHub (#4140 , passes alone). Rebased on
c3593dc49 (no sessions or usage change between) and run again at the
pushed head: internal/sessions ok, internal/usage ok.
Broken by hand: piGateway's Cindy branch replaced by `return false`:
TestCindyGatewayCallsCountedOnce FAIL ("a call through magpie's link in
Cindy counted as Cindy's own: ... Upstream:magpie-beedee1a ...").
Not tried: a real Cindy session through magpie (none on this machine;
the shape is from Cindy's source and the reporter's screenshot); the
Sessions overview's session count for Cindy, which counts sessions,
not calls, and was not changed.
2026-11-03 18:15:07 +08:00
..
2026-10-30 11:28:49 +08:00
2026-10-29 23:56:05 +08:00
2026-11-03 08:54:40 +08:00
2026-10-30 11:28:49 +08:00
2026-10-17 14:05:17 +08:00
2026-10-31 23:10:48 +08:00
2026-10-31 23:10:48 +08:00
2026-10-31 23:10:48 +08:00
2026-10-31 23:10:48 +08:00
2026-10-31 23:10:48 +08:00
2026-10-31 23:10:48 +08:00
2026-10-27 04:39:56 +08:00
2026-10-29 23:56:05 +08:00
2026-10-24 02:48:50 +08:00
2026-10-24 02:48:50 +08:00
2026-10-27 04:15:48 +08:00
2026-10-29 23:56:05 +08:00
2026-10-27 10:01:09 +08:00
2026-10-31 11:53:10 +08:00
2026-10-31 11:53:10 +08:00
2026-10-25 05:42:59 +08:00
2026-10-25 15:55:54 +08:00
2026-11-03 18:15:07 +08:00
2026-10-04 07:57:49 +08:00
2026-10-04 10:01:52 +08:00
2026-10-25 07:17:17 +08:00
2026-10-25 06:45:23 +08:00
2026-10-27 11:42:49 +08:00
2026-10-24 23:40:00 +08:00
2026-11-03 18:15:07 +08:00
2026-10-14 14:35:23 +08:00
2026-10-25 18:24:20 +08:00
2026-10-22 18:06:07 +08:00
2026-10-19 11:30:48 +08:00
2026-10-19 11:30:48 +08:00
2026-11-03 05:08:39 +08:00
2026-11-03 05:08:39 +08:00
2026-10-19 11:30:47 +08:00
2026-10-19 11:30:47 +08:00
2026-10-11 20:09:15 +08:00
2026-10-29 23:56:05 +08:00
2026-10-22 18:06:07 +08:00
2026-10-29 23:56:05 +08:00
2026-10-19 11:30:47 +08:00
2026-11-03 18:15:07 +08:00
2026-10-01 17:42:10 +08:00
2026-10-15 23:08:00 +08:00
2026-10-29 12:42:52 +08:00
2026-10-19 11:30:48 +08:00
2026-11-03 08:54:40 +08:00
2026-10-13 16:17:06 +08:00
2026-10-07 19:43:01 +08:00
2026-10-29 23:56:05 +08:00
2026-11-03 08:54:40 +08:00
2026-10-25 12:25:06 +08:00
2026-10-29 23:56:05 +08:00
2026-10-25 12:25:06 +08:00
2026-10-29 15:03:18 +08:00
2026-10-30 06:00:55 +08:00
2026-11-02 17:19:23 +08:00
2026-11-03 18:15:07 +08:00
2026-11-01 09:12:11 +08:00
2026-10-27 04:39:56 +08:00
2026-11-02 06:11:06 +08:00
2026-10-27 04:39:56 +08:00
2026-10-27 04:39:56 +08:00
2026-10-27 04:39:56 +08:00
2026-11-02 06:11:06 +08:00
2026-10-27 04:39:56 +08:00
2026-10-27 04:39:56 +08:00
2026-10-27 04:39:56 +08:00
2026-10-31 12:50:14 +08:00
2026-10-30 11:28:49 +08:00
2026-10-08 19:04:18 +08:00
2026-10-29 13:17:17 +08:00
2026-10-29 23:56:05 +08:00
2026-10-12 02:56:01 +08:00
2026-10-31 02:49:08 +08:00
2026-10-31 02:49:08 +08:00
2026-10-08 19:04:18 +08:00
2026-10-30 11:17:19 +08:00
2026-10-04 18:56:31 +08:00
2026-10-04 18:56:31 +08:00
2026-10-25 07:42:13 +08:00
2026-10-29 07:08:23 +08:00
2026-10-15 03:34:58 +08:00
2026-10-18 02:43:03 +08:00
2026-10-05 21:56:59 +08:00
2026-11-02 06:11:06 +08:00
2026-11-02 06:11:06 +08:00
2026-11-01 17:41:02 +08:00
2026-11-01 17:41:02 +08:00
2026-10-31 18:52:01 +08:00
2026-11-03 10:50:30 +08:00
2026-11-03 10:50:30 +08:00
2026-11-03 10:50:30 +08:00
2026-10-05 21:56:59 +08:00
2026-10-28 17:34:27 +08:00
2026-10-05 21:56:59 +08:00
2026-10-15 04:21:31 +08:00
2026-10-31 18:52:01 +08:00
2026-10-25 08:40:59 +08:00
2026-10-29 23:56:05 +08:00
2026-10-15 03:34:58 +08:00
2026-10-15 03:34:58 +08:00
sessions: Codex rollouts the Codex app has compressed (.jsonl.zst) are read as the plain ones ( #448 ) — with "compress local chat history" on, the Codex app packs older rollout-*.jsonl into rollout-*.jsonl.zst, and rolloutName ended in \.jsonl$, so those sessions, their calls and their usage were gone from Sessions, Usage and the ledger. A .zst rollout is now found, decompressed as it is read (klauspost/compress, already used for dsh's .zstd files; dshOpen now shares openLines), read whole again whenever it changes rather than read on from an offset, and its calls' places are those of its lines decompressed, so a call's content (the detail view) reads the same from either form, and one read before its file was packed still finds it. A rollout there in both forms (the app packing it) is read once, as the plain one, under the same codex:<thread id> key, so the session keeps its id and nothing is counted twice; deleting such a session moves both forms to the trash. TestCodexPackedSessions, TestCodexPackedCalls and TestCodexPackedDelete fail without the change; rollouts packed with the zstd CLI list the same as plain ones in a sandbox CODEX_HOME.
2026-10-02 00:47:11 +08:00
2026-11-02 06:11:06 +08:00
2026-10-30 06:00:55 +08:00
2026-10-01 17:42:10 +08:00
2026-10-31 17:47:20 +08:00
2026-10-27 05:39:12 +08:00
2026-10-13 18:16:18 +08:00
2026-10-13 18:16:18 +08:00
2026-10-14 04:37:37 +08:00
2026-10-29 23:56:05 +08:00
2026-10-28 14:10:42 +08:00
2026-10-28 14:09:05 +08:00
2026-10-27 04:39:56 +08:00
2026-10-29 23:56:05 +08:00
2026-10-25 17:57:52 +08:00
2026-10-31 09:41:13 +08:00
2026-10-13 07:14:22 +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-23 01:58:00 +08:00
2026-10-30 11:28:49 +08:00
2026-10-13 08:15:14 +08:00
2026-10-30 11:28:49 +08:00
2026-10-07 06:17:56 +08:00
2026-10-30 11:28:49 +08:00
2026-11-02 17:19:23 +08:00
2026-10-31 09:41:13 +08:00
2026-11-02 17:19:23 +08:00
2026-10-01 17:42:10 +08:00
2026-10-21 02:44:23 +08:00
2026-10-21 02:44:23 +08:00
2026-10-10 09:53:38 +08:00
2026-10-15 09:36:26 +08:00
2026-10-14 04:59:09 +08:00
2026-10-10 04:24:18 +08:00
2026-10-30 19:12:35 +08:00
2026-10-10 14:52:56 +08:00
2026-10-28 20:28:27 +08:00
2026-10-13 08:15:14 +08:00
2026-10-29 23:56:05 +08:00
2026-10-27 04:39:56 +08:00
2026-10-02 23:02:03 +08:00
2026-10-02 23:02:03 +08:00
2026-10-02 23:02:03 +08:00
2026-10-27 12:40:00 +08:00
2026-10-27 12:40:00 +08:00
2026-10-05 21:56:59 +08:00
2026-10-02 23:02:03 +08:00
2026-10-29 23:56:05 +08:00
2026-10-27 04:39:56 +08:00
2026-10-29 23:56:05 +08:00
2026-10-31 12:50:14 +08:00
2026-10-15 08:33:54 +08:00
2026-11-01 14:18:44 +08:00
2026-11-01 15:27:49 +08:00
2026-10-08 23:43:20 +08:00
2026-10-19 11:30:47 +08:00
2026-10-19 11:30:47 +08:00
2026-10-27 10:21:10 +08:00
2026-10-03 02:17:57 +08:00
2026-10-03 17:11:26 +08:00
2026-10-03 17:11:26 +08:00
2026-10-03 17:11:26 +08:00
2026-10-29 12:12:30 +08:00
2026-10-29 12:12:30 +08:00
2026-10-20 23:50:02 +08:00
2026-10-15 09:40:51 +08:00
2026-10-03 17:11:26 +08:00
2026-10-03 17:11:26 +08:00
2026-11-03 08:54:40 +08:00
2026-10-08 17:38:03 +08:00
2026-10-11 01:13:52 +08:00
2026-10-27 04:39:56 +08:00
2026-10-27 04:39:56 +08:00
2026-10-30 11:54:46 +08:00
2026-10-29 23:56:05 +08:00
2026-10-30 12:25:23 +08:00
2026-10-30 10:28:30 +08:00
2026-10-13 08:15:14 +08:00
2026-10-30 11:28:49 +08:00
2026-10-29 00:48:47 +08:00
2026-10-22 22:03:16 +08:00
2026-10-31 11:53:10 +08:00
2026-10-29 23:56:05 +08:00
2026-10-31 09:41:13 +08:00
2026-11-01 04:40:44 +08:00
2026-10-21 18:19:47 +08:00
usage: a model spelled with a dotted version is priced at its maker's, and a model can be priced from any provider (tony on Discord: old sessions' copilot/claude models had no known price) — Copilot and its CLI's sessions name Anthropic's models claude-opus-4.6 and claude-haiku-4.5, models.dev's anthropic entry claude-opus-4-6 and claude-haiku-4-5, and a session's bare model was looked up only by its exact key at its maker, so neither was priced; a gateway call whose provider is gone or lists no price fell to the same miss. A price is now looked for with a dot and a dash taken for the same, after every exact match. gemini-3-pro-preview stays unpriced: Google's entry on models.dev no longer lists it and no price is made up. For it, and any model like it, magpie model price <model> <in>,<out>,<cache read>,<cache write> keeps a price under */<model> that counts from any provider not priced by the user, after <provider>/<model> and <provider>/* and before any list price, and for a session's bare model; --reset takes it away, magpie model prices lists it. TestDottedIDPricedAtItsMakers, TestAnyProviderPrice and TestPriceOfDottedAndAnyProvider fail without the change. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass.
2026-10-01 17:46:54 +08:00
2026-10-30 18:55:51 +08:00
sessions: a session in magpie's trash can be erased for good, one at a time or the whole trash, after magpie's own dialog ( #487 : no way to empty the trash but removing its folder by hand) — the Sessions page's Trash only restored, and said magpie never erases what is in it: remove the folder yourself. Each trashed row now has Delete forever and the Trash an Empty trash, with the count of what is in it; both ask in magpie's dialog, as Delete does (never confirm()), naming the sessions, and Cancel sends nothing. They post /api/sessions/purge with the rows' keys, or all for every session the trash lists; each key is checked as Restore checks it (<agent>/<name>, an agent magpie deletes for, no separators, no . or ..), and its folder, and its agent's, must be real folders in <magpie dir>/trash/sessions, not links, with the session's note (session.json) in it; only that folder goes, its note with it, so the trash lists it no more. Nothing is erased by itself: the note under the Trash now says they are kept until erased there, and magpie never erases them by itself. TestPurgeOne, TestPurgeAll, TestPurgeRefusesOutOfTrash, TestSessionsPurgeRoute and sessions-purge.test.cjs (Chromium, WebKit; en, zh) fail without the change. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass (TestFXInState failed once under load, passes alone and in its package); sessions-manage, sessions-toolbar, click-scroll, old-webkit pass.
2026-10-02 08:20:33 +08:00
2026-10-04 23:30:56 +08:00
2026-11-02 06:11:06 +08:00
2026-10-25 15:29:58 +08:00
2026-10-20 20:32:05 +08:00
2026-10-20 20:32:05 +08:00
2026-10-29 15:29:30 +08:00
2026-10-30 14:38:22 +08:00
2026-10-29 15:31:36 +08:00
2026-10-13 13:02:09 +08:00
2026-10-13 13:02:09 +08:00
2026-10-19 11:32:59 +08:00
2026-10-18 02:43:03 +08:00
2026-11-02 06:11:06 +08:00
2026-09-30 20:31:11 +08:00
2026-11-01 11:34:13 +08:00
2026-09-30 02:07:50 +08:00
2026-10-21 00:07:49 +08:00
2026-10-13 06:43:50 +08:00
2026-10-13 06:43:50 +08:00
2026-10-30 19:12:35 +08:00
2026-10-05 22:23:29 +08:00
2026-10-13 08:15:14 +08:00
2026-11-03 08:54:40 +08:00
2026-10-21 18:19:48 +08:00
2026-10-21 18:19:48 +08:00
2026-11-03 08:54:40 +08:00
2026-10-30 11:17:19 +08:00
2026-10-25 05:42:59 +08:00
2026-10-13 09:37:52 +08:00
2026-10-30 14:38:22 +08:00
2026-10-31 09:41:13 +08:00
2026-11-01 14:18:44 +08:00
2026-10-29 08:52:32 +08:00
2026-10-27 04:15:48 +08:00
2026-10-20 20:32:04 +08:00
2026-10-28 20:53:36 +08:00
2026-11-01 06:21:39 +08:00
2026-11-01 06:21:39 +08:00
2026-10-20 20:32:04 +08:00
2026-10-10 20:47:00 +08:00
2026-10-15 23:08:01 +08:00
2026-10-29 23:56:05 +08:00
2026-10-27 04:39:56 +08:00
2026-10-25 01:39:40 +08:00
2026-10-25 01:39:40 +08:00
2026-10-21 18:19:48 +08:00
2026-10-21 02:44:22 +08:00
2026-10-29 12:42:52 +08:00
2026-10-29 12:42:52 +08:00
2026-10-15 23:08:00 +08:00
2026-10-15 23:08:00 +08:00
2026-10-29 23:56:05 +08:00
2026-10-15 23:07:59 +08:00
2026-10-15 23:07:59 +08:00
2026-10-27 12:40:00 +08:00
2026-10-27 12:40:00 +08:00
2026-10-19 11:32:59 +08:00
2026-10-03 01:43:32 +08:00
2026-10-04 23:30:56 +08:00
2026-10-30 10:28:30 +08:00
2026-10-14 08:28:52 +08:00
2026-10-15 23:08:01 +08:00
2026-10-15 06:07:43 +08:00
2026-10-13 06:43:50 +08:00
2026-10-27 12:40:00 +08:00
2026-10-25 12:25:06 +08:00
2026-11-01 09:12:11 +08:00
2026-10-31 16:05:49 +08:00
2026-10-30 10:28:30 +08:00
2026-11-03 08:54:40 +08:00
2026-11-03 08:54:40 +08:00
2026-10-15 09:36:26 +08:00
2026-10-13 16:08:07 +08:00
2026-10-31 21:29:22 +08:00
2026-10-29 23:56:05 +08:00