ac4af582301a4e8a29245dbba767eba31334ddf9
4
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
11dcc743f4 |
sessions: a listed file is 96 bytes, what only some agents' files have kept behind one pointer
A Sessions poll copies every agent's list of ~20k files several times (listedRollouts, heldFiles' clone, callFilesWith, allFiles, byKey, statsRead). Each file was 232 bytes, most of it fields only OpenCode, ZCode, Hermes, Alma, agy, Cursor's editor or WSL files fill. Those move into fileMore behind file.more (nil when a file has none); reads go through m(), writes through w(), which copies first, so copies of a file never see each other's writes, as before. A/B with the real ~/.codex and ~/.claude data (ab5.sh, 8 polls 15s apart, alloc_space between heap-0 and heap-1), base |
||
|
|
c381e4cd1e |
sessions: a read is never held by another read's refresh, only by a change to the files (#2776)
A read of the sessions (List, Stats, Manage, the agents' lists, Codex's threads) took dbReadMu, a plain mutex, for the whole call, parse included. The start's warm-up reads every session file with a quarter of the cores, so the first pages and API calls after a start waited for its whole read before they could even look at the cache. - dbReadMu becomes storeMu, an RWMutex: reads take it shared, and only the changes to the files (Delete, a Codex provider move, a Claude project relocation) take it alone. - A file another refresh is reading now is in `parsing`, with a channel closed when its parse is in the cache. A second read serves the parse it already has of such a file, and waits only for one it has never read; it never reads the same file twice at once. - Each parse is published as it finishes, not in checkpoint batches, so a waiting reader gets it at once. - The shared store handles (OpenCode, Hermes, Alma, Cursor) closed at the end of every read; with reads overlapping, one could close a handle another still used. They now live as long as their last user (useDBs). get() and the titles path closed them without the lock at all before. Tests (internal/sessions/refresh_shared_test.go), each broken by hand: - TestReadNotHeldByAnotherRead: the warm-up's parse of 12 grown files is held; List and Manage answer within 10s from the kept parses, each file is parsed once in all, and a later List parses none. With storeMu.Lock in List: red, "List waited for another read of the same files to end". - TestReadWaitsForAFirstReadUnderWay: a file never read is waited for, not served empty, and read once. Without the waits: red, "List answered without the files being read". Without the skip of a file being read: panic, close of nil channel. - TestStoresLiveAsLongAsTheirLastUser: with the release always closing: red, "closed while a read still used it". All three pass with -race. Measured on a sandbox instance (600k gateway calls, ~4,600 Claude Code and Codex sessions, 300 grown since the last start; 4 API calls asked 3.5s after the routes, when the warm-up starts), base |
||
|
|
5618ade1e6 |
sessions: each reply in a session's conversation names the model its own line in the agent's file names (#2253, cnlove7777777-art)
Usage -> Sessions' conversation said only "Assistant", so which model wrote a reply couldn't be told, though the agents' files name it. - sessions.Part gains model (omitempty), set on assistant parts only, from the part's own line: Claude Code's message.model (the model that answered; none for its "<synthetic>" lines), Codex's turn_context.model (the model the turn was sent to; a /model between turns moves the next turn), Pi's and omp's message.model, OpenCode's modelID and OpenCode 2's model.id. - Kimi Code (its model is only on a usage.record written after the reply), Cursor (no model in the transcript) and gateway transcripts (GatewayTurn.Model is the model asked for, not the one that answered) name none. Nothing is guessed from nearby requests. - The reader (sessions client.js) says it muted after the role, once a reply at its first part and again only where it changes inside the reply; the tooltip is "Model: <id>" (an existing string, translated). ledSaid takes the model as an argument, so the Usage page's per-request content, whose row already names its model, is unchanged. No layout change: one muted span in the existing header line, ellipsized at narrow widths. Run: - TestTranscriptModelClaude/Codex/Pi/OpenCodeV2/OpenCodeFiles: all five fail on the old content.go/transcript*.go, pass on the new. - sessions-talk-model.test.cjs: 20/20 (chromium+webkit, en/zh/zh-TW/ ja/de, 1100 and 420). Fails on the old app.js/client.js, and with the once-a-reply rule removed by hand (label every assistant part). - sessions-talk, sessions-export, gateway-conversations, usage-ledger-content, usage-ledger-detail GUI tests: all pass. - go test -tags nogui ./internal/sessions ./internal/gui ./internal/gateway: ok. gofmt -l clean; go vet -tags nogui darwin/ linux/windows clean. Full suite for this push (#2257, #2251, #2254, #2253) at 53677ed8d: go test -tags nogui -p 4 -timeout 40m ./... with pipefail: every package ok. (An earlier full run caught davsync's TestSyncLibrary and profile's TestOldProfiles/TestProfileCarriesLibrary relying on a gone CLI after #2254; their sandboxes now have the CLIs, in #2254's commit.) Not tried: the real app against a live Codex rollout (fixtures follow the lines the readers already parse for usage). |
||
|
|
1cd8140047 |
sessions: read Cursor editor history and Cursor/OpenCode conversations (#1743)
Discover editor project transcripts and cursorDiskKV histories without modifying the source. Share one SQLite/WAL snapshot across a scan, refresh metadata changes, deduplicate CLI histories, and reject deletion of read-only sessions. Count message-only sessions and expose an all-dates action when a filter hides existing history. Read Cursor CLI text, reasoning and tool parts, and OpenCode v1/v2 transcripts through the existing transcript API. |