wacrm/src/app
Arnas Donauskas 59dbf27f43 fix(automations): stop inbound runs being dropped and mislogged
Two defects that together produce the reported symptom — automation logs
that read `status: 'success'` with `steps_executed: []`.

1. The dispatch loop in the inbound webhook was fire-and-forget inside the
   route's `after()` block. `after()` only keeps the function alive for
   promises it can see, so the run could be frozen after the log row was
   inserted but before any step executed. This is the same failure mode as
   issue #301, recurring one level down — the comments on the AI auto-reply
   and `message.received` dispatches immediately below already spell out
   the invariant this violated. Now awaited; the per-iteration `.catch` is
   kept so one trigger type can't skip the rest of the loop.

2. `executeAutomation` seeded the log row with `status: 'success'` before
   running anything. A run that died mid-flight therefore left a permanent
   success with no steps, indistinguishable from an automation that
   genuinely had nothing to do. Seeded as `'failed'` instead, so the status
   only becomes success if execution actually reaches a terminal path. No
   migration needed — 'failed' is already in the column's CHECK constraint,
   and every terminal path overwrites it.

Two more points from the issue are deliberately not addressed here, as
both change existing behaviour and want a maintainer decision: switching
`contains` keyword matching to word boundaries (would alter which
automations fire for current users) and re-opening a closed conversation
on an inbound reply.

Refs #409.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-28 15:21:28 +03:00
..
(auth) fix: full-page navigation after login so the session is applied (#365) 2026-07-17 12:29:01 +03:00
(dashboard) fix(settings): wrap useSearchParams pages in Suspense so nav works in prod 2026-07-17 15:08:25 +03:00
api fix(automations): stop inbound runs being dropped and mislogged 2026-07-28 15:21:28 +03:00
join feat(theme): add light/dark mode toggle (#243) 2026-06-16 17:29:46 +03:00
globals.css feat(settings): redesign Settings into a grouped rail + Overview landing 2026-06-18 15:08:33 +03:00
icon.tsx feat(theme): sweep remaining violet-* → primary across all surfaces 2026-05-22 17:00:32 +03:00
layout.tsx feat: add fallback logic for missing locale dictionaries and update NextIntlClientProvider configuration 2026-07-02 08:42:37 -04:00
page.tsx Revert "feat(i18n): re-attempt next-intl with hardened artifact tracing" 2026-05-31 21:05:34 +03:00