Skip to content

fix(effect): reject actions on a torn-down instance with actor.aborted - #5916

Open
kunalgoesbyken wants to merge 1 commit into
rivet-dev:mainfrom
kunalgoesbyken:fix/effect-missing-instance-aborted
Open

kunalgoesbyken wants to merge 1 commit into
rivet-dev:mainfrom
kunalgoesbyken:fix/effect-missing-instance-aborted

Conversation

@kunalgoesbyken

Copy link
Copy Markdown

Description

Fixes #5891.

  • An action that reaches @rivetkit/effect after onSleep or onDestroy has removed the actor instance, but before the request's abort signal fires, now rejects with actor.aborted instead of a plain Error("actor instance missing").
  • Core no longer turns that lifecycle exit into rivetkit.internal_error (HTTP 500), so clients that retry on actor.aborted recover across graceful worker restarts.
  • The missing-instance branch now matches how the dispatcher already reports interrupted action fibers.
  • Adds dispatcher unit tests for a missing instance with a live signal and with an already aborted signal.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • vitest run src/internal/ActionDispatcher.test.ts: the live-signal case fails on main (expected Error: actor instance missing to be an instance of RivetError) and passes with this change.
  • vitest run src --typecheck: no type errors. Every suite passes except Registry.test.ts, which needs the native NAPI addon I did not build locally and fails the same way on main.
  • test/e2e.test.ts needs a local rivet-engine build and was left to CI.
  • tsc --noEmit in rivetkit-typescript/packages/effect passes.
  • biome check passes on the changed files.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes (except the native-only suites noted above)

An action can reach the dispatcher after onSleep or onDestroy has removed
the actor instance but before the request's abort signal fires. That path
threw a plain Error, which core sanitized into rivetkit.internal_error, so
clients that retry on actor.aborted gave up. Treat a missing instance as
the same lifecycle exit as an interrupted action fiber.

Fixes rivet-dev#5891

This branch has not been deployed

No deployments
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.

effect: action on a missing actor instance fails as internal_error instead of actor.aborted

1 participant