✨ feat(runtime): orchestrate typed Stop with owned child termination - #777
Merged
Merged
Conversation
Add authenticated typed Stop with durable intent, cross-generation replay, and strict request fencing. Reserve and terminate only the exact Manager-owned child, wait for confirmed reap, and serialize Start/Stop through one shutdown-aware lifecycle executor.
Close lifecycle admission before HTTP shutdown waits for active handlers, then let the existing shared gate drain accepted execution before closing the journal. Cover the production server path with an accepted Start, a queued Start, durable journal evidence, and exactly-once close assertions.
20 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds authenticated typed Stop submission to Runtime Protocol v1. Stop records durable accepted/running evidence before terminating only the exact child owned by the current Supervisor, and reports success only after that child is confirmed reaped.
Start and Stop now share one lifecycle executor, process manager, operation journal, mutation gate, shutdown admission fence, and exactly-once journal close.
Scope
Changes
POST /v1/runtime/operations/stopwith the strict common mutation envelope, fixedstoptype,SHA256("runtime.stop/v1:{}")fingerprint, and deterministicstart,stopcapabilities.cmd.Wait()path to confirm reap, and fail closed on unknown ownership.Historical asset review: inspected the directly relevant child-handle termination and process tests on
feat/integrated-cpa-runtime. Reused only the handle-plus-Wait mechanics and failure/race scenarios as design input; no historical code was copied. Manager-owned supervision, persistent PID authority, caller-selected termination, graceful escalation, automatic restart, cancellation-driven kill, storage/config ownership, and Docker orchestration remain rejected.User Impact
A configured v2 Runtime Supervisor now accepts typed Stop operations for its currently owned CPA child. Read-only mode remains unchanged and advertises no lifecycle capabilities.
Compatibility / Runtime Notes
RuntimeGeneration remains stable across Start/Stop, and Stop does not add readiness or
CPAObservedVersionbehavior. Runtime 07 child environment filtering and ordinary proxy/certificate/locale/XDG inheritance remain unchanged.Data / Security Notes
The existing Supervisor-private journal schema is unchanged. Stop persists only operation identity/state and stable failure code; no PID, signal, process target, secret, or secret-derived fingerprint is stored or accepted from HTTP callers.
Risk / Rollback
Risk level: Medium
The main risk is process lifecycle concurrency. Exact-handle reservation, shared serialization, confirmed Wait/reap, cross-generation replay, shutdown admission fencing, real-child tests, and full race tests cover that boundary. Roll back by reverting this commit; no schema migration or product-data change is involved.
Verification
Commands / evidence:
All commands passed. Portability outputs were verified as Linux x86-64 ELF, Linux ARM64 ELF, and Windows x86-64 PE32+ executables.
Screenshots / Recordings
N/A — Runtime Supervisor protocol/process change with no UI.
Docs
Docs decision: ADR-0001 is amended with the long-term typed Stop contract. End-user docs are deferred because Manager, Docker/native deployment, UI, and Public API wiring are outside this slice.
Related
N/A — CPAMP 2.0 Runtime Foundation, Runtime 08.