Repository navigation
Control: an anchor link opens its thread at the anchored turn, which the host resolves - #1006
Merged
Merged
Conversation
…the host resolves A tcode-thread://<thread>#<position> link always opened at the tail. The client mapped the position to a held record by subtracting the window's start, but windows merge streamed deltas and skip blank rows, so the index ran past the records; an anchor above the opening window was never paged in at all. The host, which knows each record's row, now answers ThreadAnchorTurn from the same index that numbers control anchors, and the client opens the turn through the path content-search hits already use, which pages earlier history in.
Tryanks
force-pushed
the
fix/thread-anchor-links
branch
from
October 28, 2026 04:55
199d59f to
45ac136
Compare
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.
Summary
Clicking a cited
tcode-thread://<thread>#<position>link opened the thread at its tail. The client tried to find the turn by itself, asheld.records[position - held.from]. That index is wrong for two reasons:load_pending_chat_history.Only the host knows each record's row, so the host now resolves the anchor. The answer comes from the same
IndexedLogthat gives control anchors their positions.Query::ThreadAnchorTurn→QueryResponse::ThreadAnchorTurn(Option<usize>)(scoped per session likeReadItemOutput). It is noted as Unreleased abovePROTOCOL_VERSION, and the version is not bumped (Principle 9).pending_chat_anchorand its record-index fold are removed. A single cancellableanchor_turn_taskreplaces them, so a newer anchor or a palette jump supersedes an older one.Evidence
New test
chat::tests::an_anchor_link_opens_its_thread_at_the_anchored_turn. It uses a real in-process host and a 12-turn thread whose replies each stream as 40 deltas. It opens anchors to turn 1's user message (above the opening window) and to turn 9's (inside the window, with the thread already open), and asserts that the chat scrolls to and highlights each anchored turn.FAIL — panicked: waiting for the anchored turn(the chat stays at the tail)PASSChecks run locally:
cargo fmt --all --check,cargo clippy --workspace --all-targets --locked -- -D warnings, andnextestfortcode-protocol,tcode-runtime,tcode-uiandcontrol-mcp(669 passed). Not run locally: the full workspace tests, the mobile and Web checks, and a click-through in the live app.Merge Danger
Door: two-way. One new query and no persisted data.
Blast Radius: narrow. It covers opening anchor links only. A client and host from different commits of
mainwould not share the new query; an older host answers it with an error, and the link then opens at the tail as before.