Repository navigation
feat(remote-peer): compact a remote conversation's context - #960
Merged
Merged
Conversation
The host has always been able to compact a conversation's context, and the
desktop exposes it for its own chats; a desktop acting as a client could not
ask a paired host to do it. This is the missing client half.
The answer to the command is an *acknowledgement*, not a result: the host
accepts the request and then commits, fails, or finds nothing to do, and
reports which only through its own events. So a resolving call means "the host
took it", and the state shown is derived from those events rather than from
the fact that we asked:
- `compacting` starts on `compaction_started` and ends on any terminal
outcome, including `compaction_unchanged` ("nothing worth compacting" is
still the end of the operation) -- and on a settled *run*, because nothing
can still be compacting once a run has finished, and a terminal frame lost
over at-most-once NATS must not leave the composer waiting forever.
- An ack without an `operationId` is rejected: the host uses that id to
correlate the events that follow, so resolving on it would report success
for a request that was never taken.
The action sits in the conversation header and is gated on the host's own
state: a host answering a prompt does not also compact, and a host compacting
refuses a prompt. A draft has no conversation on the host, so it is not
offered one to compact.
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
The host has always been able to compact a conversation's context, and the desktop exposes it for its own chats. A desktop acting as a client could not ask a paired host to do it. This is the missing client half.
The answer is an acknowledgement, not a result
compact_contextresolves when the host takes the request. Whether it then commits, fails, or finds nothing to do arrives only as the host's own events — so the state the UI shows is derived from those events, never from the fact that we asked:compactingstarts oncompaction_startedand ends on any terminal outcome, includingcompaction_unchanged("nothing worth compacting" is still the end of the operation).operationIdis rejected. The host uses that id to correlate the events that follow, so resolving on it would report success for a request that was never taken.The action sits in the conversation header and is gated on the host's own state: a host answering a prompt does not also compact, and a host compacting refuses a prompt. A draft has no conversation on the host, so it is not offered one to compact.
Tests
15 new tests; 3427 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.Where the assertions sit:
compaction_failed,compaction_unchanged, andcompaction_endare each asserted, not just the happy path, because a lifecycle that only recognises success is how a composer ends up permanently waiting.compactingwithout settingstreaming, so the composer does not offer Stop for something there is no run to stop. (This is the complement of the fix in feat(remote-peer): branch a remote conversation, and stop a compaction from looking like a run #959, which made sure a run's events do not clear a compaction's counterpart.)Not in this PR
Remote file browsing/download. It is a separate surface with its own list/download/save flow rather than another conversation action, and it is the last piece of the client role I know to be missing.
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), #959 (branch a remote conversation; a compaction is not a run).