# Every task needs an owner

Principle `every-task-needs-an-owner`. Give child work a lifetime, a failure observer, and a recovery decision.

Also searched as: structured concurrency, task ownership.

Managed worker abstractions make lifecycle policy visible. A task that escapes its owner also escapes that owner’s shutdown and failure handling.

> Elixir can’t manage what it doesn’t know about.

Source: [Q04](/bibliography#q04); [B3](/bibliography#b3-designing-elixir-systems-with-otp).

## Failure it prevents

A request returns but unobserved child work fails or holds resources indefinitely.

## Our Effect 4.0.5 reading

Effect.forkScoped and FiberSet attach work to a Scope. Effect.forkDetach detaches parent lifetime, not runtime mortality. Add recovery policy separately.

Source: `packages/effect/src/Effect.ts`, `packages/effect/src/Scope.ts`, `packages/effect/src/FiberSet.ts`.

## How to check

Interrupt the owner. Verify child completion or interruption, resource release, and the reported outcome. This is our proposed verification, not a quoted procedure.

Continue with [Supervision chooses what restarts](/principles/supervision-is-a-recovery-policy), [Durable work needs storage](/principles/durable-work-needs-storage).

Connect this to [the existing rat-stack guidance](https://ratstack.sh/lore/concurrent-work-needs-an-owner).

Use [the durability skill](/skills/durability) for the full review. Return to [the durability index](/principles/durability).

## Skills
- [Durability starts with a recovery record](/principles/durability)

## Sources
- Gray II, James Edward; Tate, Bruce A. *Designing Elixir Systems with OTP*. Pragmatic Bookshelf, 2019. [Link](https://pragprog.com/titles/jgotp/designing-elixir-systems-with-otp/). ([b3-designing-elixir-systems-with-otp](/bibliography#b3-designing-elixir-systems-with-otp))

## References
- [Effect contributors. Effect 4.0.5. Effect.ts](https://github.com/Effect-TS/effect/blob/7f524e25cfb49a71ac39b0f44278d08d40dda5de/packages/effect/src/Effect.ts). Pinned source for our Effect mapping, not a claim from the book.
- [Effect contributors. Effect 4.0.5. Scope.ts](https://github.com/Effect-TS/effect/blob/7f524e25cfb49a71ac39b0f44278d08d40dda5de/packages/effect/src/Scope.ts). Pinned source for our Effect mapping, not a claim from the book.
- [Effect contributors. Effect 4.0.5. FiberSet.ts](https://github.com/Effect-TS/effect/blob/7f524e25cfb49a71ac39b0f44278d08d40dda5de/packages/effect/src/FiberSet.ts). Pinned source for our Effect mapping, not a claim from the book.
