Group of 5 You'll notice
No documentation found
Worker and session-client shutdown logic now distinguishes running 'hosted' inside another process from owning the process outright
What
- Hooks-worker and CCR worker registration now branches on a
kindofowns-processvshosted. Inhostedmode, a registration failure or epoch-mismatch stops the session gracefully — with a mapped close code/reason such aslease-supersededorauth-rejected— instead of exiting the process; shutdown-cleanup and process-exit hooks are only registered forowns-process. - The CCR worker's init logic follows the same split: the
owns-processpath exits the process on registration failure and registers its own shutdown cleanup, while the newhostedpath callsstopFor(...)with a structured reason (e.g.registration-failed, with an HTTP status and close code4091) instead of killing the process, and adds an epoch-mismatch handler mapping close codes4090/4094tolease-superseded/auth-rejected. - The telemetry/session client's cleanup logic was refactored from an inline constructor closure into explicit
beginShutdown()/finishShutdown()methods, plus newgoodbye(),stopFor(),closeConnections(),acceptsInboundEnvUpdates(), andexitOnFatalInput()methods that branch on whether the process owns itself or is hosted by another process (e.g. a CCR client). - Background workers now refuse untrusted inbound environment-variable updates: a new
acceptsInboundEnvUpdates()gate checks before applying anupdate_environment_variablesmessage. A hosted worker always refuses; a process-owning worker only accepts if its hosting descriptor saystrustsInboundEnvUpdates. Refused updates are logged as a warning and the message is discarded rather than silently dropped. - When an incoming stream-json input line exceeds the maximum line length, the code now routes through the new
exitOnFatalInput(...)method (at both the "tail" and "block" warning sites) instead of a generically named handler.
Why This separates "this process owns its own lifecycle" from "this process is hosted inside another one" (e.g. run via CCR), so a hosted worker can be stopped cleanly with a specific reason instead of exiting the whole process, and so it won't blindly trust environment-variable updates from outside.