feat: Add Restart Processing + fix Teams link-unfurling cancel/restart loop#103
Closed
feat: Add Restart Processing + fix Teams link-unfurling cancel/restart loop#103
Conversation
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.
Summary
This branch adds a Restart Processing capability and fixes a critical bug where Teams' link-unfurling (URL prefetch) was causing an infinite cancel → restart → cancel loop.
Bug Fix: Teams Link Unfurling Loop
Root Cause
Teams automatically sends GET requests to URLs in notification cards for link-preview generation. Since
CancelProcessingandRestartProcessingboth accepted GET requests and executed their actions immediately, this caused:This was only triggered after the
restartUrlwas added to "cancelled" notifications (the new feature in this branch), which closed the loop.Fix
For
RestartProcessingGET, checks in-memory cache first:New Feature: Restart Processing
Adds
RestartProcessing.js— an HTTP endpoint that re-queues a transcript for processing after cancellation or failure.Concurrency protection (3 layers):
restartId) — prevents Azure Queue redelivery from firing twiceChanges
New files
azure-function/src/functions/RestartProcessing.js— HTTP trigger for restartazure-function/src/htmlResponseCard.js— shared HTML response card + newrenderConfirmationCardModified files
CancelProcessing.jssubscriptionId,resourceGroup,jobName) read server-side from env vars, not from URL paramsbuildRestartUrlhelper to pass restart URL to notificationsProcessTranscriptQueue.jsfindActiveExecutionForMeeting()— lets RestartProcessing check if a job is already running for a meetingrestartTrigger/restartIddedup path — restart messages use per-click unique ID to prevent Azure Queue redelivery, while still allowing multiple legitimate restartsentrypoint.shon_sigtermchecksCheckCancellationendpoint before sending cancelled notification (avoids mislabelling platform shutdowns as user cancels)exit 0on confirmed user cancel so Container Apps Job status =Succeeded(notFailed), keeping Stopped/Failed/Succeeded states semantically distinctsendNotification.jsrestartUrlin "cancelled" and "failed" notificationscancelUrlin "started" notifications