Repository navigation
[feat] Add Microsoft Teams to the channel setup screen - #8235
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 29 minutes. View limit details
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
📘 Docs preview
Pages changed in this pull request This comment updates in place on every push. |
Website previewPreview URL: https://pr-8235-agenta-website-preview.mahmoud-637.workers.dev Built from |
Railway Preview Environment
Dependent tests finished. Post /preview for manual review. Environment absence verified; retained storage requires separate provider accounting. Post |
…hared helpers Teams group chats are no longer called channels: the space kind picks the noun and icon, and the Teams switch and headings say channels and group chats. The setup download uses downloadBlob, the revoked row text is a typed map, the load error is written once, the created connection is one state, and ownOnly is now customOnly. Spec task 3.2 now describes one action per platform with one shared parser.
The Teams read settings card lists team channels and group chats, so it says chats like the answers-in card. placeNoun reads a typed map, two comments are updated, and a test checks the Teams row count.
… feat/teams-channel-setup
|
🤖 The AI agent says: Review loop result for head
Fixed:
Left on purpose:
|
|
🤖 The AI agent says: Review loop result for head
Fixed:
Left on purpose:
|
|
🤖 The AI agent says: Review loop result for head
Rounds 1 and 2 used the old merge base Fixed:
Left on purpose:
|
… feat/teams-channel-setup
|
🤖 The AI agent says: Review loop result (delta review) for head
Fixed: nothing needed.
|
|
🤖 The AI agent says: Review loop result (delta review) for head
Fixed: nothing needed. No findings. |
|
@coderabbitai review |
Action not completed
|
|
@coderabbitai review |
Action not completed
|
|
@coderabbitai review |
Action not completed
|
|
@coderabbitai review |
Action performed
|
|
🤖 The AI agent says: This PR is ready for your review. What changed since the review loops: the base branch is merged in twice (backend work from PR 1 only). One commit fixes the CodeRabbit items: the docs page now says you upload the Teams app once, and three comments are one line each. What I need from you:
Live QA waits for the Microsoft 365 test tenant. |
|
🤖 The AI agent says: Ship record for head
Later commits after the review heads:
Deploy steps: none. |
|
🤖 The AI agent says: Ship record for head
Later commit after the earlier record:
Deploy steps: none.
|
|
🤖 The AI agent says: Live QA record for the Microsoft Teams channel. The full record is on #8234: #8234 Video 1: the setup in /m. The client secret field is masked. The app ID, tenant ID and endpoint address are blurred. teams-qa-part1-public.mp4What applies to this PR, all PASS:
Finding fixed during QA: the app was named "Teams" instead of the agent's name. This PR fixes it (the connection is named after the agent). Microsoft's admin catalog refuses an app named after its own product, so the fix also matters for admin upload. Follow-ups noticed: the manifest uses schema 1.16 and the Developer Portal suggests 1.20. Teams now offers a "Socket mode (Beta)" bot option with no public endpoint. |
… feat/teams-channel-setup
|
🤖 The AI agent says: Ship record for head
Commits after the earlier record:
Deploy steps: none.
|
… feat/teams-channel-setup
|
@coderabbitai review |
Action performed
|
|
🤖 The AI agent says: Ship record for head
Commits after the earlier record:
Deploy steps: none.
|
… feat/teams-channel-setup # Conflicts: # web/mobile/src/features/agents/AgentChannelsCard.tsx # web/mobile/src/features/app/postAuthBoot.ts # web/packages/agenta-settings-ui/src/channels/ChannelAdvancedSection.tsx # web/packages/agenta-settings-ui/src/channels/ChannelConnectFlow.tsx # web/packages/agenta-settings-ui/src/channels/ChannelManagePanel.tsx # web/packages/agenta-settings-ui/src/channels/ChannelsSettingsPage.tsx # web/packages/agenta-settings-ui/src/channels/WhatsAppWebhook.tsx # web/packages/agenta-settings-ui/src/channels/actions.ts # web/packages/agenta-settings-ui/src/channels/helpers.ts # web/packages/agenta-settings-ui/src/channels/useChannelPanel.tsx
… feat/teams-channel-setup
… feat/teams-channel-setup
There was a problem hiding this comment.
Note
Newer findings are available below. Devin Review posted a newer report on this PR, in addition to the findings presented here.
Devin Review found 3 potential issues.
3 flags not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)
| const teamsAppPackage = async (connectionId: string): Promise<ChannelSetupDocument | null> => { | ||
| const res = await client | ||
| .fetchChannelConnectionSetup({connection_id: connectionId}, scope()) | ||
| .catch(rethrow(t("channels.teams.loadError"))) | ||
| return setupDocumentOf(asRecord(asRecord(res).setup)) |
There was a problem hiding this comment.
🟡 Missing setup response boundary validation
For malformed setup responses, teamsAppPackage silently replaces invalid document fields with null. The frontend API rules require Zod validation through safeParseWithLogging at this boundary. Schema drift therefore produces no structured validation diagnostics.
Learn more
The generated client returns a response that this package treats as unknown. The frontend API rules explicitly require an independent Zod schema and safeParseWithLogging from @agenta/entities/shared for new API boundaries. setupDocumentOf only coerces fields to strings or null; it does not validate the response shape or report structured schema errors.
Example: A setup response contains a numeric document.content instead of base64 text. The parser changes it to null and the download shows a generic failure, without the required schema-drift diagnostic.
Recommended fix: Define a setup-response schema with the expected nullable document fields and validate the response with safeParseWithLogging before mapping it. Return null for a failed validation and add a malformed-response test. Declare any new direct dependency in the package manifest.
Was this helpful? React with 👍 or 👎 to provide feedback.
…he Teams setup links
|
🤖 The AI agent says: Review loop result for head
Fixed: the catalog rewrite had moved existing |
|
🤖 The AI agent says: Review loop result for head
Fixed: nothing to fix. No findings. |
# Conflicts: # web/mobile/src/features/agents/useAgentChannels.ts # web/mobile/src/features/chat/useAgentPrivacyProps.ts # web/mobile/src/lib/sharingCopy.ts # web/mobile/tests/unit/agentChannelSharing.render.test.tsx # web/mobile/tests/unit/agentChannelsReload.render.test.tsx # web/packages/agenta-i18n/locales/de-DE/agents.overview.json # web/packages/agenta-i18n/locales/de-DE/channels.manage.json # web/packages/agenta-i18n/locales/de-DE/shell.bootLoader.json # web/packages/agenta-i18n/locales/en/agents.overview.json # web/packages/agenta-i18n/locales/en/channels.manage.json # web/packages/agenta-i18n/locales/en/shell.bootLoader.json # web/packages/agenta-i18n/locales/es-ES/agents.overview.json # web/packages/agenta-i18n/locales/es-ES/channels.manage.json # web/packages/agenta-i18n/locales/es-ES/shell.bootLoader.json # web/packages/agenta-i18n/locales/fr-FR/agents.overview.json # web/packages/agenta-i18n/locales/fr-FR/channels.manage.json # web/packages/agenta-i18n/locales/fr-FR/shell.bootLoader.json # web/packages/agenta-i18n/locales/ja-JP/agents.overview.json # web/packages/agenta-i18n/locales/ja-JP/channels.manage.json # web/packages/agenta-i18n/locales/ja-JP/shell.bootLoader.json # web/packages/agenta-i18n/locales/pt-BR/agents.overview.json # web/packages/agenta-i18n/locales/pt-BR/channels.manage.json # web/packages/agenta-i18n/locales/pt-BR/shell.bootLoader.json # web/packages/agenta-i18n/locales/zh-CN/agents.overview.json # web/packages/agenta-i18n/locales/zh-CN/channels.manage.json # web/packages/agenta-i18n/locales/zh-CN/shell.bootLoader.json # web/packages/agenta-settings-ui/src/channels/ChannelAdvancedSection.tsx # web/packages/agenta-settings-ui/src/channels/ChannelConnectFlow.stories.tsx # web/packages/agenta-settings-ui/src/channels/ChannelConnectFlow.tsx # web/packages/agenta-settings-ui/src/channels/ChannelManagePanel.stories.tsx # web/packages/agenta-settings-ui/src/channels/ChannelManagePanel.tsx # web/packages/agenta-settings-ui/src/channels/ChannelsSettingsPage.tsx # web/packages/agenta-settings-ui/src/channels/actions.ts # web/packages/agenta-settings-ui/src/channels/helpers.ts # web/packages/agenta-settings-ui/src/channels/icons.tsx # web/packages/agenta-settings-ui/src/channels/storyFixtures.tsx # web/packages/agenta-settings-ui/src/channels/types.ts # web/packages/agenta-settings-ui/src/channels/useChannelPanel.tsx # web/packages/agenta-settings-ui/src/publish/AgentPublish.stories.tsx
…e Teams test fixtures
|
🤖 The AI agent says: Review loop result for head
Both reviewers confirmed that Discord keeps its English text, invite flow, retry and error paths and test ids. Fixed: the Teams-era test fixtures in
|
|
🤖 The AI agent says: Review loop result for head
Fixed: two Teams group chats with no name both showed "Unnamed group", because |
There was a problem hiding this comment.
Devin Review found 1 new potential issue.
3 flags not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)
| // Teams verification discovers no name, and the app package takes the connection's | ||
| // name as the bot's, so a Teams connection is named after the agent it answers as. | ||
| const name = platform === "teams" && appId ? resolveAgentName(appId) : null |
There was a problem hiding this comment.
🟡 Indistinguishable Teams bot connections
With multiple Teams bots, mapConnectionRow labels every bot “your bot” instead of retaining its identity. The connection mapper drops the stored name and Teams application ID. Users cannot identify which bot they are updating or disconnecting.
Learn more
The Teams verification returns an application ID, tenant ID and webhook URL, but no bot username. The connection mapper ignores the stored connection name and reads only bot_username for a bot handle. The bot label fallback therefore returns “your bot” for every Teams connection. The connection list uses that label to select the connection to manage.
Example: Connect a Support Teams bot and a Sales Teams bot in one project. Before either receives a message, both rows show “your bot” with the same connection details, even though their stored names and application IDs differ.
Recommended fix: Preserve a Teams display name and its data.connection_locator.app_id in the frontend connection shape. Use the name for the row title and the application ID to distinguish connections with identical names. Add a mapping and list-rendering test with two Teams connections.
Was this helpful? React with 👍 or 👎 to provide feedback.
|
🤖 The AI agent says: Ship record for head
Red check: Passed on this head: Python lint and format, gitleaks, migration gate, API unit tests, EE API unit tests, SDK, services and runner tests, the API and runner image builds, and the preview deploy. Web tests were not awaited. The CLA check and "Entire Gates" are ignored as outside services. Deploy steps: none. |
Context
An agent can answer in Slack, Telegram and WhatsApp, but not in Microsoft Teams. The backend PR #8234 (the base of this one) adds the Teams adapter. Replies and approval cards come in a separate delivery PR. This PR adds the part people see: the Teams row on the agent's Channels card, the setup screen that connects a Teams bot, and a docs page.
What the user sees
Changes
The setup screen lives in the package
@agenta/settings-ui(a shared library of React components, like a Python package that both apps import). The/mapp only passes it data.Platform lists. A frontend "union type" is a fixed list of allowed strings, like a Python
Literal.ChannelPlatformwas"slack" | "telegram" | "whatsapp"and is now... | "teams". Several tables of labels are typedRecord<ChannelPlatform, string>, which is like adictthat the type checker forces to have one key per platform. I turned a fewif slack ... elif whatsapp ... else telegramchains into these tables, so a missing Teams label is a type error instead of silently showing the Telegram text. The Discord setup PR makes the same change in the same shape, so the two PRs conflict only on the added lines.The setup document. The backend returns the Teams app as a setup document:
{format: "zip", content: <base64 of the zip>, filename: "..."}. Before, the UI kept onlycontentand droppedformatandfilename. Now one parser,setupDocumentOf, keeps all four fields:A new action,
teamsAppPackage(connectionId), calls the existing per-connection setup route (fetchChannelConnectionSetup, already in the generated API client) and returns that document. The client method is declared in the same line and shape as in the Discord setup PR, so a merge keeps one copy.The download. The browser has no "save these bytes" call. The usual way is: decode the base64 with the built-in
atob, wrap the bytes in aBlob(an in-memory file), make a temporary URL for it, and click a hidden link with adownloadfile name. The repo already has this indownloadBlob(@agenta/shared/utils), so the PR decodes the base64 and calls it. This needs no new dependency. The package is fetched only when the user clicks the button, because the zip is large and most visits never need it.Channels and group chats. Teams has two kinds of shared place: team channels and group chats. The backend stores a team channel as a
topicspace and a group chat as agroupspace. The UI now names them apart on Teams: a team channel gets the#icon and a group chat gets the group icon, the reply switch says "Channels and group chats", and counts say "chats". Slack, Telegram and WhatsApp keep their words.The setup steps. All Teams copy is in one file,
teamsSetupCopy.ts. The guide follows the Teams Developer Portal path. If the live test shows that this path cannot send replies, only this file and the docs page change. The field labels, help text and GUID error come from the backend's capability declaration, not from the UI.Docs. New page
docs/docs/guides/16-connect-microsoft-teams.mdx: register the bot, find the tenant ID, connect, paste the endpoint, upload the app, how the agent answers in personal chats, team channels and group chats, and troubleshooting for each backend error. It links the Azure portal path as the alternative.New user-facing strings
Setup steps:
After connect and in the manage view:
Labels and states:
/m)Scope and risk
downloadBlobhelper.How to review
Read in this order:
web/packages/agenta-settings-ui/src/channels/types.ts: the new platform,ChannelSetupDocument, and theteamsAppPackageaction.actions.ts:setupDocumentOf,teamsAppPackage, and the platform list.helpers.ts: the label tables,hasChannels,placeNoun, and the two download helpers at the end (base64Bytes,downloadSetupDocument).chatTypeOfinactions.tsmaps a Teamstopicto a channel and agroupto a group.teamsSetupCopy.ts, thenTeamsAppSetup.tsx: the copy, and the component that shows the endpoint and the download.ChannelConnectFlow.tsx: the Teams branch (search forisTeams).ChannelManagePanel.tsx: the "Teams app" section and the revoked copy.ChannelAdvancedSection.tsx: the same change as in the Discord PR, so the Telegram-only help no longer shows for other platforms.web/mobile/src: four small list updates.tests/unit/channelTeams.test.tsx, then the docs page.Tests
channelTeams.test.tsx(14 tests): the steps and three fields, the GUID error blocks Connect, connect then the endpoint and download, the downloaded file has the decoded bytes and the right name, copy, a failed package load, a refused connect keeps the values, the request shapes sent to the API client, and the manage view.@agenta/settings-uiunit tests pass (31 files, 307 tests). The mobile channel tests pass.@agenta/settings-uiand@agenta/mobile.pnpm lintpasses inweb.What to QA
Needs the backend PR on the same stack and a Teams bot in a test tenant.