Title: fix(background): recategorize user/recovery failures as errors, not trigger faults by TheodoreSpeaks · Pull Request #4860 · simstudioai/sim · GitHub
Open Graph Title: fix(background): recategorize user/recovery failures as errors, not trigger faults by TheodoreSpeaks · Pull Request #4860 · simstudioai/sim
X Title: fix(background): recategorize user/recovery failures as errors, not trigger faults by TheodoreSpeaks · Pull Request #4860 · simstudioai/sim
Description: Problem #eng-errors is flooded with webhook-execution trigger.dev run failures, and a trickle of schedule-execution ones. The errors are almost all things that shouldn't fault a background job: Webhook — user-caused workflow failures, already recorded in the user's execution logs: Gmail 2 is missing required fields: Label (serializer validation) Knowledge 2: "semantic_query" doesn't exist on block "restructure" (invalid field reference) Firecrawl 1: Invalid URL, Router 1: Invalid request body, provider 401/400/404, etc. Schedule — a secondary DB failure during error recovery (e.g. a transient blip while releasing the claim), which double-faults during cleanup. webhook-execution re-threw every error; with maxAttempts: 1 any throw marks the run failed and alerts — even for a user/workflow problem. schedule-execution already treats workflow failures as recorded errors (not faults), but its outermost catch's own recovery code was unguarded, so a cleanup-write failure escaped run(). Changes webhook-execution.ts — fault vs error await loggingSession.waitForPostExecution() before reading the finalized flag (set inside a fire-and-forget post-execution promise; the read must be reliable once branches diverge). Finalized by core (workflow ran, failure already in execution logs = user/workflow error) → return { success: false, ... }; the run completes, no alert. Not finalized (error from the webhook pipeline itself) → record and re-throw to fault the run, preserving alerting on genuine problems. Every error in the logs is thrown from inside executeWorkflowCore (serializer validation at execution-core.ts:474, or block/provider failures via the DAG executor), which force-starts logging and finalizes before re-throwing — so they're all finalized-by-core and stop faulting. Verified against prod run run_cmpwquraf4tb60iogze9dg1fr. schedule-execution.ts — guard the recovery path The outermost catch already turns workflow failures into schedule-state updates without faulting. Its own recovery calls (infra-retry, releaseClaim) were unguarded — wrap them in a try/catch that logs and records the exception on the span without re-throwing. The claim expires on its TTL and the next tick re-claims the schedule, so swallowing a cleanup-write failure is safe. Both — keep investigability The exception is recorded on the run's OTel span via recordException (no ERROR status, so it doesn't fault the run) so these stay visible in Tempo; they also remain in the execution logs and logger.error → Loki. Notes / risk No retry behavior changes — webhook-execution is maxAttempts: 1, so nothing was ever retried; only the run's final status changes (FAILED → COMPLETED). Schedule's recovery swallow is also safe (TTL + next tick). Webhook idempotency marker flips failed→completed; since webhookIdempotency is retryFailures: false, this reduces alerts (duplicate deliveries of a failed webhook previously re-threw and re-faulted). The one genuine tradeoff: a real in-core bug now shows as a completed run instead of failed — but it stays fully investigable via execution logs + the recorded span exception (Tempo) + logger.error (Loki). The knowledge knowledge-process-document task (maxAttempts: 3, Unsupported fileUrl scheme user error) is a separate follow-up. Test plan bun run test background/webhook-execution.test.ts — added cases: finalized → resolves { success: false } + records span exception; non-finalized → throws + logs. bun run type-check — clean. bun run lint:check — clean (2 warnings are pre-existing in untouched service.ts). Prod sanity check via trigger MCP. 🤖 Generated with Claude Code
Open Graph Description: Problem #eng-errors is flooded with webhook-execution trigger.dev run failures, and a trickle of schedule-execution ones. The errors are almost all things that shouldn't fault a background job:...
X Description: Problem #eng-errors is flooded with webhook-execution trigger.dev run failures, and a trickle of schedule-execution ones. The errors are almost all things that shouldn't fault a background ...
Opengraph URL: https://github.com/simstudioai/sim/pull/4860
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:57ffb90e-24dc-a80e-ab75-dfab8187a80b |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | CA18:47529:8AD44C:C4E634:6AFB509E |
| html-safe-nonce | d3695f59b92b08a99cf9cdc6f48d517099765133307ca9ef2a5cf8d2946244f7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQTE4OjQ3NTI5OjhBRDQ0QzpDNEU2MzQ6NkFGQjUwOUUiLCJ2aXNpdG9yX2lkIjoiNjM4MDk2NDYzOTYzNTc0NDMwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 79c1ac7cc894bf4416d63c09f32966b4751eccd7c4424ceecedf1bf3ae0916bb |
| hovercard-subject-tag | pull_request:3792514778 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/4860/files |
| twitter:image | https://avatars.githubusercontent.com/u/19564703?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/19564703?s=400&v=4 |
| og:image:alt | Problem #eng-errors is flooded with webhook-execution trigger.dev run failures, and a trickle of schedule-execution ones. The errors are almost all things that shouldn't fault a background job:... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7122bb414b542dba14d71a3f0b9f6fd2abce715b9f5912d082800563e6c806d1 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/simstudioai/sim git https://github.com/simstudioai/sim.git |
| octolytics-dimension-user_id | 199344406 |
| octolytics-dimension-user_login | simstudioai |
| octolytics-dimension-repository_id | 912559512 |
| octolytics-dimension-repository_nwo | simstudioai/sim |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 912559512 |
| octolytics-dimension-repository_network_root_nwo | simstudioai/sim |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | cbf66c024bb6d10e6955baa7413c54cf13a201bb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width