Repository navigation
feat(remote-peer): branch a remote conversation, and stop a compaction from looking like a run - #959
Merged
Merged
Conversation
`streaming` was derived with `!isTerminal(type)`, which counts *every* type this client does not recognize as "a run just started". A compaction event therefore left the conversation looking busy and the composer offering Stop for a run that did not exist, and the state only cleared when an unrelated run's terminal frame happened to arrive. Enumerate the activity and settling types instead. A type from another family now leaves the run state exactly as it was, in both directions: a compaction does not start a run, and a compaction mid-run does not end one.
The phone could fork a conversation on the desktop it is paired with; the
desktop acting as a client could not fork one on a paired host at all. The
host's route and the desktop's own Fork button were already there, so this is
the missing client half.
What makes it more than a command wrapper is which id it sends. The host
resolves the fork point against its *store*, and the two ids a client sees are
not the same id: a history read carries the persisted entry id, while a live
push carries a run-scoped event id (`s:r:1:idx`) that names a frame on the
wire and nothing in the store. The timeline now tracks which ids came from
history, the fork point is the preceding *user* entry (a reply is not itself a
stored turn), and a turn that has not been persisted yet is reported instead
of sent — the host's own refusal ("Fork source thread could not be loaded")
describes a bug rather than the situation the user is in.
The child is opened from the ids in the host's answer, never from a guess, and
the host is re-read first because the child is a new row in its catalogue.
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.
What this does
Two gaps in the desktop's client role, both about a conversation on a host.
Branch a remote conversation at a settled turn. The phone could fork a conversation on the desktop it pairs with; a desktop acting as a client could not fork one on a paired host at all. The host's route and the desktop's own Fork button already existed — this is the missing client half.
Fix: a compaction is not a run.
streamingwas derived with!isTerminal(type), which counts every type this client does not recognize as "a run just started". A compaction event therefore left the conversation looking busy, and the composer offering Stop, for a run that did not exist — and the state only cleared when an unrelated run's terminal frame happened to arrive.The fork's substance is which id it sends
The host resolves the fork point against its store, and the two ids a client sees are not the same id:
s:r:1:idx) — a frame on the wire that names nothing in the store.So the timeline now tracks which ids came from history, the fork point is the preceding user entry (a reply is not itself a stored turn, and this mirrors the desktop's own Fork button), and a turn that has not been persisted yet is reported instead of sent. The host's own refusal for the wrong id is "Fork source thread could not be loaded", which describes a bug rather than the situation the user is in — the message here says the turn is not saved yet and to reopen the conversation.
The child is opened from the ids in the host's answer, never from a guess, and the host is re-read first because the child is a new row in its catalogue. A failed fork does not navigate.
Tests
29 new tests; 3412 desktop tests pass.
tsc --noEmit, fulleslint(0 errors),stylelint, and the shared shell-projection test all pass — the same scope CI runs. 0 uncovered lines added by this branch (repo's documented v8 method, intersected with the branch's own diff).Where the assertions sit:
s_1:r_1:1:7) is asserted to land outsidepersistedEntryIds, and an older page's ids are added without dropping the newest page's.fork_session(asserted specifically — opening a conversation also talks to the host via its history read, so a bare "nothing was sent" would assert the wrong thing).Two tests that could not fail
Both were found by the failures they produced, and both are worth naming because they are the kind of test that quietly proves nothing:
sessionId. The timeline ignores another session's events, so the events never reached the reducer — and the "another family of event is not a run" test was passing vacuously. Fixed, and then verified by mutation: flipping the classification back to!RUN_SETTLED.has(type)makes that test fail.expect(invoke).not.toHaveBeenCalled()on the unstored-turn path was wrong for the same family of reason: opening the conversation legitimately calls the host for history. The assertion now filters for thefork_sessioncommand.The hover handlers were also uncovered until a test dispatched
mouseover/mouseout— asserting both that the control fades in and that it stays mounted, since a control removed on mouse-out is unreachable by keyboard.Not in this PR
Compact context and remote file browsing/download are still missing. I did not fold them in: compaction completion has to be recognised from the host's own events (the command only acknowledges), and file transfer is a separate surface with its own list/download flow. Both are real work rather than a few lines, and half-doing either would put a control on screen that appears to work.
Related
Follows #955 (client role + merged lists), #956 (client runtime + multi-host e2e), #957 (a prompt names a conversation), #958 (manage/start a remote conversation). Mobile already implements remote fork; the semantics here match it, including the "not persisted yet" case.