Repository navigation
feat(apps): add multi-geo Socket Mode supervisor and transport - #685
Merged
teddy arida-moody (teddyam) merged 33 commits intoOct 1, 2026
Merged
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
teddy arida-moody (teddyam)
added this pull request to stack #684
September 24, 2026 05:39
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Copilot started reviewing on behalf of
teddy arida-moody (teddyam)
September 24, 2026 16:27
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Four moderate issues remain in token refresh timing, startup failure handling, protocol rejection replies, and stopped geo status reporting.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 4
Open (4)
What changed in this PR
Adds the internal multi-geo Socket Mode supervisor and transport layer.
Changes:
- Adds per-geo startup, retries, reconnects, token rotation, and cleanup.
- Adds multi-geo routing, lifecycle status, and activity dispatch.
- Adds unit and end-to-end test coverage.
| File | Summary |
|---|---|
test/Microsoft.Teams.Apps.UnitTests/SocketMode/SocketModeTransportTests.cs |
Tests transport routing, status, startup failures, and dispatch behavior. |
test/Microsoft.Teams.Apps.UnitTests/SocketMode/SocketModeEndToEndTests.cs |
Tests integrated transport, negotiation, and SignalR behavior. |
test/Microsoft.Teams.Apps.UnitTests/SocketMode/GeoSocketTests.cs |
Tests supervision, retries, reconnects, rotation, stale generations, and cleanup. |
src/Microsoft.Teams.Apps/SocketMode/SocketModeTransport.cs |
Implements multi-geo orchestration and dispatch; moderate issues remain with cleanup error propagation, version-rejection reply shape, and stopped per-geo statuses. |
src/Microsoft.Teams.Apps/SocketMode/GeoSocket.cs |
Implements per-geo connection supervision and token rotation; token refresh timing may be incorrect after lengthy startup. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Refactor OnActivity to await readiness before handling activity. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Adds an internal GeoSocket that keeps one geo connected: initial startup within a monotonic budget, Retry-After/backoff retries, reconnect after unexpected closure, and make-before-break token rotation with a retiring handoff window. Dispatch is fenced to the active or retiring generation, and every connection is stopped and disposed exactly once. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Resolve per-geo negotiate endpoints, start every geo with fail-fast startup, stop all geos, aggregate status internally, and dispatch envelopes with invoke/ack replies and 500 on handler failure. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
teddy arida-moody (teddyam)
force-pushed
the
teddyam-socket-mode-geo-supervisor
branch
from
September 24, 2026 18:07
0181348 to
5e4c28f
Compare
Base automatically changed from
teddyam-socket-mode-signalr-connection
to
main
September 24, 2026 18:39
Adds an internal GeoSocket that keeps one geo connected: initial startup within a monotonic budget, Retry-After/backoff retries, reconnect after unexpected closure, and make-before-break token rotation with a retiring handoff window. Dispatch is fenced to the active or retiring generation, and every connection is stopped and disposed exactly once. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Resolve per-geo negotiate endpoints, start every geo with fail-fast startup, stop all geos, aggregate status internally, and dispatch envelopes with invoke/ack replies and 500 on handler failure. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
teddy arida-moody (teddyam)
force-pushed
the
teddyam-socket-mode-geo-supervisor
branch
from
September 24, 2026 18:39
5e4c28f to
8953d5e
Compare
added 2 commits
September 24, 2026 13:21
…om/microsoft/teams.net into teddyam-socket-mode-geo-supervisor
Log connection stop/dispose failures instead of throwing so they cannot mask the original startup failure or end a geo's supervisor, and mark every geo as Stopped when the transport stops. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
teddy arida-moody (teddyam)
force-pushed
the
teddyam-socket-mode-geo-supervisor
branch
from
September 24, 2026 22:12
cd40b2d to
ab2a6ae
Compare
A faulted supervisor is already logged; rethrowing it from stop could mask the original startup failure in the transport. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…om/microsoft/teams.net into teddyam-socket-mode-geo-supervisor
Lily Du (lilyydu)
approved these changes
Oct 1, 2026
teddy arida-moody (teddyam)
deleted the
teddyam-socket-mode-geo-supervisor
branch
October 1, 2026 18:34
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.

Layer 3 of the Socket Mode stack, on top of #683 (SignalR connection) and #682 (protocol). Everything added here is internal: no public API, no App integration, no samples and no docs yet.
Changes
GeoSocket— one supervisor per geoSocketReady. Failures retry within the startup budget, using the server'sRetry-Afterwhen it sends one and backoff otherwise. A startup timeout of zero allows exactly one attempt.ISocketConnectionFactory. Each one carries a generation number, and only the current ready connection or one that is being retired can dispatch activities.StopAsyncinterrupts startup, retry, rotation and retirement work that is still pending. Every connection is stopped and disposed exactly once, and calling it again is safe.SocketModeTransport— top level{base}/{geo}/v3/websockets/connect. The default geos are amer, emea and apac. An empty geo means the base URL with no geo segment.Tests
The
SocketModefilter passes 118/118 on both net8.0 and net10.0. All tests use hand-written fakes, and timing tests use an injectedTimeProviderinstead of sleeping.GeoSocketTestscover: startup, retry andRetry-After, reconnect, rotation handoff, rejection of stale generations, stop races, and exactly-once cleanup.SocketModeTransportTestscover: geo resolution, fail-fast startup, status, and dispatch with its 400 and 500 cases.SocketModeEndToEndTestsrun the transport together with the real negotiator from feat(apps): add Socket Mode protocol transport #682 and the real SignalR connection factory from feat(apps): add SignalR Socket Mode connection #683. Only the HTTP responses and the SignalR client are faked.