fix(msteams): treat HTTP 202 from Power Automate webhooks as success - #2113
fix(msteams): treat HTTP 202 from Power Automate webhooks as success#2113philslab-ninja wants to merge 3 commits 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 |
|
@arikalon1 @moshemorad — could one of you take a look at this one? It's a 5-line fix, CI is green, and it closes #1893. tl;dr: Power Automate returns HTTP 202 for async accept, so the current check logs an error on every successful notification. This PR fixes that. Thanks! |
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