Repository navigation
fix(remote): a prompt names a conversation, it does not create one - #957
Merged
Merged
Conversation
huichen
enabled auto-merge (squash)
October 9, 2026 15:25
A follow-up written inside one conversation could appear as a brand new chat. The host's `prepare_remote_prompt` treated "no thread owns this session id" as "make one": it created a chat thread titled from the message, provisioned an agent session for it, and answered the client with that new session — which the phone then opened. So a client that named a conversation this desktop does not have (a row merged in from another desktop, or one deleted since the list was read) had its text silently re-homed: it landed in a conversation the user was not looking at, under a title derived from the message, and the conversation they meant to continue never received it. Nothing failed, so nothing told them. The refusal now comes before anything is persisted: - An **empty** session id is a client's new-conversation draft and keeps the lazy creation (thread born with the first message, real agent session id up front, so ack/event subjects/history agree). - A **non-empty** id no thread here owns is refused with a stable code (`session_not_on_desktop`) plus a readable sentence. The phone maps that code to "that conversation is not on the connected desktop" instead of a generic send failure; other clients keep the sentence. Mobile side: a merged row from another desktop is opened on the machine that owns it. The phone holds one active connection, so tapping such a row used to select a session id against the *active* desktop — the wrong machine, and (with the old host behavior) the trigger for the detour above. The row now switches the active desktop first (the same switch the device picker performs) and then opens the conversation there; a row of the active desktop, and every row of an unmerged list, is the plain selection it always was. Two test fixtures that prompted an invented session id were giving the host something no client can send — a conversation that was never listed. They now seed the thread `list_sessions` would have shown (`thread_for_session`), which is also what makes the new contract visible in the suite. Verified: mobile `tsc`/`eslint` clean, 3060 mobile tests pass; desktop `cargo fmt --check`, clippy (default and `--no-default-features`, `--all-targets`) clean, `remote_host::`, `remote::` and `remote_peer::` suites pass. The one failing desktop test locally, `desktop_settings_refuse_to_guess_sandbox_availability`, fails identically with this change stashed — it asserts the test machine's sandbox probe, not this code. docs/internals/desktop/CONNECTION.md records the boundary in its compatibility list.
huichen
force-pushed
the
fix/remote-session-routing
branch
from
October 9, 2026 15:27
3ff7433 to
4132359
Compare
This was referenced Oct 9, 2026
Merged
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.
fix(remote): a prompt names a conversation, it does not create one
A follow-up written inside one conversation could appear as a brand new chat.
The host's
prepare_remote_prompttreated "no thread owns this session id" as"make one": it created a chat thread titled from the message, provisioned an
agent session for it, and answered the client with that new session — which the
phone then opened. So a client that named a conversation this desktop does not
have (a row merged in from another desktop, or one deleted since the list was
read) had its text silently re-homed: it landed in a conversation the user was
not looking at, under a title derived from the message, and the conversation
they meant to continue never received it. Nothing failed, so nothing told them.
The refusal now comes before anything is persisted:
lazy creation (thread born with the first message, real agent session id up
front, so ack/event subjects/history agree).
(
session_not_on_desktop) plus a readable sentence. The phone maps that codeto "that conversation is not on the connected desktop" instead of a generic
send failure; other clients keep the sentence.
Mobile side: a merged row from another desktop is opened on the machine that
owns it. The phone holds one active connection, so tapping such a row used to
select a session id against the active desktop — the wrong machine, and (with
the old host behavior) the trigger for the detour above. The row now switches
the active desktop first (the same switch the device picker performs) and then
opens the conversation there; a row of the active desktop, and every row of an
unmerged list, is the plain selection it always was.
Two test fixtures that prompted an invented session id were giving the host
something no client can send — a conversation that was never listed. They now
seed the thread
list_sessionswould have shown (thread_for_session), whichis also what makes the new contract visible in the suite.
Verified: mobile
tsc/eslintclean, 3060 mobile tests pass; desktopcargo fmt --check, clippy (default and--no-default-features,--all-targets)clean,
remote_host::,remote::andremote_peer::suites pass. The onefailing desktop test locally,
desktop_settings_refuse_to_guess_sandbox_availability, fails identically withthis change stashed — it asserts the test machine's sandbox probe, not this
code.
docs/internals/desktop/CONNECTION.md records the boundary in its compatibility
list.