Skip to content

Fix remote mode: abort, resume, race conditions#55

Merged
PureWeen merged 4 commits into
mainfrom
remote-mode-fixes
Feb 11, 2026
Merged

Fix remote mode: abort, resume, race conditions#55
PureWeen merged 4 commits into
mainfrom
remote-mode-fixes

Conversation

@PureWeen
Copy link
Copy Markdown
Owner

Summary

Fixes three remote mode bugs and adds test coverage + documentation.

Bug Fixes

  1. Stop button not working from Android

  2. Resumed sessions not appearing in active listResumeSessionAsync returned immediately in remote mode without adding the session to _sessions or Organization.Sessions. Added optimistic session + metadata add before the bridge message send.

  3. Race condition causing sessions to appear then disappearSyncRemoteSessions could process the server response before optimistic state was set. Changed _pendingRemoteSessions to ConcurrentDictionary and moved all state setup before the await.

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 — Added AbortSession constant
  • WsBridgeClient.cs — Added AbortSessionAsync() method
  • WsBridgeServer.cs — Added AbortSession handler + BroadcastOrganizationState() after resume/create
  • CopilotService.cs — Remote mode delegation for abort/resume/create with optimistic adds
  • CopilotService.Bridge.cs — Thread-safe pending session tracking
  • copilot-instructions.md — Remote mode architecture, pitfalls, and bridge command guide

- 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).
- 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
@PureWeen PureWeen merged commit 7a321ea into main Feb 11, 2026
4 checks passed
@PureWeen PureWeen deleted the remote-mode-fixes branch February 22, 2026 00:16
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