Skip to content

Commit d03cd17

Browse files
committed
fix(orchestrator-core): pin environment host across prepare/exec/teardown
Environment plugins are stateful across the three-call contract: prepare registers an in-memory run (e.g. a live WS relay to a remote node) that exec/exec_stream/teardown reuse by handle. The previous per-call resident-host lease dropped between calls, letting the shared registry LRU-evict or ping-reap the process between prepare and exec — losing that state and surfacing as "no live relay connection for handle". EnvironmentClient now holds ONE ResidentHostLease for its lifetime (acquired lazily on the first RPC via pinned_host), so every RPC lands on the same pinned process. The client is now non-Clone (callers Arc it) so the single lease is not duplicated. Death handling splits by call kind: exec/exec_stream stay at-most-once (no retry — side effects + lost state), while the idempotent control ops prepare/teardown retry once. Either way a dead lease is reaped generation-scoped (drop from the client + invalidate the exact generation in the registry) so the next run spawns a live process instead of re-leasing the corpse, and a concurrent call's fresh lease is never evicted by a late failure of an older generation. Removes the now-unused with_resident_host / with_resident_host_once / ping_is_dead helpers and their ping tests.
1 parent b39a08a commit d03cd17

1 file changed

Lines changed: 207 additions & 226 deletions

File tree

0 commit comments

Comments
 (0)