Skip to content

[Bug] Typed Behaviors.supervise ignores the strategy's restart budget and breaks on nesting #638

Description

@pathosDev

Problem

TypedActor.handleSupervise calls supervise.strategy.decider(err) and, on Restart, immediately re-resolves supervise.child (src/typed/TypedActor.ts:161-179). SupervisorStrategy.maxRetries / withinTimeRangeMs (src/Supervision.ts:16-23) are never consulted — so Behaviors.supervise(b).onFailure(new OneForOneStrategy(…, { maxRetries: 3 })) restarts forever. The OO path honors the budget (ActorCell.registerRestart, src/internal/ActorCell.ts:1034-1043).

Additionally, activeSupervise (line 50) is a single field set as a side effect of resolve() and never cleared: a nested or second supervise silently replaces the outer one, and a behavior transition out of the supervised subtree keeps the stale strategy.

Proposed behaviour

Reuse the same sliding-window restart budget as ActorCell.registerRestart; escalate (rethrow) past the limit. Define and implement nesting semantics for supervise.

Acceptance criteria

  • A supervised behavior that always throws stops after maxRetries restarts within the window.
  • Nested supervise has documented, tested semantics.

Related: #533 (typed API surface)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority: mediumUseful, not urgentproduction-goalBlocks or defines the path to production readiness

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions