Preserve semantic work groups and paginate turn details - #2419
Conversation
|
Live worktree proof: open the oversized completed-turn fixture. The fixture is one 508-event / 12.01 MiB completed turn. Browser QA against the optimized worktree build shows one canonical
|
|
Updated proof after the exact-then-fallback simplification: open the oversized completed-turn fixture. The fixture is one 508-event / 12.01 MiB completed turn. Walking its four top-level timeline byte windows returns four disjoint source ranges with the same canonical turn-row ID, which the client merges into one For the complete 1…508 range, the unchanged exact-range resource still returns
|
…urn-pagination-thr_e625skpecw # Conflicts: # packages/domain/src/plugin-sdk-version.ts # packages/plugin-sdk/package.json
Human comments
What was wrong
The timeline was conflating semantic grouping with transport grouping. A completed provider turn can contain visible assistant replies between long-running work, and its byte/event windows can overlap those replies because an item may start before a reply and complete after it. The server flattened the semantic work groups, gave completed transport fragments a shared identity, and the client merged that identity at its earliest position. Expansion then treated the row's overlapping numeric range as semantic ownership, so visible assistant replies and straddling commands could appear both at the root and inside “Worked for…”.
What changed
{ turnId, sourceSeqStart, sourceSeqEnd }; bind those values into its cache key and opaque cursor on desktop, mobile, the public contract, and@bb/sdk.413path falls through to forward, byte-bounded pagination. Expansion fetches one page initially and exposesLoad more workwhen another page exists—there is no automatic drain or parallel byte-window fan-out.HOST_DAEMON_PROTOCOL_VERSIONis unchanged.The complete branch is 836 net non-test lines plus 682 net regression-test lines. The product code includes the desktop/mobile/CLI/server/SDK surfaces for the new resource; the tests cover byte paging, semantic grouping, page-seam merging, context reconstruction, and straddling-item ownership.
How you verified
The new regressions fail on the old behavior and cover both correctness failures: work split by visible assistant replies, and a command that starts before a visible reply, completes after it, and has its following assistant message beyond the row's numeric range.
main,timeline-in-turn-window.test.tsandpublic-thread-data.test.tspassed 31/31 and 79/79 (110 total).@bb/thread-view,@bb/client-core,@bb/server-contract,@bb/db, and@bb/sdksuites passed (23, 20, 7, 28, and 6 test files; 410 DB tests alone).@bb/app,@bb/mobile,@bb/server,@bb/client-core,@bb/db,@bb/sdk,@bb/server-contract,@bb/thread-view, and@get-bb/plugin-sdk. The npm version guard passed for the new0.4.21SDK version.thr_s97hwwr8ei/daccf028b3-t2now renders 6 work rows interleaved with 16 visible assistant replies. Expanding all 6 rows produced zero visible-assistant source intersections, zero duplicate assistant IDs, and zero duplicate work IDs.Fixes: no filed issue; reproduced from a production thread timeline. Supersedes #2361.