Repository navigation
Fix Socket Mode connect URL geo routing - #729
Conversation
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>
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
🟡 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>
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>
There was a problem hiding this comment.
🔵 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
Arup Roy (aroy-ms)
left a comment
There was a problem hiding this comment.
approving with 1 suggestion
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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>
There was a problem hiding this comment.
🟡 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>
Arup Roy (aroy-ms)
left a comment
There was a problem hiding this comment.
approving latest iteration



Summary
{geo}.botapi.skype.cominstead ofbotapi.skype.com/{geo}, matching fix: update connect URL to target correct geo teams.py#676.SocketModeOptions.NegotiateBaseUrl); onlyGeosremains configurable.Geos = []) uses the defaults:amer,emea, andapac. An empty geo string (Geos = [""], or an empty string within a non-empty list) is rejected; it no longer bypasses geo-specific routing.Public API change
SocketModeOptions.NegotiateBaseUrlis a source-breaking change for callers that set the endpoint override. Remove that assignment and useGeosto select the connections instead; custom endpoint overrides are no longer supported.[]uses defaults;[""]is rejected.Validation