Repository navigation
fix(v2): keep the loaded transcript when events rewrite the session - #551
Merged
Merged
Conversation
`[u`/`]u` called `load_older` on every press and the second call hit the re-entry guard, which surfaced `load_older is already in progress`. A caller asking for the same cursor now shares the page being fetched; a different cursor queues behind it and rereads `_v2_older_cursor` when its turn comes. A page landing after the snapshot it was cut from has been replaced is dropped instead of restarting the snapshot, and `load_complete_history` stops when a round returns the cursor it started from.
`[u`/`]u` searched rendered messages only, so a target above the loaded window reported `No previous user message`. When the search misses and the window is still pulling history, the jump is registered and runs after the pull lands. The position is held by message id, because growing the window renumbers the lines below it.
Three events refetched the whole transcript, which replaced every loaded page with the newest one. A background completion now projects the entry the server persists under the event's id. A committed revert drops the tail it deleted, since upstream deletes from the boundary onwards. A compaction still refetches, because the server's history starts at that compaction. A handler that does refetch only marks the resource stale; the dispatch starts the request after bumping the revision, so one event costs one request.
Owner
|
Thanks for the fix. Looks good to me |
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.
Pressing
[uthree times printed threeload_older is already in progresswarnings, and a revert, a compaction or a finished background job each replaced the loaded transcript with the newest page. Closes #549.A revert can be truncated locally because upstream deletes rows from the boundary onwards (
packages/core/src/session/projector.ts:787-802). A compaction cannot:packages/core/src/session/history.ts:112-124starts the server's history at the last compaction. A background completion can be projected because the server stores it underSessionMessage.ID.fromEvent(event.id)(packages/schema/src/session-message.ts:27).Verified with
make test,make format-checkandmake topology-check; each of the three commits also passes the four touched specs on its own. Not in this PR: applying an arrived snapshot and scheduling one debounced refetch behind it, the first suggestion in #549.lua/opencode/protocols/v1/observation.lua:1121still carries the same warning; this only changes V2.