Skip to content

Fix Consent error for MS Teams + Copilot#888

Merged
sw-joelmut merged 1 commit intomainfrom
southworks/fix/msteams-copilot-consent
Jan 26, 2026
Merged

Fix Consent error for MS Teams + Copilot#888
sw-joelmut merged 1 commit intomainfrom
southworks/fix/msteams-copilot-consent

Conversation

@sw-joelmut
Copy link
Copy Markdown
Collaborator

Fixes #829

Description

This PR fixes an issue where using an Agent through Copilot chat with SSO, when requiring consent flow, it wouldn't let the user sign-in properly. This issue was due to a condition only applied to MS Teams channel specifically, not sending the HTTP 412 status to the channel, so it can retry the consent flow.

Testing

The following image shows the consent card being shown.
imagen

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a bug where SSO consent flow fails when using an Agent through M365 Copilot within MS Teams. The issue was that the code only checked if the channelId exactly matched "msteams", but when used through Copilot within Teams, the channelId is actually "msteams:COPILOT" (a composite channel identifier). The fix uses Activity.parseChannelId() to extract the parent channel from composite channel IDs, ensuring the HTTP 412 status code is sent correctly for both regular MS Teams and MS Teams with Copilot scenarios.

Changes:

  • Updated sendInvokeResponse method to parse composite channelIds and check the parent channel
  • Updated the comment to clarify that the method handles both MS Teams and Copilot within MS Teams

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sw-joelmut sw-joelmut merged commit f38b064 into main Jan 26, 2026
13 checks passed
@sw-joelmut sw-joelmut deleted the southworks/fix/msteams-copilot-consent branch January 26, 2026 09:35
@benbrown benbrown mentioned this pull request Jan 28, 2026
benbrown added a commit that referenced this pull request Jan 28, 2026
* Fix Consent error for MS Teams + Copilot (#888)

* Fix teamsinfo to use adapter.ConnectorClientKey

* Add Zod as agents-hosting dependency (#891)

* package lock changes

---------

Co-authored-by: Joel Mut <62260472+sw-joelmut@users.noreply.github.com>
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.

Bug: SSO/Consent fails in M365 Copilot within Teams only

3 participants