Skip to content

state: an InvokeActor with no onError fires the zero event at the parent instead of escalating #250

Open

Description

@reka18

What happens

When an InvokeActor actor with no WithInvokeOnError can't start, or fails after it ran, the actor system fires the zero event at the parent. state/doc.go's v1 section says a child failure with no onError declared escalates to the parent (the G3 default), and a Spawn with none does. WithInvokeOnError's godoc says the zero event is fired, so the two docs disagree.

Why it matters for durable

Recover retries a spawn that failed with nothing declared to catch it, and leaves alone one whose declared onError was refused, for example by a guard. With the zero event fired, durable can only tell the two apart by whether the parent refused it as having no transition (errors.Is(err, state.ErrNoTransition), added in #234), which is a stopgap. That gets these wrong:

  • a declared onError the parent's current state has no transition for is retried;
  • a wildcard (OnAny) or a forbid (ForbidAny) that takes the zero event, or a transition declared on it, counts as caught, so the spawn isn't retried.

A host that consumes SpawnActor effects and reads OnError sees the zero event, not "none declared".

Options tried in #234 and reverted

  • escalate when no onError was declared, with SpawnActor.OnError nil, as for a Spawn; it passed every scenario test, but it changes the routing v1 documents;
  • an additive flag saying whether an onError was declared.

Tests: #234 adds skipped tests: TestSpawnRule_DeclaredOnErrorWithNoTransitionIsDone, TestRecover_RetriesANoOnErrorSpawnEvenWhenTheZeroEventHasATransition and TestRecover_RetriesANoOnErrorSpawnAWildcardSwallowed.

Relates to: #214, #234

Activity

  1. reka18 commented on Nov 24, 2026

    @reka18
    ContributorAuthor

    #268 (27ad55e) fixes the main case here. An invocation now carries explicit flags for what it declared: Invocation.HasOnDone/HasOnError, carried to SpawnActor.HasDone/HasError. So an InvokeActor with no WithInvokeOnError escalates its failure to the parent, as a Spawn does, instead of firing the zero event.

    Two of the skipped tests from #234 now pass and are unskipped, in durable/spawn_zero_event_test.go:

    • TestRecover_RetriesANoOnErrorSpawnEvenWhenTheZeroEventHasATransition
    • TestRecover_RetriesANoOnErrorSpawnAWildcardSwallowed

    One case is still open, so I'm leaving this issue open for it. A declared onError that the parent's current state has no transition for is still retried. Durable tells it apart from a handled onError only by the ErrNoTransition refusal, the stopgap at durable/runner.go:931. TestSpawnRule_DeclaredOnErrorWithNoTransitionIsDone stays skipped, with its reason narrowed to that case. The has-onError flag gives durable what it needs to drop the stopgap in a follow-up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions