neo_o11 (Discord, after v0.1.1809): one conversation still showed as ~9
rows with the same title, and opening one showed "Session start" and a
single turn.
Cause, reproduced with real Claude Code 2.1.312 in a sandbox
CLAUDE_CONFIG_DIR: the reporter's session was compacted, then forked
several times (headless --fork-session per task, or /branch). Each fork
starts at the compact boundary and summary, and copies the session's
last reply under the same uuid. So every fork holds the original's
Leaf, and ccCopies hid the original as a fork's copy, though it alone
holds the conversation before the compaction. Each fork had a Leaf of
its own and stayed a row, with the copied title. Opening a fork read
its own file: the summary and one turn.
Fix:
- cc_copies.go: ccFamily returns copies and branches. A file is a
copy of another only when that one holds its Leaf and its Root too,
so a file with what came before the other's start is never hidden.
The members of a family left visible pick a head (holds the other's
Root, then named in the other's forkedFrom, then the earlier start,
then the lower key); the rest are branches of it.
- sessions.go, manage.go: a branch has role "branch" and
parent_session = its head, in List, Find/get and ListAgent.
- transcript.go: a branch's transcript is its head up to the fork
point (the last line of the head holding one of the branch's
uuids), then the branch's own lines. Search still reads its file.
- stats.go: a branch counts only its own lines, so tokens are not
counted twice.
- GUI sessions plugin: the fold under a session names branches apart
("2 branches · 1 subagent"), in en/zh/zh-TW/ja/de.
- Fixtures in testdata/claude-forks/tasks*.jsonl are trimmed from real
2.1.312 output: a session compacted once, two --fork-session task
forks and a /branch copy with forkedFrom.
- docs/subsystems/gateway-sessions.md: copies and branches.
Run:
- go test ./internal/sessions -run 'TestClaude|TestQoder|TestMergeExternal'
on mote, at e15b2277c before the rebase: ok. Red on the old code (cc_copies/sessions/transcript/stats
restored from HEAD~): 5 tests failed (the original hidden, only forks
as rows; a branch's prompts starting at the summary).
- Broken by hand, each red: dropping the Root rule (3 compacted-fork
tests), ignoring forkedFrom (TestClaudeBranchNamesItsSession),
turning branchTranscript off (3 tests), counting a branch whole in
stats (90 tokens, not 80).
- GOOS=linux (-tags nogui), windows and darwin go vet, at e15b2277c: ok.
- Full go test ./... -timeout 45m at this head (71124a2d7 on c1660481c),
on the Linux box (mote was at load 300 with six suites): every
package ok, sessions 144s, gateway 987s, except: ., internal/cli and
internal/gui didn't build (no gtk4 there), ok again with -tags nogui;
internal/agent's TestInstalledVersion, TestGrokInstalled,
TestOmpDetectedWithPiDir and TestCursorFolderFromTheEditorIsNotTheCLI,
the first three red the same at origin/main c1660481c there, all four
in #4033 (#3548, #3141). Nothing here touches internal/agent.
- GUI on the Windows box, both engines, every language:
sessions-subagents + i18n-keys 40/44, the 4 reds 5s nav-click and
goto timeouts in WebKit; WebKit alone again 20/20. Every
session*.test.cjs file (32): 381/399. Its six red files run again at
origin/main c1660481c and here, one at a time: calendar-fill zh red
on both (#1314), sessions-today WebKit zh red here only, the
reads.n race of #1315; the rest green on both.
Not tried: get()'s path for a session beyond the listing's 200 has no
test of its own; the TUI and CLI lists show a branch as a row of its
own, not nested; an uncompacted fork that went on has no real
forkedFrom fixture (TestClaudeBranchNamesItsSession injects one).
32 lines
15 KiB
JSON
32 lines
15 KiB
JSON
{"type":"mode","mode":"normal","sessionId":"1d564437-1718-4409-8951-97cbaeeb0b84"}
|
|
{"type":"atis-latch","atis":"","sessionId":"1d564437-1718-4409-8951-97cbaeeb0b84"}
|
|
{"type":"queue-operation","operation":"enqueue","timestamp":"2026-10-29T05:02:39.172Z","sessionId":"1d564437-1718-4409-8951-97cbaeeb0b84","content":"事项与取值分离实现审查 3"}
|
|
{"type":"queue-operation","operation":"dequeue","timestamp":"2026-10-29T05:02:39.173Z","sessionId":"1d564437-1718-4409-8951-97cbaeeb0b84"}
|
|
{"parentUuid":null,"logicalParentUuid":"09729caa-710c-40b5-bc61-8e1166257794","isSidechain":false,"type":"system","subtype":"compact_boundary","content":"Conversation compacted","isMeta":false,"timestamp":"2026-10-29T05:02:38.391Z","uuid":"98890d95-b72e-4e18-aed0-a84e0edde7ba","level":"info","compactMetadata":{"trigger":"manual","preTokens":15,"durationMs":19,"preservedSegment":{"headUuid":"09729caa-710c-40b5-bc61-8e1166257794","anchorUuid":"59f61e67-50ec-49f5-b95b-5acc8560ea48","tailUuid":"09729caa-710c-40b5-bc61-8e1166257794"},"preservedMessages":{"anchorUuid":"59f61e67-50ec-49f5-b95b-5acc8560ea48","uuids":["09729caa-710c-40b5-bc61-8e1166257794"],"allUuids":["09729caa-710c-40b5-bc61-8e1166257794"]},"postTokens":7486,"cumulativeDroppedTokens":0},"userType":"external","entrypoint":"sdk-cli","cwd":"/w/proj","sessionId":"1d564437-1718-4409-8951-97cbaeeb0b84","version":"2.1.312","gitBranch":"HEAD"}
|
|
{"parentUuid":"98890d95-b72e-4e18-aed0-a84e0edde7ba","isSidechain":false,"promptId":"1f5e283b-228d-4aeb-81a0-de1958118b56","type":"user","message":{"role":"user","content":"This session is being continued from a previous conversation that ran out of context. The summary below covers the earlier portion of the conversation.\n\n<system-reminder>\n<tools-used-before-summary></tools-used-before-summary>\n</system-reminder>\nSummary:\nSummary of the conversation 3\n\nIf you need specific details from before compaction (like exact code snippets, error messages, or content you generated), read the full transcript at: /w/home/.claude/projects/-w-proj/c2c5eb5f-0995-434f-bd20-baff66d5bdff.jsonl\nContinue the conversation from where it left off without asking the user any further questions. Resume directly — do not acknowledge the summary, do not recap what was happening, do not preface with \"I'll continue\" or similar. Pick up the last task as if the break never happened.\n\nThe messages after this summary are the most recent messages from before compaction, kept verbatim. The summary was written without seeing them, so something it says has not happened yet may already have happened in them."},"isVisibleInTranscriptOnly":true,"isCompactSummary":true,"uuid":"59f61e67-50ec-49f5-b95b-5acc8560ea48","timestamp":"2026-10-29T05:02:38.390Z","turnPosition":{"promptIndex":0,"turnIndex":2},"userType":"external","entrypoint":"sdk-cli","cwd":"/w/proj","sessionId":"1d564437-1718-4409-8951-97cbaeeb0b84","version":"2.1.312","gitBranch":"HEAD"}
|
|
{"parentUuid":"59f61e67-50ec-49f5-b95b-5acc8560ea48","isSidechain":false,"message":{"id":"msg_2","type":"message","role":"assistant","model":"claude-opus-5-5","content":[{"type":"text","text":"<summary>Summary of the conversation 2</summary>"}],"stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":0,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":0,"output_tokens_details":{"thinking_tokens":0},"server_tool_use":{"web_search_requests":0,"web_fetch_requests":0},"service_tier":"standard","cache_creation":{"ephemeral_1h_input_tokens":0,"ephemeral_5m_input_tokens":0},"inference_geo":"","iterations":[],"speed":"standard","fallback_credit":null},"stop_details":null},"apiBlockIndex":0,"requestRef":"91b0b5b8-ad1f-4161-9ffa-bd5e5b39a21c","requestedModel":"claude-opus-5-5","type":"assistant","uuid":"09729caa-710c-40b5-bc61-8e1166257794","timestamp":"2026-10-29T05:02:38.204Z","effort":"medium","perTurnEffort":"medium","userType":"external","entrypoint":"sdk-cli","cwd":"/w/proj","sessionId":"1d564437-1718-4409-8951-97cbaeeb0b84","version":"2.1.312","gitBranch":"HEAD"}
|
|
{"parentUuid":"09729caa-710c-40b5-bc61-8e1166257794","isSidechain":false,"promptId":"1f5e283b-228d-4aeb-81a0-de1958118b56","type":"user","message":{"role":"user","content":"<local-command-caveat>The command below was run directly in Claude Code, not sent to you as a request, and its output goes straight to the user. It's recorded here as context for later messages.</local-command-caveat>"},"isMeta":true,"uuid":"aa27b68d-ab1f-4c0a-90ed-2688f0c59263","timestamp":"2026-10-29T05:02:38.371Z","userType":"external","entrypoint":"sdk-cli","cwd":"/w/proj","sessionId":"1d564437-1718-4409-8951-97cbaeeb0b84","version":"2.1.312","gitBranch":"HEAD"}
|
|
{"parentUuid":"aa27b68d-ab1f-4c0a-90ed-2688f0c59263","isSidechain":false,"promptId":"1f5e283b-228d-4aeb-81a0-de1958118b56","type":"user","message":{"role":"user","content":"<command-name>/compact</command-name>\n <command-message>compact</command-message>\n <command-args></command-args>"},"uuid":"4c08f8c8-9d2f-457f-800b-85db4230b2df","timestamp":"2026-10-29T05:02:38.371Z","userType":"external","entrypoint":"sdk-cli","cwd":"/w/proj","sessionId":"1d564437-1718-4409-8951-97cbaeeb0b84","version":"2.1.312","gitBranch":"HEAD"}
|
|
{"parentUuid":"4c08f8c8-9d2f-457f-800b-85db4230b2df","isSidechain":false,"promptId":"1f5e283b-228d-4aeb-81a0-de1958118b56","type":"user","message":{"role":"user","content":"<local-command-stdout>Compacted (ctrl+o to see full summary)</local-command-stdout>"},"uuid":"4f97b738-a419-4bcb-9c06-c21eb2422dd5","timestamp":"2026-10-29T05:02:38.494Z","userType":"external","entrypoint":"sdk-cli","cwd":"/w/proj","sessionId":"1d564437-1718-4409-8951-97cbaeeb0b84","version":"2.1.312","gitBranch":"HEAD"}
|
|
{"parentUuid":"4f97b738-a419-4bcb-9c06-c21eb2422dd5","isSidechain":false,"attachment":{"type":"deferred_tools_delta"},"type":"attachment","uuid":"0cbbb0bf-582a-44db-86c3-0728e76cd309","timestamp":"2026-10-29T05:02:38.392Z","renderedRole":"system","userType":"external","entrypoint":"sdk-cli","cwd":"/w/proj","sessionId":"1d564437-1718-4409-8951-97cbaeeb0b84","version":"2.1.312","gitBranch":"HEAD"}
|
|
{"parentUuid":"0cbbb0bf-582a-44db-86c3-0728e76cd309","isSidechain":false,"attachment":{"type":"agent_listing_delta"},"type":"attachment","uuid":"465f9506-590c-4a5b-a3d6-abf161745457","timestamp":"2026-10-29T05:02:38.392Z","renderedRole":"system","userType":"external","entrypoint":"sdk-cli","cwd":"/w/proj","sessionId":"1d564437-1718-4409-8951-97cbaeeb0b84","version":"2.1.312","gitBranch":"HEAD"}
|
|
{"parentUuid":"465f9506-590c-4a5b-a3d6-abf161745457","isSidechain":false,"attachment":{"type":"skill_listing"},"type":"attachment","uuid":"a445cd37-aaba-40fb-8212-2b24e1cdec34","timestamp":"2026-10-29T05:02:38.392Z","renderedRole":"system","userType":"external","entrypoint":"sdk-cli","cwd":"/w/proj","sessionId":"1d564437-1718-4409-8951-97cbaeeb0b84","version":"2.1.312","gitBranch":"HEAD"}
|
|
{"parentUuid":"a445cd37-aaba-40fb-8212-2b24e1cdec34","isSidechain":false,"attachment":{"type":"environment"},"type":"attachment","uuid":"4e93f22b-c045-4efb-ae9e-d193e345e059","timestamp":"2026-10-29T05:02:38.392Z","renderedRole":"system","userType":"external","entrypoint":"sdk-cli","cwd":"/w/proj","sessionId":"1d564437-1718-4409-8951-97cbaeeb0b84","version":"2.1.312","gitBranch":"HEAD"}
|
|
{"parentUuid":"4e93f22b-c045-4efb-ae9e-d193e345e059","isSidechain":false,"attachment":{"type":"model"},"type":"attachment","uuid":"2f4e20a8-7af4-4fe5-a090-41a1bc52fc18","timestamp":"2026-10-29T05:02:38.392Z","renderedRole":"system","userType":"external","entrypoint":"sdk-cli","cwd":"/w/proj","sessionId":"1d564437-1718-4409-8951-97cbaeeb0b84","version":"2.1.312","gitBranch":"HEAD"}
|
|
{"parentUuid":"2f4e20a8-7af4-4fe5-a090-41a1bc52fc18","isSidechain":false,"promptId":"1f5e283b-228d-4aeb-81a0-de1958118b56","type":"user","message":{"role":"user","content":"after compact prompt"},"uuid":"4c74fb90-ce07-4f0c-b1d8-b480a0571a4b","timestamp":"2026-10-29T05:02:38.597Z","permissionMode":"default","promptSource":"sdk","turnOrigin":"sdk","turnPosition":{"promptIndex":0,"turnIndex":3},"userType":"external","entrypoint":"sdk-cli","cwd":"/w/proj","sessionId":"1d564437-1718-4409-8951-97cbaeeb0b84","version":"2.1.312","gitBranch":"HEAD"}
|
|
{"parentUuid":"4c74fb90-ce07-4f0c-b1d8-b480a0571a4b","isSidechain":false,"attachment":{"type":"total_tokens_reminder"},"type":"attachment","uuid":"12033af9-6ba3-498a-a986-a486857d06fa","timestamp":"2026-10-29T05:02:38.597Z","renderedRole":"system","userType":"external","entrypoint":"sdk-cli","cwd":"/w/proj","sessionId":"1d564437-1718-4409-8951-97cbaeeb0b84","version":"2.1.312","gitBranch":"HEAD"}
|
|
{"parentUuid":"12033af9-6ba3-498a-a986-a486857d06fa","isSidechain":false,"attachment":{"type":"instructions"},"type":"attachment","uuid":"adadf24d-293e-4462-a2af-54690c94cdbc","timestamp":"2026-10-29T05:02:38.606Z","renderedRole":"user","userType":"external","entrypoint":"sdk-cli","cwd":"/w/proj","sessionId":"1d564437-1718-4409-8951-97cbaeeb0b84","version":"2.1.312","gitBranch":"HEAD"}
|
|
{"parentUuid":"adadf24d-293e-4462-a2af-54690c94cdbc","isSidechain":false,"attachment":{"type":"session_context"},"type":"attachment","uuid":"2165391e-461b-4b69-8731-3f227de9a6ea","timestamp":"2026-10-29T05:02:38.606Z","userType":"external","entrypoint":"sdk-cli","cwd":"/w/proj","sessionId":"1d564437-1718-4409-8951-97cbaeeb0b84","version":"2.1.312","gitBranch":"HEAD"}
|
|
{"parentUuid":"2165391e-461b-4b69-8731-3f227de9a6ea","isSidechain":false,"attachment":{"type":"date"},"type":"attachment","uuid":"b61ecdca-376d-4469-a85e-78e56899f971","timestamp":"2026-10-29T05:02:38.606Z","renderedRole":"system","userType":"external","entrypoint":"sdk-cli","cwd":"/w/proj","sessionId":"1d564437-1718-4409-8951-97cbaeeb0b84","version":"2.1.312","gitBranch":"HEAD"}
|
|
{"parentUuid":"b61ecdca-376d-4469-a85e-78e56899f971","isSidechain":false,"attachment":{"type":"remote_session_change"},"type":"attachment","uuid":"554adcfe-7d4c-4121-9649-d0705fd8bfca","timestamp":"2026-10-29T05:02:38.607Z","renderedRole":"user","renderedBesideToolResult":true,"userType":"external","entrypoint":"sdk-cli","cwd":"/w/proj","sessionId":"1d564437-1718-4409-8951-97cbaeeb0b84","version":"2.1.312","gitBranch":"HEAD"}
|
|
{"parentUuid":"554adcfe-7d4c-4121-9649-d0705fd8bfca","isSidechain":false,"attachment":{"type":"prompt_snapshot"},"type":"attachment","uuid":"56ad263b-a1e5-44c9-af74-1cddde0b4199","timestamp":"2026-10-29T05:02:38.607Z","userType":"external","entrypoint":"sdk-cli","cwd":"/w/proj","sessionId":"1d564437-1718-4409-8951-97cbaeeb0b84","version":"2.1.312","gitBranch":"HEAD"}
|
|
{"parentUuid":"56ad263b-a1e5-44c9-af74-1cddde0b4199","isSidechain":false,"message":{"id":"msg_4","type":"message","role":"assistant","model":"claude-opus-5-5","content":[{"type":"text","text":"<summary>Summary of the conversation 4</summary>"}],"stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":10,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":5,"output_tokens_details":{"thinking_tokens":0},"server_tool_use":{"web_search_requests":0,"web_fetch_requests":0},"service_tier":"standard","cache_creation":{"ephemeral_1h_input_tokens":0,"ephemeral_5m_input_tokens":0},"inference_geo":"","iterations":[],"speed":"standard","fallback_credit":null},"stop_details":null},"apiBlockIndex":0,"requestRef":"4c9f4417-f2ba-4808-b66a-c96c836705f8","requestedModel":"claude-opus-5-5","type":"assistant","uuid":"d0b4b90c-5f77-4fc0-881d-d7bcbb262b7d","timestamp":"2026-10-29T05:02:38.621Z","effort":"medium","perTurnEffort":"medium","userType":"external","entrypoint":"sdk-cli","cwd":"/w/proj","sessionId":"1d564437-1718-4409-8951-97cbaeeb0b84","version":"2.1.312","gitBranch":"HEAD"}
|
|
{"parentUuid":"d0b4b90c-5f77-4fc0-881d-d7bcbb262b7d","isSidechain":false,"attachment":{"type":"prompt_snapshot"},"type":"attachment","uuid":"f7899374-9973-4c6e-a462-0cd8b528d902","timestamp":"2026-10-29T05:02:38.623Z","userType":"external","entrypoint":"sdk-cli","cwd":"/w/proj","sessionId":"1d564437-1718-4409-8951-97cbaeeb0b84","version":"2.1.312","gitBranch":"HEAD"}
|
|
{"parentUuid":"f7899374-9973-4c6e-a462-0cd8b528d902","isSidechain":false,"promptId":"1f5e283b-228d-4aeb-81a0-de1958118b56","type":"user","message":{"role":"user","content":"事项与取值分离实现审查 3"},"uuid":"b2a24552-0c79-471b-a697-849943a702b8","timestamp":"2026-10-29T05:02:39.189Z","permissionMode":"default","promptSource":"sdk","turnOrigin":"sdk","turnPosition":{"promptIndex":0,"turnIndex":4},"userType":"external","entrypoint":"sdk-cli","cwd":"/w/proj","sessionId":"1d564437-1718-4409-8951-97cbaeeb0b84","version":"2.1.312","gitBranch":"HEAD"}
|
|
{"parentUuid":"b2a24552-0c79-471b-a697-849943a702b8","isSidechain":false,"attachment":{"type":"total_tokens_reminder"},"type":"attachment","uuid":"c5370293-d0bf-47d0-8943-1a8d44a14171","timestamp":"2026-10-29T05:02:39.189Z","renderedRole":"system","userType":"external","entrypoint":"sdk-cli","cwd":"/w/proj","sessionId":"1d564437-1718-4409-8951-97cbaeeb0b84","version":"2.1.312","gitBranch":"HEAD"}
|
|
{"parentUuid":"c5370293-d0bf-47d0-8943-1a8d44a14171","isSidechain":false,"message":{"id":"msg_7","type":"message","role":"assistant","model":"claude-opus-5-5","content":[{"type":"text","text":"<summary>Summary of the conversation 7</summary>"}],"stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":10,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":5,"output_tokens_details":{"thinking_tokens":0},"server_tool_use":{"web_search_requests":0,"web_fetch_requests":0},"service_tier":"standard","cache_creation":{"ephemeral_1h_input_tokens":0,"ephemeral_5m_input_tokens":0},"inference_geo":"","iterations":[],"speed":"standard","fallback_credit":null},"stop_details":null},"apiBlockIndex":0,"requestRef":"43171a5f-968f-47bd-add9-3335a15bff2a","requestedModel":"claude-opus-5-5","type":"assistant","uuid":"fbdc2aec-1bbe-46a9-9164-66021f4b3d66","timestamp":"2026-10-29T05:02:39.212Z","effort":"medium","perTurnEffort":"medium","userType":"external","entrypoint":"sdk-cli","cwd":"/w/proj","sessionId":"1d564437-1718-4409-8951-97cbaeeb0b84","version":"2.1.312","gitBranch":"HEAD"}
|
|
{"type":"last-prompt","lastPrompt":"after compact prompt","leafUuid":"fbdc2aec-1bbe-46a9-9164-66021f4b3d66","sessionId":"1d564437-1718-4409-8951-97cbaeeb0b84"}
|
|
{"type":"mode","mode":"normal","sessionId":"1d564437-1718-4409-8951-97cbaeeb0b84"}
|
|
{"type":"atis-latch","atis":"","sessionId":"1d564437-1718-4409-8951-97cbaeeb0b84"}
|
|
{"type":"cost-state","sessionId":"1d564437-1718-4409-8951-97cbaeeb0b84","totalCostUSD":0.0007000000000000001,"totalAPIDuration":37,"totalAPIDurationWithoutRetries":28,"totalToolDuration":0,"totalLinesAdded":0,"totalLinesRemoved":0,"totalDuration":510,"startTime":1793250151771,"modelUsage":{"claude-opus-5-5":{"inputTokens":50,"outputTokens":25,"thinkingTokens":0,"cacheReadInputTokens":0,"cacheCreationInputTokens":0,"cacheCreationEphemeral5mInputTokens":0,"cacheCreationEphemeral1hInputTokens":0,"webSearchRequests":0,"costUSD":0.0007000000000000001}},"hasUnknownModelCost":false}
|