Skip to content

Fix Socket Mode connect URL geo routing - #729

Merged
teddy arida-moody (teddyam) merged 15 commits into
mainfrom
teddyam-fix-connect-geo-url
Nov 10, 2026
Merged

teddy arida-moody (teddyam) merged 15 commits into
mainfrom
teddyam-fix-connect-geo-url

Conversation

@teddyam

@teddyam teddy arida-moody (teddyam) commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Route Socket Mode connect/negotiate requests through {geo}.botapi.skype.com instead of botapi.skype.com/{geo}, matching fix: update connect URL to target correct geo teams.py#676.
  • Remove the configurable endpoint override (SocketModeOptions.NegotiateBaseUrl); only Geos remains configurable.
  • An empty geo list (Geos = []) uses the defaults: amer, emea, and apac. An empty geo string (Geos = [""], or an empty string within a non-empty list) is rejected; it no longer bypasses geo-specific routing.
  • Log each resolved connect/negotiate URL at Information during startup so it appears with the sample's default logging configuration.
  • Update routing coverage and documentation. Authentication scopes, returned SignalR URLs, and other API calls remain unchanged.

Public API change

  • Removing SocketModeOptions.NegotiateBaseUrl is a source-breaking change for callers that set the endpoint override. Remove that assignment and use Geos to select the connections instead; custom endpoint overrides are no longer supported.
  • Callers using an empty string to connect without a geo must select a geo instead, or use an empty list to connect to all three defaults. An empty list and an empty string have different behavior: [] uses defaults; [""] is rejected.

Validation

  • Socket Mode tests passed on .NET 8 and .NET 10: 224 tests per framework.
  • User verified the production geo routing locally with the SocketModeBot sample.

Teddy Arida-Moody and others added 8 commits November 9, 2026 10:26
Use geo subdomains for production connect requests while preserving custom endpoint routing and authentication scopes.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Include the geo and SignalR endpoint on each connection attempt, omitting URL credentials, query strings, and fragments.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Show per-geo connection URLs with the existing logging configuration.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Use geo subdomains for custom connect hosts, preserving base paths, ports, and queries. Log resolved negotiate URLs at Debug during startup instead of logging returned SignalR endpoints at Information.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Drop the leftover callback test from the earlier SignalR logging approach and consolidate overlapping custom-host and empty-geo cases.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Log negotiated SignalR endpoints at Information alongside transport lifecycle logs. Preserve Python-aligned connect routing and Debug diagnostics, and omit sensitive URL components from the new log.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep connection and geo-routing coverage without asserting diagnostic output or adding logging-only fixtures.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Remove returned SignalR endpoint logging and its callback plumbing. Keep Python-aligned negotiate URL diagnostics visible with the sample defaults and remove the returned-endpoint README notes.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 9, 2026 19:37
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

URL construction mishandles empty-geo URLs containing queries or fragments and prefixes loopback hosts with a geo, causing negotiation to target the wrong path or fail before sending a request.

2 open issues
What changed in this PR

This PR updates Socket Mode connect routing to use geo subdomains, aligning the .NET transport with the intended production endpoints.

Changes:

  • Replace geo path segments with subdomains for production and custom hosts.
  • Log resolved connect URLs at Information level during startup.
  • Update routing tests and documentation, and exercise a query-bearing SignalR URL.
File Description
test/​Microsoft.Teams.Apps.UnitTests/​SocketMode/​SocketModeTransportTests.cs Update routing expectations and add custom-host cases.
test/​Microsoft.Teams.Apps.UnitTests/​SocketMode/​SocketModeObserverTests.cs Expect geo-subdomain diagnostic URLs.
test/​Microsoft.Teams.Apps.UnitTests/​SocketMode/​SocketModeHostingTests.cs Update the hosted transport URL expectation.
test/​Microsoft.Teams.Apps.UnitTests/​SocketMode/​SocketModeEndToEndTests.cs Update endpoint assertions and fake geo extraction.
test/​Microsoft.Teams.Apps.UnitTests/​SocketMode/​SignalRSocketConnectionTests.cs Include a query parameter in the SignalR URL fixture.
src/​Microsoft.Teams.Apps/​SocketMode/​SocketModeTransport.cs Build geo-subdomain URLs and log them during startup.
src/​Microsoft.Teams.Apps/​SocketMode/​SocketModeProtocol.cs Clarify the negotiate-path comment.
src/​Microsoft.Teams.Apps/​SocketMode/​SocketModeOptions.cs Document subdomain routing and empty-geo behavior.
src/​Microsoft.Teams.Apps/​README.md Describe production routing, custom hosts, and URL logging.
samples/​SocketModeBot/​README.md Show the production geo-specific connect endpoints.

Review effort: Balanced

Do not imply support for geo-prefixed HTTP localhost endpoints that the real negotiator rejects.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 9, 2026 19:48
Use UriBuilder for every geo, keeping only the host prefix conditional. Preserve query parameters and discard fragments when appending the connect path; cover empty geos with exact URL regression cases.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The empty-geo branch appends the connect endpoint to the full base URL rather than its path, causing URLs with queries or fragments to send negotiation requests to the wrong endpoint.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 9, 2026 19:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the Socket Mode geo-subdomain routing update.

No open issues 🎉

Review effort: Balanced

@aroy-ms Arup Roy (aroy-ms) left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approving with 1 suggestion

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 9, 2026 20:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues block the Socket Mode geo-subdomain routing change.

No open issues 🎉

Review effort: Balanced

Use smbatrafficmanager.net for Socket Mode connect requests, remove configurable negotiate base URLs, and require at least one geo. Preserve unrelated authentication scopes and CompatBot URLs.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 9, 2026 22:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 9, 2026 22:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Insufficient geo validation can send Bot Framework bearer tokens to an attacker-controlled host, and the service domain differs from the documented endpoint.

2 open issues

Review effort: Balanced

Restore geo-prefixed botapi.skype.com endpoints, default empty geo lists, and check exact empty strings and case-sensitive duplicates. Escape geo URL components, simplify tests, and remove unnecessary endpoint documentation.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 9, 2026 23:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The PR description needs updating because it promises endpoint overrides and empty geo string support, while the revision removes NegotiateBaseUrl and rejects empty geo strings.

1 open issue
2 resolved since last review

Review effort: Balanced

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 10, 2026 00:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The review identifies no active issues with the geo-specific Socket Mode routing and configuration changes.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@aroy-ms Arup Roy (aroy-ms) left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approving latest iteration

@teddyam
teddy arida-moody (teddyam) added this pull request to the merge queue Nov 10, 2026
Merged via the queue into main with commit 9af1000 Nov 10, 2026
7 checks passed
@teddyam
teddy arida-moody (teddyam) deleted the teddyam-fix-connect-geo-url branch November 10, 2026 00:10
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.

5 participants