{{ message }}
Repository navigation
Commit 7561e0f
authored
fix(trigger): complete async workflow runs whose failure is already recorded instead of failing them (#9139)
* fix(trigger): complete async workflow runs whose failure is already recorded instead of failing them
Every failed workflow-execution run fires the Trigger.dev error alert, and in
practice those runs are user/workflow errors (missing start block, Function
runtime errors, provider 4xx/5xx) that core already recorded as the run's
failed execution log. The worker meant to rethrow only unrecorded faults, but
it checked wasExecutionFinalizedByCore without awaiting the post-execution
promise that sets the mark, so the check almost never saw it. The webhook
worker already awaited it (#4860); workflow-execution was skipped.
- isRecordedWorkflowFailure awaits post-execution, then checks the mark. The
webhook worker uses it with no behavior change; the schedule worker uses it
so it no longer races core's completion (its caller swallows either way).
- workflow-execution completes with { success: false, error } for a recorded
failure, and for non-retryable 402/403/404/429 preprocessing rejections
(deleted or undeployed workflow, suspended account, exhausted quota) after
the same log write as before. Timeouts, unrecorded errors, retryable
rejections, and 5xx still fail the job. Trigger retries are maxAttempts 1
and the database runner never retries, so no retry semantics change.
- Both queue backends' getJob read a completed workflow-execution job carrying
that result as failed, with the same error and output (undefined on Trigger,
null in the database) the thrown run had, so /api/jobs, the SDKs, and the v2
run-status queue fallback are unchanged.
resume-execution is left throwing: executeResumeJob is also called inline by
the resume poller and enqueue path, which rely on the throw.
* fix(trigger): bound recorded workflow failure errors in UTF-8 bytes
The previous character cap did not bound bytes against Trigger.dev's 128 KiB
output offload threshold. Cap the error at 16 KiB of UTF-8, cut at a code point
boundary, so even sixfold JSON escaping stays inline; normal-size messages are
returned unchanged. Correct the comment: runs.retrieve resolves offloaded
outputs itself, and only a failed presigned fetch leaves the output missing.
Drop an unconsumed waitForPostExecution mock from the timeout test.
* chore(audits): shrink the unused-exports baseline for PreprocessExecutionError
* fix(trigger): keep alerting on deadline-passed and unlogged async workflow failures
Re-check the deadline after awaiting core's finalization, since that wait can
outlast it, so a timed-out run still fails its job. Complete a non-fault
preprocessing rejection only when the logging session confirms the failure
row was written (hasCompleted, the same signal core uses to mark a failure
finalized); otherwise throw as before so an unsaved rejection still alerts.
* refactor(trigger): share the recorded-failure completion and skip the redundant error write on a timed-out recorded failure1 parent 854dc6a commit 7561e0f
11 files changed
Lines changed: 397 additions & 56 deletions
File tree
- apps/sim
- background
- lib
- core/async-jobs
- backends
- workflows/executor
- scripts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
| 37 | + | |
41 | 38 | | |
| 39 | + | |
42 | 40 | | |
43 | 41 | | |
44 | 42 | | |
| |||
730 | 728 | | |
731 | 729 | | |
732 | 730 | | |
733 | | - | |
| 731 | + | |
734 | 732 | | |
735 | 733 | | |
736 | 734 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
78 | 77 | | |
79 | 78 | | |
| 79 | + | |
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| |||
1277 | 1277 | | |
1278 | 1278 | | |
1279 | 1279 | | |
1280 | | - | |
1281 | | - | |
1282 | | - | |
1283 | | - | |
1284 | 1280 | | |
1285 | 1281 | | |
1286 | 1282 | | |
1287 | 1283 | | |
1288 | | - | |
| 1284 | + | |
1289 | 1285 | | |
1290 | 1286 | | |
1291 | 1287 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
| |||
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
| |||
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
30 | | - | |
| 32 | + | |
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
| 36 | + | |
38 | 37 | | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
107 | 129 | | |
108 | 130 | | |
109 | 131 | | |
| |||
194 | 216 | | |
195 | 217 | | |
196 | 218 | | |
| 219 | + | |
197 | 220 | | |
198 | 221 | | |
199 | 222 | | |
| |||
217 | 240 | | |
218 | 241 | | |
219 | 242 | | |
| 243 | + | |
220 | 244 | | |
221 | 245 | | |
222 | 246 | | |
| |||
314 | 338 | | |
315 | 339 | | |
316 | 340 | | |
317 | | - | |
318 | | - | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
319 | 346 | | |
320 | 347 | | |
321 | 348 | | |
| |||
332 | 359 | | |
333 | 360 | | |
334 | 361 | | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
335 | 371 | | |
336 | 372 | | |
337 | 373 | | |
| |||

0 commit comments