Repository navigation
Description
Context
Expose running-process's canonical process resource-containment API through the kernal-api namespace using Rust re-exports. Do not define a matching facade enum:
// In kernal-api's chosen public module:
pub use running_process::SpawnMode;
// If a public name differs, use `pub use ... as ...`, not a wrapper type.
// Canonical variants: SpawnMode::{Inherited, Independent}.Independent resource placement is distinct from detached lifetime. A daemon can survive its parent/terminal but remain charged to the parent's Linux cgroup or Windows Job Object. Persistent build daemons launched from agent workers can exhaust worker limits even though unrelated future clients will reuse the daemon.
Canonical types and implementation are tracked in zackees/running-process#1202. This issue owns namespace exposure and delegation. Re-exported items must have identical Rust type identity and stay mechanically synchronized with the selected backend dependency version.
Investigation
Reviewed local revision 35c258e in two rounds: architecture and process adapter, followed by native spawn/autostart behavior and dependency/features. Searched open/closed issues for spawning and independence; no exact existing SpawnMode feature was identified.
ARCHITECTURE.mdcurrently forbids public backend type re-exports. This request explicitly revises that rule for this spawn API: update ARCHITECTURE.md, AGENTS.md, and applicable facade-policy tests to permit the scoped canonical re-exports. Dependency direction remains kernal-api -> running-process; unrelated facade APIs are not part of this migration.src/process_adapter.rsalready bridges facade-owned SpawnSpec, process lifetime, and process-session types to running-process.src/platform/process.rsandsrc/sync_spawn_group.rsexpose existing process and daemon controls; review these touch points without duplicating the backend.Cargo.tomlcurrently pins running-process =4.10.10 with kernel-substrate. Scheduler/broker integration must preserve lightweight default features and the existing opt-in daemon slices.- The native daemon API currently detaches terminal/session lifetime; its Windows breakaway helper documents fallback to contained launch on denial. Independent must not report success for that degraded behavior.
Proposal
- Re-export canonical SpawnMode::{Inherited, Independent} from running-process, with Inherited as the default. Re-export the associated new capability/options/error/result types and spawn entry points as needed; use
pub use ... as ...for namespace/name adaptation. No duplicate enum, newtype, variant mapping, or conversion layer for this contract. - Delegate execution to running-process, preferring direct function re-exports when signatures fit. Necessary integration with existing kernal-api request/lifetime types must forward the canonical mode unchanged and must not duplicate policy/defaults. Linux can use a transient systemd user service; Windows can use an on-demand Task Scheduler task. Neither implies permanent startup registration. Docker without systemd can use a broker already outside worker scopes.
- Expose meaningful capability, permission, startup, and unsupported errors. Capability depends on runtime manager access and placement, not just OS name or executable existence. Never silently fall back to Inherited; any fallback must be explicit and actual enforcement visible to the caller.
- Document the guarantee precisely: outside the requesting worker's resource subtree/Job Object, subject to enclosing user/container/system limits. It is not exemption from all accounting, privilege elevation, or escape from Docker.
- Preserve explicit cwd/environment/argv/logging policy and bounded readiness/cancellation. Return actual reuse-safe process identity/control rather than treating successful task registration as a running daemon. Define how scheduler-owned processes interact with drop, stop, exit observation, and lifetime-owner binding.
- Update the exact backend release pin once the supporting substrate is published. Expose only the selected canonical spawn contract, not the entire running-process crate or its internal platform/runtime types. Updates stay synchronized with the pinned dependency automatically at compile time; this does not mean auto-updating Cargo versions.
Acceptance criteria
- RED -> GREEN: add a focused failing facade test/repro before implementation, then demonstrate Inherited remains contained and Independent maps to verified native independence.
- Default constructors and existing callers retain Inherited behavior without requiring systemd, Task Scheduler, or a broker.
- Public spawn contract uses direct re-exports/aliases of running-process types and functions, with no mirror enums or conversion mappings.
- Compile-time tests pass kernal-api::SpawnMode to a function accepting running_process::SpawnMode and vice versa without conversion; do the same for the associated re-exported types. Verify default behavior delegates to the canonical implementation.
- Update architecture documentation and facade-policy checks for this explicit, narrowly scoped re-export exception. Keep unrelated backend internals private.
- Tests verify unchanged error propagation, explicit fallback semantics if provided, unsupported mode/lifetime/stdio combinations, bounded readiness, cancellation, and cleanup after partial launch.
- End-to-end Linux evidence verifies cgroup placement/accounting and caller-scope teardown; Windows evidence verifies actual Job Object separation rather than PPID alone. Reuse substrate integration fixtures where appropriate.
- Docker without systemd works with a correctly placed broker, reports unsupported without one, and continues to obey container-wide limits.
- Document concrete persistent-daemon usage and contrast detached lifetime with independent resource placement; do not change application daemon payload protocols.
- Feature/dependency checks preserve default=[] behavior, the one-way architecture, and exact released backend pinning; no new unconditional heavyweight scheduler/broker dependency.
Decisions
- running-process owns the one canonical spawn contract and implementation; kernal-api re-exports and delegates. This user-selected design supersedes the previous facade-owned-type proposal for this feature and requires the scoped architecture-rule update above.
- Preserve the agreed enum names and Inherited default; independence is explicit opt-in.
- P2 feature focused on persistent build/cache daemons, not general automatic exemptions for background processes.
- Linux/Windows are the initial scheduler backends; Docker compatibility requires an optional external broker path, never a mandatory systemd installation.
- Unsupported platforms remain usable through Inherited; report Independent unsupported until a verified backend exists.
Open questions
- Final placement in SpawnSpec versus daemon-specific options should follow the existing public API's compatibility constraints.
- Coordinate the smallest canonical re-export surface with running-process before freezing signatures; namespace layout may differ, type identity must not.
Related issues
- feat: add Inherited and Independent spawn modes with scheduler and broker backends zackees/running-process#1202 — required native scheduler/broker spawning substrate.
Activity
[-]feat: expose Inherited and Independent spawn modes through the process facade[/-][+]feat: re-export canonical running-process Inherited and Independent spawn API[/+]