fix(msteams): Answer a rejected card action with the API's status - #123477
Open
vaind wants to merge 1 commit into
Open
fix(msteams): Answer a rejected card action with the API's status#123477vaind wants to merge 1 commit into
vaind wants to merge 1 commit into
Conversation
`_issue_state_change` classified the `ApiError` from the issue update API and then fell through to `return response`, which the failed call never bound. Every rejected card action raised `UnboundLocalError` and answered 500. MS Teams card actions are forwarded asynchronously through `WebhookPayload`, and the drain reads a 500 as retryable: a permanently rejected action -- the clicking user lacks permission, or names a release that isn't configured -- was retried ten times at hour-long backoff while the rest of the tenant's mailbox waited behind it. A 4xx is dropped instead, so the head clears on the first attempt. The `inNextRelease` check also assumed a mapping body, which is a second way into the same 500: a `ValidationError` raised on a bare string serializes to a list.
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.
_issue_state_changeclassifies theApiErrorthe issue update API raises and then falls through toreturn response, which the failed call never bound. Every rejected card action raisesUnboundLocalErrorand answers 500.MS Teams card actions are forwarded asynchronously through
WebhookPayload, and the drain reads a 500 as retryable. A permanently rejected action — the clicking user lacks permission, or names a release that isn't configured — is retried ten times at hour-long backoff, and becausemsteamsis a strict provider the rest of the tenant's mailbox waits behind it. Answering with the API's own status makes it adropped_4xxon the first attempt, so the head clears.The
inNextReleasebranch also assumed a mapping body, which is a second way into the same 500: aValidationErrorraised on a bare string serializes to a list._is_next_release_errorchecks the shape before reaching into it.Tests
Two cases in
test_action_state_change.py, both of which reproduce the 500 without the fix: a 403 with a mapping body, and a 400 with a list body.Context
Found while reviewing #123422, which lets the drain skip a failed
msteamsrecord instead of head-blocking on it. That option papers over this; the wedge itself is this bug, and the fix stands on its own.