✗ bug (wrong)
✓ medium (correct)
escalate: noSummary
A custom beforeAcceptTask Action override in the customer's Flex plugin intermittently causes task acceptance to silently fail, resulting in reservation timeouts for a small percentage of acceptances.
Suggested first response
Thank you for the detailed write-up — this is very helpful context. The pattern you're describing (acceptance silently stopping only when the beforeAcceptTask override is active, with no visible UI error) is consistent with an Action chain not resolving or rejecting cleanly inside the override, which causes Flex to stall rather than proceed or surface an error.
The key thing to be aware of with beforeAcceptTask (and Action overrides generally) is that Flex expects the override function to either resolve or reject its promise reliably every time. If the promise returned by your override hangs — for example, because invokeAction itself returns a promise that doesn't settle under certain race or timing conditions — Flex will not proceed with the acceptance, and the reservation will eventually time out back to the queue, which matches what you're seeing.
A few things to check and try:
1. Wrap your invokeAction call in a try/catch (or .catch()) and ensure any rejection is explicitly re-thrown or handled — an unhandled rejection inside an override can silently swallow the action chain.
2. Add a timeout/fallback so that if the inner invokeAction call does not settle within a reasonable window (e.g. 5 seconds), you either reject explicitly or allow the action to proceed without the attribute stamping, rather than hanging indefinitely.
3. Avoid calling Flex.Actions.invokeAction('AcceptTask') or similar nested invocations inside beforeAcceptTask if that is what you are doing — invoking the same action recursively inside its own before-hook is a known source of infinite loops or deadlocks in the Flex action framework. The recommended pattern for attribute stamping before acceptance is to perform your async work (e.g. a TaskRouter Task attribute update via the REST API or a Twilio Function) and then resolve the override promise, letting Flex complete the original AcceptTask action naturally.
4. Add console logging at the entry and exit of your override (including the catch path) so you can correlate a Status Report from an affected session with exactly where the override stalled.
Could you share a Status Report export from an affected agent session (captured immediately after a stuck acceptance)? That will show us whether a 45601 error or an unhandled promise rejection is being recorded at the time of the failure, and will help us pinpoint whether this is purely in the plugin layer or if there is any underlying platform signal. Workspace SID and TaskQueue SID noted — we may also want to pull the specific Reservation SID for a failed acceptance to check the TaskRouter event stream on our end.
KB citations
kb-007, kb-008
659 output tokens · 17.8s · 1 attempt(s)