Skip to content

fix(actor): keep an interrupted first start on effect 4.1.7 - #102

Open
cevr wants to merge 2 commits into
mainfrom
chore/effect-4.1.7
Open

cevr wants to merge 2 commits into
mainfrom
chore/effect-4.1.7

Conversation

@cevr

@cevr cevr commented Dec 1, 2026

Copy link
Copy Markdown
Owner

Bumps the dev and test pins (effect, @effect/atom-react, @effect/atom-solid, root and examples) from 4.0.0 to 4.1.7, the version Bite moves to (biteinc/maitred#22300). It also fixes the one test that fails on the new pin. Do not merge without the owner: this PR changes source and carries a patch changeset, so merging it opens a Version Packages PR.

The failure

test/actor-lifecycle.test.ts › "retains an interrupted first start until the actor is stopped" hangs on effect 4.1.7: it still hangs with a 60 s timeout. On 4.0.0 it passes in under 1 s. With logs: on 4.0.0, a second actor.start after the first start was interrupted returns the first start's interrupt (recovery ran once). On 4.1.7 the second start runs recovery and the startup again (recovery ran twice). The test's recovery never returns, so the second start hangs.

Cause (bisected)

Same test, same source, only the effect pin changed:

effect result
4.0.0 pass
4.0.1 fail
4.0.2, 4.0.3, 4.0.4, 4.0.5, 4.0.6 fail
4.1.7 fail

effect 4.0.1 replaced Effect.cached with makeCachedUnsafe: Effect-TS/effect#8719 (bc44526), "Treat interruption as abandonment in Effect.cached … interrupted results are never cached, and a call made while an abandoned computation is still finalizing starts a fresh one". actor.start was Effect.cached(...) (src/actor.ts), so an interrupted first start is no longer retained.

Fix

start now keeps the first start's exit itself. The first call runs the startup and records its exit, interruption included, in a Deferred. Every later call awaits that exit. This restores the documented contract of ActorRef.start: "The first failure or interruption is retained. Stop that actor and spawn a new actor to retry initialization."

Run locally (effect 4.1.7, under load 40-88 from another session)

  • bun run typecheck, bun run lint, bun run fmt:check: exit 0.
  • Every test/**/*.test.ts file, one per process: all pass except the two below.
  • test/actor-lifecycle.test.ts: 8/8 with the fix. Without the fix it hangs.
  • test/stale-signal.property.test.ts: timed out at 5 s. It also times out on the base under this load, so the timeout is not caused by this change.
  • test/wait-order.test.ts: 34/35. One generated case out of 24,084 ("sendAndWait, with its start racing actor.start", a supervised restart case with time budgets) hung instead of returning ActorStoppedError. The run took 88 s at load above 40. I have not yet rerun it at low load. CI on this PR is the clean signal.

cevr added 2 commits December 1, 2026 03:43
Effect.cached drops an interrupted run since effect 4.0.1 (#8719, bc44526),
so a second actor.start after an interrupted first start ran recovery and the
startup again. The actor now keeps the first start's exit itself.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant