Repository navigation
fix(automations): record failure reason on failed automation runs - #4343
Merged
Merged
Conversation
tlgimenes
force-pushed
the
fix/automation-failure-reason
branch
2 times, most recently
from
July 6, 2026 21:23
e83a861 to
87a482d
Compare
Automation runs that fail (including the 5-minute timeout abort) were marked
`status='failed'` with `failure_reason`/`failure_kind` left NULL, so the UI
showed a reason-less "errored" with no explanation.
Root cause: `AutomationsStorage.markRunFailed(taskId)` set only the status, and
`fireAutomationWorkflow` computed the error message (`runError`) but discarded
it when calling `markRunFailedStep`.
Changes:
- `markRunFailed(taskId, reason?, kind?)` now persists `failure_reason` /
`failure_kind` when provided (never clobbers an existing reason with null).
- `fireAutomationWorkflow` passes the reason + a kind at all three failure
sites: setup (`"setup"`), permanent dispatch error (`"permanent"`), and
transient error (`"error"`).
- The opt-in run-timeout now aborts with a descriptive reason
("Run exceeded its 5m time limit and was aborted") instead of a bare abort,
so a timeout surfaces as a legible error that flows into failure_reason.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
tlgimenes
force-pushed
the
fix/automation-failure-reason
branch
from
July 6, 2026 21:27
87a482d to
616c4dd
Compare
decocms Bot
pushed a commit
that referenced
this pull request
Jul 6, 2026
PR: #4343 fix(automations): record failure reason on failed automation runs Bump type: patch - decocms (apps/mesh/package.json): 3.100.0 -> 3.100.1 Deploy-Scope: server
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.
Problem
Automation runs that fail — including the 5-minute timeout abort — were marked
status = 'failed'withfailure_reasonandfailure_kindleft NULL. The UI then shows a reason-less "errored" with no explanation.Found while investigating a real prod thread (
thrd_J5cKVKyrKLyEHM-Dc3wT7, Deco org): an automation fire ran for exactly 5:00 and was aborted byAUTOMATIONS_RUN_TIMEOUT_MSmid-run (task 1 of a 17-task commerce-discovery workflow). The DBOShostedHarnessWorkflowrecordedSUCCESS(a timeout abort is a clean cancellation), but the thread showed a bare "failed" with no reason.Root cause
AutomationsStorage.markRunFailed(taskId)(storage/automations.ts) set onlystatus: 'failed'— neverfailure_reason/failure_kind(the columns exist and are used elsewhere).fireAutomationWorkflowalready computes the error message (runError) and even classifies permanent vs transient — but discarded it when callingmarkRunFailedStep(taskId).Changes (small, contained)
markRunFailed(taskId, reason?, kind?)now persistsfailure_reason/failure_kindwhen provided. It only sets them when non-null, so it never clobbers an existing reason.fireAutomationWorkflowpasses the reason + akindat all three failure sites:kind: "setup"(reason =built.reason)kind: "permanent"(reason =runError)kind: "error"(reason =runError)abortController.abort(new Error("Run exceeded its 5m time limit and was aborted"))instead of a bareabort(), so a timeout surfaces as a legible error that flows intofailure_reason(and logs), rather than a generic abort.Net effect: a timed-out or otherwise-failed automation now shows why it failed instead of a mystery error.
Testing
tsc --noEmitclean for the changed files;bun run fmtclean.markRunFailedchange is DB I/O (e2e tier perTESTING.md, not unit). The behavior is a straightforward column write; happy to add an e2e assertion onfailure_reasonif you'd like.Notes / possible follow-ups
🤖 Generated with Claude Code
Summary by cubic
Record and surface
failure_reasonandfailure_kindfor failed automation runs, including timeout aborts, so the UI shows a clear failure reason instead of a blank "errored".markRunFailed(taskId, reason?, kind?)now persistsfailure_reason/failure_kindwhen provided (never overwrites with null).fireAutomationWorkflowpasses reason/kind for all failure paths: setup ("setup"), permanent ("permanent"), transient ("error").failure_reason.Written for commit 616c4dd. Summary will update on new commits.