Repository navigation
fix(peer): Make /btw and session actions work when controlling a CLI host - #3994
Merged
Merged
Conversation
A peer host only streams a session's events to a controller that subscribed to it, and the surface subscribes only its active session. A side question renders beside that session, so the host ran the turn while the panel stayed empty, and every retry reused the request id and was refused as Processing. Open the child session's relay subscription once btw_ask_stream is accepted. The host replays from its records, so earlier events are not lost.
Controllers saw these features fail only when driving a CLI host: - cancel_session, so closing a /btw side question no longer errors - fork_session and copy_session (session_fork_v1, whole_session_copy_v1) - load_persisted_session_metadata, used after create and fork - interrupt_dialog_turn and recover_interrupted_dialog_turn (recoverable_interruption_v1, also advertised by Desktop) - compact_session, unarchive_session, list_archived_sessions, get_session_lineage, and the thread goal mutations - get_session_file_diff_stats through LocalWorkspaceSnapshotPort Subscription account commands now carry a reason that reports them as unavailable on CLI hosts instead of asking the user to update.
- Hide turn fork and side question "save as fork" on CLI hosts that do not advertise session_fork_v1 instead of failing them. - Interrupt recoverably on Stop when the rendered host advertises recoverable_interruption_v1; older hosts keep hard cancellation. - Close a side question with btw_cancel when an older CLI host refuses cancel_session, then delete it as before. - Show subscription accounts as unavailable on hosts that refuse them rather than offering a retry that cannot succeed.
…sion Peer session refresh subscribes only the active session, and a host streams each session's events only to its own subscribers. Review and deep review panes launched on a peer, new MiniApp topic chats, and any pane restored after a device switch therefore showed no live progress. Open the relay subscription when a pane retains a materialized session on a peer surface. The active session, unsent side drafts, and metadata-only shells keep their existing owners.
The CLI host can now list and restore archived sessions, so its archived sessions page must also delete them. Answer delete_persisted_session through the existing session deletion, as Desktop does, and add delete_all_archived_sessions.
wsl.exe --list fails both when WSL is not installed and when it has no distribution, and Windows localizes that message. A Chinese Windows host, or a peer controlled through it, showed a failed discovery with a retry instead of the not-installed state. Classify by the command the message suggests, which is not localized.
btw_ask_stream is not replayed, so a Relay reconnect that lost its reply reported an error while the host was already answering, and a retry was refused as Processing. On a lost reply, read the host's records for the Turn the request id names before reporting failure; nothing is resubmitted.
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
Controlling another device behaved differently from local use, most visibly with
/btwon a CLI peer host:/btwreplies never appeared. A peer host streams a session's events only to a controller subscribed to it, and the surface subscribes only its active session. A side question renders beside that session, so the host ran the turn while the panel stayed empty, and each retry reused the request id and was refused asProcessing.cancel_sessionhandler.While fixing these, other CLI-host gaps in the same chat/session flows were closed, and the controller now negotiates the new behavior so older hosts keep a working path.
Controller (web-ui)
A host streams each session's events only to that session's subscribers, while peer session refresh subscribes only the active session. Any other mounted transcript (side question, review / deep review, or subagent pane, docked chat) now opens its own relay subscription on a peer surface. This also covers panes restored after a device switch, which closes every subscription. The active session, unsent side drafts, and metadata-only shells keep their existing owners.
Open the side question's relay subscription once
btw_ask_streamis accepted. The host replays from its records, so earlier events are not lost.Close a side question with
btw_cancelwhen an older CLI host refusescancel_session, then delete it as before.Hide turn fork and side question "save as fork" on CLI hosts that do not advertise
session_fork_v1.Stop interrupts recoverably (resumable, as on the local surface) when the rendered host advertises
recoverable_interruption_v1; otherwise it keeps hard cancellation.Subscription accounts in model settings report "not available on that device" instead of a retry that cannot succeed.
When a Relay reconnect loses the
btw_ask_streamreply, the controller reads the host's records for turnbtw-turn-<requestId>before reporting failure, mirroring how a dialog turn with an unknown outcome is confirmed. Nothing is resubmitted.The composer's run-target chip named "This computer" even on a peer surface, where the task runs on the controlled device. It now shows the executing device's name (account alias, or the host name when signed out), falling back to the generic label until a name is known.
These controller changes apply to every host kind; the missing
/btwreplies were observed against a Desktop (Windows) host.Desktop / Windows host
wsl.exe --listfails both when WSL is not installed and when it has no distribution, with a localized message. A Chinese Windows host reported a failed discovery with a retry. The host now classifies by the unlocalized command the message suggests (wsl.exe --install→ unsupported,wsl.exe --list --online→ supported with no distributions).CLI peer host
New handlers mirroring Desktop:
cancel_session,fork_session,copy_session,load_persisted_session_metadata,interrupt_dialog_turn,recover_interrupted_dialog_turn,compact_session,unarchive_session,list_archived_sessions,delete_persisted_session,delete_all_archived_sessions,get_session_lineage, the thread goal mutations, andget_session_file_diff_stats(through a newLocalWorkspaceSnapshotPortmethod). The CLI now advertiseswhole_session_copy_v1,session_fork_v1, andrecoverable_interruption_v1; Desktop also advertises the latter two.Compatibility
Remote scenarios
Peer Device Mode (Desktop controller → CLI host and → Desktop host), from controller logs of both. Remote workspace, remote control, and detached dispatch paths are unchanged: recoverable interruption still excludes remote SSH, goal, and dispatch sessions on the controller.
Verification
AI-assisted; lightly tested (focused automated tests, not yet exercised on real devices).
node scripts/run-vitest.mjs runon the affected web-ui test files (FlowChatStore, btw/review panes, subagent projection, peer refresh, state machine, settings, peer transport): all passedcargo test -p openbitfun-cli --bin openbitfun peer_host::: 134 passedcargo test -p openbitfun-product-domains --lib remote_surface: 20 passedcargo test -p openbitfun-runtime-ports --lib: 8 passedpnpm run check:repo-hygienepassed;pnpm run capabilities:generateregenerated the registry outputscheck:core-boundariesand the Desktop crate build could not run locally (nested worktree and unbuilt extension host); left to CI