Skip to content

Release: worker@1.22.1 cli@1.30.3#1314

Merged
josephjclark merged 4 commits intomainfrom
release/next
Mar 17, 2026
Merged

Release: worker@1.22.1 cli@1.30.3#1314
josephjclark merged 4 commits intomainfrom
release/next

Conversation

@josephjclark
Copy link
Collaborator

  • Fix worker crash on compile error (eek!)
  • on compile error, use step name in output
  • on lazy state error, return a position and better messaging

…ng (#1311)

* fix(ws-worker): remove async promise antipattern in run-log.ts

The non-batch log path wrapped an async function in `new Promise(async
(resolve) => { ... })`. If sendEvent rejected (e.g. channel timeout),
the outer Promise never settled and the rejection was unhandled. This
was the direct cause of the worker crash: LightningTimeoutError on
run:log became an uncaught exception that killed the container.

The function is already async so the wrapper was unnecessary — replaced
with a plain for-loop that properly propagates rejections.

* fix(ws-worker): remove async promise antipattern in try-with-backoff.ts

Same `new Promise(async ...)` antipattern as run-log.ts. If the
isCancelled callback or any other code in the catch block threw, the
error became an unhandled rejection instead of propagating to the
caller.

Replaced with an inner async function that returns its promise
directly. setTimeout retry replaced with awaited promise to keep the
flow async-native.

* fix(ws-worker): remove async promise antipattern in destroy.ts

Same `new Promise(async (resolve) => { ... })` pattern — if
engine.destroy() or waitForRunsAndClaims rejected, the outer promise
never settled. Replaced with an async IIFE so errors propagate through
Promise.all to the caller.

* fix(engine-multi): emit compilation log before workflow-error

During a compilation failure, engine-multi emitted WORKFLOW_ERROR
(from the worker:error handler) before the "Error occurred during
compilation" WORKFLOW_LOG (from the .catch handler). The ws-worker
tears down the channel on WORKFLOW_ERROR, so the subsequent log push
had nowhere to go — triggering the LightningTimeoutError that crashed
the container.

Moved the compilation log into the worker:error handler so it emits
before the error event. Guarded the .catch handler's log with
!didError to avoid duplication. Added COMPILE_START/COMPLETE events
to mock-run.ts to match real worker behavior.

* chore: add changesets for worker crash fixes

* chore: exclude engine-multi tmp from pnpm workspace

Test fixture directories under packages/engine-multi/tmp/ were being
picked up as workspace packages by the packages/** glob, pulling in
phantom dependencies (ava@6.x and its full transitive tree) that
caused persistent lockfile churn.

* remove duplicate log, tidy types

* update changelogs

* tidy test

* revert diff on destroy

* keep destroy change after all and fix test

* relax runtime test

it just went flaky

---------

Co-authored-by: Joe Clark <jclark@openfn.org>
@josephjclark josephjclark marked this pull request as draft March 17, 2026 15:47
@github-project-automation github-project-automation bot moved this to New Issues in Core Mar 17, 2026
josephjclark and others added 3 commits March 17, 2026 16:40
* engine: report compile errors with step name, not id

* changeset

* remove debug code
* compiler: improve error messages for lazy state

* compiler: report position on lazy state reporting

* update extra errors

* update changeset

* types
@josephjclark josephjclark changed the title next release Release: worker@1.22.1 cli@1.30.3 Mar 17, 2026
@josephjclark josephjclark marked this pull request as ready for review March 17, 2026 16:54
@josephjclark josephjclark merged commit 28ebecc into main Mar 17, 2026
6 checks passed
@github-project-automation github-project-automation bot moved this from New Issues to Done in Core Mar 17, 2026
@josephjclark josephjclark deleted the release/next branch March 17, 2026 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants