fix(remote-connect): cancel relay tasks and prevent duplicate mobile commands - #2816
Merged
bobleer merged 1 commit intoSep 5, 2026
Merged
Conversation
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
Disconnecting or dropping a Relay client could leave its socket, heartbeat, or reconnect tasks alive, and a failed initial dial could leave the client stuck in
Connecting. Give the connection one cancellable owner with generation fencing, full-duplex IO, write deadlines, and room/account restoration before accepting new outgoing commands. Due heartbeats take priority over a busy command queue.Mobile device RPC could execute twice when an encrypted application error mentioned
UnauthorizedorHTTP 401. Retry authentication only for an actual Relay HTTP 401, preserving account-generation checks and the latest direct-login/timeout behavior.NOT_RUN.Type and Areas
Bug fix, focused transport refactor, tests, and developer documentation. Areas: services-integrations / Relay client, mobile-web, App Server test fixtures, and TypeScript SDK tests.
Motivation / Impact
Explicit disconnect and client replacement retire their transport work. Reconnection restores identity context, and sustained output cannot suppress keepalives. A remote tool's authentication error remains a single application result instead of causing another mutation.
Verification
AI-assisted change; focused automated verification on macOS arm64. Rebased onto
1.0.0-exploreat29fd98052.Commands:
Reviewer Notes
Real SSH servers, mobile browsers, IM providers, peer computers, and detached-dispatch fault injection still require the environments described in
docs/development/communications-e2e.zh-CN.md. Local loopback and contract tests do not establish those remote results. A previous broader Shared IPC run had two failures during non-UTF-8 fixture-directory creation on macOS; Linux verification, the real Docker round trip, and Windows-native coverage remain outstanding.The connection owner stays in services-integrations and preserves the existing wire format. The 64-message queue is a message-count limit; end-to-end byte budgets, server-side overload, and long-duration behavior remain explicit E2E follow-ups.
Checklist