ReviewOS

home-lang/home

Worker termination: preserve exit semantics and queued-task cancellation

#599
Closed chris opened this 10 days ago ·
10 days ago

Scope

Port the worker-termination boundaries needed by the unchanged pinned Bun corpus at 4982b91e3702094330f3be3883354c52b8c01323:

  • preserve Bun's post-exit Worker.terminate() distinction (undefined after exit code 0, cached nonzero code otherwise) without hanging on a late close listener
  • distinguish JSC termination exceptions from ordinary JavaScript exceptions in TopExceptionScope
  • prevent queued Immediate callbacks from running after script execution has stopped
  • promote the exact 12-file Node parallel worker-termination script matrix to native corpus execution
  • make captured corpus children use the current Debug/ReleaseSafe/ReleaseSmall/ReleaseFast artifact instead of falling back to a stale installed binary

Acceptance

  • dedicated terminate-after-exit regression passes in Debug and ReleaseSafe
  • new 12-file script matrix passes 12/12 in Debug and ReleaseSafe
  • aggregate 28-file worker corpus passes 276 assertions, 4 upstream TODO/skips, 0 failures, 0 unsupported in ReleaseSafe
  • no upstream fixture, assertion, workload, timeout, or deadline changes

Implementation is ready locally; this issue will be closed by the pushed commit.

10 days ago

Landed on main in 01d4636eb338707c2d456c013ab05cd1e074d9f1, authored and committed by Chris Breuer with no coauthors.

The implementation restores the real termination boundary rather than special-casing fixtures: zero-exit Worker.terminate() settles to undefined after close while nonzero exits retain their code; concurrent termination calls retain one promise; TopExceptionScope uses JSC termination identity; queued Immediate callbacks stop once script execution stops; and captured corpus runs retain the currently executing Home build flavor.

Verification at Bun pin 4982b91e3:

  • Debug and ReleaseSafe builds pass.
  • Dedicated terminate-after-exit regression passes in both builds.
  • Exact new Node parallel termination matrix: 12 files / 12 pass / 0 fail / 0 unsupported / 0 TODO in both builds.
  • Aggregate native worker corpus in ReleaseSafe: 28 files / 276 pass / 4 upstream TODO/skips / 0 fail / 0 unsupported.
  • Stable runtime units: 1,816 pass / 19 skip / 0 fail.
  • Pickier: 0 errors (one pre-existing quote-style warning); Zig format and diff checks pass.

No upstream corpus source, assertion, workload, timeout, or deadline changed.

Sign in to comment on this issue.