Skip to content

feat(remote-peer): manage and start a remote conversation from the desktop - #958

Merged
huichen merged 2 commits into
mainfrom
feat/remote-conv-lifecycle
Oct 9, 2026
Merged

huichen merged 2 commits into
mainfrom
feat/remote-conv-lifecycle

Conversation

@huichen

@huichen huichen commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

What this does

Reading another machine's conversations worked; doing anything with them did not. This adds the lifecycle controls a remote conversation needs, all issued to the host that owns it.

Row actions — rename / pin / delete, behind an overflow control on the remote row. Not a reuse of the local row's menu: every action there calls the local store or the local agent, and the local store has never heard of a remote session. Sharing the component would mean sharing the dispatch, and a rename would land on a local thread with a coincidentally matching id.

Stop, replacing Send while a run is in flight on the host (a host answers one prompt at a time and refuses a second).

New conversation on a chosen desktop, from the desktop-management screen where the machines already live. A draft is addressed with an empty session id — the host's own signal to create the conversation — and the shell adopts the ids in the host's ack. Without that adoption the next prompt would create a second conversation.

Rename gets its own dialog rather than the local one, which carries the local store's generating/error state and a "generate title" action backed by the local agent.

The id distinction, which is the substance here

A remote conversation has two ids on its host and they are not interchangeable: prompt, abort and history reads are session-scoped, while pin and delete go through the host's thread store. The merged list kept only the session id, which left pin and delete unaddressable — and treating the two as the same would have pinned or deleted the wrong record. The merge now carries threadId (a local row's thread id is its own id, so nothing is translated there), the client helpers are named for the id each takes, and a host that reports no thread id is refused rather than sent the session id in its place.

Tests

78 new tests; the desktop suite is 3388 passing. tsc --noEmit, eslint (0 errors), stylelint, and the shared shell-projection test all pass — the same scope CI runs.

What is asserted is where a mistake would be silent:

  • Which id each command carries, and on which lane — a pin sent with a session id is accepted by the transport, answered by another record, and reported as success.
  • A refusal stays readable: the menu keeps the host's message and stays open instead of dismissing the place the error is shown.
  • A draft adopts the ack's ids, and an ack naming no conversation is an error rather than a prompt that appeared to work.
  • The composer targets the machine that owns the conversation — a wrong desktopId is delivered to another host, the failure this whole screen exists to avoid.
  • Ordering stays one list: local and remote rows interleave by time regardless of source, tied timestamps break on a stable key, and a device filter hides the other machines.
  • The new-conversation entry is withheld when the host's agent is unreachable (the bridge can be up while every prompt fails).

One thing I removed rather than tested

Both "second call while in flight" guards in the menu and the composer were unreachable: the controls that invoke them are disabled while a command is outstanding, and React flushes state between discrete clicks, so a second invocation cannot be produced from the UI. Rather than keep defensive code no test can reach, I deleted the guards and left disabled as the single mechanism — which is what the tests assert. (The composer's equivalent busy guard stays, because it is reachable: Enter can call send() while the Send button is disabled.)

Coverage

Measured with the repo's documented method (v8 provider, full src/** include), then intersected with this branch's own diff:

0 uncovered lines added by this branch

Every file this PR adds or modifies is at zero uncovered lines.

Related

Follows #955 (client role + merged lists), #956 (client runtime + multi-host e2e), #957 (a prompt names a conversation rather than creating one — the ack contract this builds on).

…ute expects

A remote conversation has two ids on its host, and they are not
interchangeable: prompt, abort and history reads are session-scoped, while
pin and delete go through the host's thread store. The merged list kept only
the session id, which left pin and delete unaddressable -- and guessing that
the two ids are the same would have pinned or deleted the wrong record.

Carry the host's thread id through the merge (a local row's thread id is its
own id, so nothing is translated there), and add the client helpers for the
lifecycle commands, each named for the id it takes. A host that reports no
thread id (one predating the catalogue field) is refused rather than sent the
session id in its place.

An empty session id is the host's own signal for "a conversation that does
not exist yet": it creates the thread and answers with the ids it chose, so
the ack is the only way to learn them.
…sktop

Reading another machine's conversations was possible; doing anything with
them was not. Add the three controls a conversation cannot be used without,
all issued to the host that owns it:

- **Row actions** (rename / pin / delete) behind an overflow control on the
  remote row. Not a reuse of the local row's menu: every action there calls
  the local store or the local agent, and the local store has never heard of
  a remote session -- sharing it would mean sharing the dispatch, and a rename
  would land on a local thread with a coincidentally matching id. An item
  stays open while its command runs, because a refusal that disappears with
  the menu is no message at all. Pin and delete are disabled when the host
  reported no thread id.
- **Stop**, replacing Send while a run is in flight on the host (a host
  answers one prompt at a time and refuses a second).
- **New conversation** on a chosen desktop, from the desktop-management
  screen where the machines already live. A draft is addressed with an empty
  session id and the shell adopts the ids in the host's ack -- without that,
  the next prompt would create a second conversation.

Rename gets its own dialog rather than the local one, which carries the local
store's generating/error state and a "generate title" action backed by the
local agent.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant