Skip to content

Adopt JoinSet supervision in JobManager #1586

Description

@josecelano

Goal

Adopt tokio::task::JoinSet for JobManager so the application directly owns its named top-level component tasks, observes their completion concurrently, and applies explicit cooperative-cancellation and escalation policies.

The detailed, versioned implementation specification is maintained in docs/issues/open/1586-evaluate-job-manager-join-set/ISSUE.md.

Context

The shutdown architecture for parent EPIC #1488 is finalized: JobManager supervises direct named top-level components under a root CancellationToken; each component owns and completes or deliberately aborts its own child tasks. This issue implements only the supervisor layer.

Required design

  • Register direct component futures through a spawn(name, future) API. Do not accept already-spawned JoinHandles or add wrapper tasks that only await them.
  • Keep component names associated with every completion, failure, panic, cancellation, timeout, and deliberate-abort outcome.
  • After cancellation is requested, observe all direct components concurrently under one process-wide deadline, rather than applying a timeout sequentially per component.
  • On deadline expiry, deliberately abort every remaining direct component, join it, and report a named abnormal outcome. No component may be silently detached.
  • Do not flatten component-owned child tasks into JobManager; each component retains its lifecycle responsibility for those children.

Acceptance criteria

  • JobManager directly owns its top-level component tasks through JoinSet and has no wrapper around an already-spawned handle.
  • The direct registration API and all application callers use spawn(name, future).
  • Supervisor outcomes retain component names and distinguish normal completion, failure, panic, cooperative cancellation, deadline expiry, and deliberate abort as supported by the component contract.
  • The supervisor uses a single concurrent overall deadline.
  • Remaining direct components are deliberately aborted and joined after deadline expiry.
  • Deterministic focused tests cover completion order, panic/failure, cooperative cancellation, deadline expiry, escalation, and retained names.
  • linter all passes.

Scope boundary and rollback

This issue does not migrate individual components to token cancellation; those vertical slices remain separately sequenced #1488 work items. A coherent revert restores the prior supervisor implementation without changing component-owned child lifecycles.

Activity

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

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions