Skip to content

feat(core): own startup, shutdown, and cancellation #3160

Open
0 of 1 issue completed
Open

Description

@ananthsub

Priority

Wave 1 — local lifecycle correctness. Live progress presentation is a separate #2831/#2859 workstream.

Problem

Local startup and shutdown do not share one bounded ownership boundary. Readiness can wait indefinitely, startup failure can bypass cleanup, shutdown uses per-process waits without one total deadline, and cancellation may be converted into an HTTP 500.

Essential scope

  • Transactional RunHelper acquisition: record each resource immediately and unwind everything acquired before startup failure.
  • Finite overall deadlines for head readiness, component readiness, configured endpoint readiness, cancellation cleanup, and shutdown.
  • Idempotent shutdown.
  • Start commands in process groups or another explicit descendant-ownership mechanism.
  • Signal, wait, escalate, reap, and continue cleaning other components within one total shutdown budget.
  • Re-raise CancelledError, KeyboardInterrupt, and SystemExit after bounded cleanup rather than converting them to ordinary HTTP failures.
  • Report unresolved remote cleanup when feat(core): define resources-session identity and close protocol #2609/feat(resources): add session TTL and lifecycle adoption #3037 data exists without claiming local process exit released it.

Moved or deferred scope

Dependencies

No hard dependency for local correctness. #144 depends on the durable process ownership and shutdown API established here. #2859 later consumes stable progress and identity APIs without blocking this issue.

Acceptance criteria

  • Fault injection after each startup stage releases every earlier acquisition.
  • Every readiness stage has one finite overall deadline and identifies the failed component.
  • Shutdown is idempotent and terminates owned descendants within one configured deadline.
  • Cancellation propagates after bounded cleanup and is not converted to HTTP 500.
  • Cleanup continues when one owned component does not exit.
  • Remote cleanup remains a separately reported state when available.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions