fast timeline - #210
Open
jtoman wants to merge 1 commit into
Open
Conversation
shellygr
approved these changes
Sep 4, 2026
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.
Adds a heuristic version of timeline loading which is, in practice, at least an order of magnitude faster.
The intuition: we don't want (or need) to walk the entire checkpoint chain. From some checkpoint C, the parent checkpoint Cp has strictly less information (fewer messages, given the append only nature of our message histories) UNLESS C is the result of summarization. Thus, to get the full history of messages, it is sufficient to take the most recent checkpoint C, and all "pre-summarization checkpoints", i.e., those checkpoints in the chain reachable from C which occurred right before a summarization.
Then we simply need an efficient way to detect all summarizations. We don't have a general summarization tracking like in the codegen workflow, but we can approximate it: detect the presence of
RemoveMessagein the message channel writes, OR detect a case where the entire messages blob decreases in size from one checkpoint to the next. Either serve as signals that summarization happen. From these, we can reconstruct the entire history of a run in O(1) sql queries (4 to be exact) vs O(n) under the naive approach (where n is the total number of checkpoints in a run !!!!).Validated locally against my dev DB, the heuristic had perfect precision and recall.