fix(msteams): treat HTTP 202 from Power Automate webhooks as success#2113
Open
philslab-ninja wants to merge 1 commit into
Open
fix(msteams): treat HTTP 202 from Power Automate webhooks as success#2113philslab-ninja wants to merge 1 commit into
philslab-ninja wants to merge 1 commit into
Conversation
Power Automate workflow webhooks accept the payload asynchronously and return 202 Accepted on success, while legacy Office 365 connectors return 200. send() only accepted 200/201, so every successfully delivered notification via a Power Automate webhook was logged as "Error sending to ms teams ... error: Accepted" even though the message arrived in the channel. Add 202 to the accepted status codes and a test covering send() status code handling. Refs robusta-dev#1893
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughMsTeamsMsg.send() now accepts HTTP 202 as a success status code alongside 200 and 201, reflecting asynchronous acceptance by Power Automate webhooks. A new test module verifies logging behavior for success and error status codes. ChangesMS Teams Webhook Status Handling
Estimated code review effort: 1 (Trivial) | ~5 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Problem
When using an MS Teams Power Automate ("Workflows") webhook, every
successfully delivered notification is logged as an error:
The message does arrive in the channel — this is pure log noise, but it's
alarming and makes it look like Teams notifications are failing. Reported in
#1893 and independently confirmed there on 0.31.5 / 0.32.0.
Root cause
Power Automate workflow webhooks accept the payload asynchronously and return
HTTP 202 Accepted on success, whereas the legacy Office 365 connectors
returned 200.
MsTeamsMsg.send()only treated200/201as success:response.reasonfor a 202 is the string"Accepted"— exactly the text seenin the logs. So a 202 falls through to the error branch even though delivery
succeeded.
Fix
Add
202to the accepted status codes.Testing
Added
tests/test_ms_teams_send.py, parametrized over status codes:200,201,202→ no error logged400,500→ error still logged (genuine failures are unaffected)All existing MS Teams tests continue to pass.
Closes #1893