Fix remote mode: abort, resume, race conditions#55
Merged
Conversation
- Add AbortSession bridge message type for remote stop button - Fix resume not appearing in active sessions (optimistic add with SessionMeta) - Fix race condition with ConcurrentDictionary for _pendingRemoteSessions - Broadcast organization state after resume/create on server - Add 32 new tests in RemoteModeTests.cs - Document remote mode pitfalls in copilot-instructions.md
Skip focus/setSelectionRange restore when the textarea already has focus, preventing Blazor re-renders from overwriting the user's active text selection (double-click, drag, Cmd+A).
1d5a073 to
3723174
Compare
- Build & Test job: builds test project, runs 131+ tests - Publish Mac Catalyst: signed (with secrets) or unsigned fallback - Notarize: on tag pushes, submits to Apple with retry logic - Create Release: attaches notarized .zip to GitHub Release - Triggers on push to main/develop, PRs, tags, and manual dispatch
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
Fixes three remote mode bugs and adds test coverage + documentation.
Bug Fixes
Stop button not working from Android —
Resumed sessions not appearing in active list —
ResumeSessionAsyncreturned immediately in remote mode without adding the session to_sessionsorOrganization.Sessions. Added optimistic session + metadata add before the bridge message send.Race condition causing sessions to appear then disappear —
SyncRemoteSessionscould process the server response before optimistic state was set. Changed_pendingRemoteSessionstoConcurrentDictionaryand moved all state setup before theawait.New Files
PolyPilot.Tests/RemoteModeTests.cs— 32 new tests covering bridge protocol serialization, session state transitions, organization metadata, and chat message edge cases.Changes
BridgeMessages.cs— AddedAbortSessionconstantWsBridgeClient.cs— AddedAbortSessionAsync()methodWsBridgeServer.cs— AddedAbortSessionhandler +BroadcastOrganizationState()after resume/createCopilotService.cs— Remote mode delegation for abort/resume/create with optimistic addsCopilotService.Bridge.cs— Thread-safe pending session trackingcopilot-instructions.md— Remote mode architecture, pitfalls, and bridge command guide