Repository navigation
fix(fork): display modes load only the history they show - #140
Merged
Merged
Conversation
…reads In Messages only, Messages + Dashboard and Chat + Replies, the server fills a thread's first window and its older pages by Normal rules. A thread where a bot ran many turns opens on rows the mode hides, so the pane shows only "Load earlier turns", and the Replies list drops replies whose first message is outside the window. These tests ask for a shown-only view: the subscription flag `shownOnly`, the HTTP bounded snapshot query `shownOnly=1` and the capability `threadShownHistory`, added here as optional contract fields. They check that the window holds the latest shown messages and the first messages of its replies, that older pages hold only shown rows, forks and targeted pages, and that a shown client state never uses the saved Normal snapshot and loads one page per request. Each fails on main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A thread in Messages only, Messages + Dashboard or Chat + Replies could open on an empty pane with only "Load earlier turns": the server picked the window and older pages by Normal rules, and the bot's hidden work filled them. The web now asks for a shown-only view of such a thread when the server has the `threadShownHistory` capability. The server then walks only user-typed messages and `send_to_user` / `replace_send_to_user` calls, newest first across the thread and its fork ancestors, until the window holds 120 messages and the first message of every loaded reply, or a row, byte or run cap. Its cursor carries the view, so each "Load earlier turns" click loads one page of earlier shown messages. The window also keeps the newest row, active items, failed errors and pending request cards, so working state, failures and questions still show. On the client the shown view is a separate keyed thread state that never reads or writes the saved snapshot. The web picks one view per thread from its display mode, with a per-viewer hint for a cold start. The open sub-thread view has no "Load earlier turns", and the Replies list says when replies may be older and can load earlier messages. Normal threads, the mobile app and guest shares keep today's requests. Live events are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request makes display modes load only the history they show.
改了什么行为
Behaviour change: yes, a web or desktop user whose thread is in Messages only, Messages + Dashboard or Chat + Replies opens it on its latest shown messages (and in Chat + Replies the sub-threads of the loaded replies) instead of an empty pane with only "Load earlier turns"; "Load earlier turns" there loads earlier shown messages; the open sub-thread view has no "Load earlier turns". Normal threads, the mobile app and guest shares are unchanged.
Why
The server picked the first window and older pages by Normal rules. In a thread with many bot turns, those rows were mostly bot work that these modes hide. So the pane showed only "Load earlier turns", and the Replies list lost replies whose first message was not loaded. Now, for these modes, the server reads only shown messages.
Checks
Details
How it works
shownOnly, and the HTTP bounded snapshot an optionalshownOnly=1. The server reports the capabilitythreadShownHistory. The web asks for a shown view only when the server has it, so an old server keeps today's behaviour.apps/server/src/fork/shownHistory/. The SQL keeps messages the user typed in the web or mobile app (not scheduled, not from another thread, not idle compaction) and calls whose tool name holdssend_to_user, which also coversreplace_send_to_user. In the thread itself it drops rolled-back runs and cancelled queued turns. From a fork parent it reads rows up to the fork run. One walk goes newest first across the thread and its fork parents. The sharedfoldCorescounts messages and finds the first message of each reply.fv: "shown". A shown cursor goes to the shown pager. Every other cursor, and everyview=workpage, goes the Normal way.Upstream lines
+88 −16 in 15 upstream files. The rest is in fork-only files.
ProjectionStore.tsstate/threads.tsthreadHistoryPaging.tsChatView.tsxhttp.tsws.tsstate/threads.tsboundedThreadSnapshotHttp.tsOrchestrator.tsThreadStream.tsenvironment.tsorchestrationV2.tsServerEnvironment.tsenvironmentHttp.tsthreadSnapshotHttp.tsLeft out
Undo
Revert the two commits. There is no schema or data change. Without the capability, the web asks for Normal views again.