Files
orca/src/main/ipc
OrcaWinandm4air 6b36e4f85b feat(relay): await owned watcher and agent children on shutdown (#16741 T2 P1) (#24400)
* feat(relay): await owned watcher and agent children on shutdown (#16741 T2 P1)

Relay shutdown and the runtime watcher pool now wait for the child processes
they own to physically exit instead of only signalling them:

- WatcherProcessSupervisor tracks launched children and exposes
  disposeAndWait; RuntimeWatcherProcessPool retires slots through
  RuntimeWatcherDisposalOwners, which retries failed disposals.
- The relay watch registry fences new watches once disposed and joins
  in-flight native unsubscribes; FsHandler.disposeWatchers awaits it.
- AgentExecHandler tracks spawned agent children until they close, so a
  request timeout is no longer taken as proof the child is gone.
- RelayRuntimeServices.disposeOwnedProcesses awaits both, alongside the
  existing stream drains; a failure defers shutdown for the grace retry.

Ported by hunk from #16741 (a68b6f3531). Relay-bundled code avoids
Promise.withResolvers for the Node 18 floor.

* fix(relay): bound agent close on shutdown and send one graceful watcher signal

AgentExecHandler.dispose() now waits at most RELAY_AGENT_CLOSE_DEADLINE_MS for
killed agent trees to close and then rejects with
relay_agent_execution_shutdown_incomplete, so the relay grace lifecycle defers
and retries instead of hanging. A retry re-checks close without signalling a
tree it already killed.

The supervisor's dispose now marks the graceful signal it sends, so an awaited
termination of the same watcher child only escalates to SIGKILL and waits.

* fix(relay): give the watcher teardown join a promise for every root

TeardownTracker.join answers undefined for a root with nothing in flight; the
type-aware await-thenable rule rejects a promise aggregator over those values.

* test(relay): drop type assertions from the shutdown test fixtures

* fix(watcher): take the child process type from the shared child-process boundary

---------

Co-authored-by: m4air <m4air@m4airs-Air.localdomain>
2026-10-01 10:39:16 -07:00
..
2026-08-25 03:58:48 -07:00
2026-08-26 09:50:12 -07:00
2026-07-12 23:19:15 -07:00
2026-08-29 14:13:35 -07:00