Context
PR #5954 (durable managed-agent runtime) needs three platform capabilities with no safe-Rust equivalent in std or existing deps:
- Process start-time identity (macOS
proc_pidinfo(PROC_PIDTBSDINFO), Windows GetProcessTimes, Linux /proc/<pid>/stat — Linux side is already safe file reads) — used to detect PID reuse before resuming/terminating managed adapters.
- Windows Job Objects (
CreateJobObjectW, AssignProcessToJobObject, TerminateJobObject) — crash-safe process-tree cleanup; std has nothing comparable.
- macOS
proc_listpids — enumerate a process group's live members.
Current state
Repo policy (CONTRIBUTING.md § "No Unsafe Code"): all crates #![deny(unsafe_code)], exceptions to be discussed in an issue first. Existing precedent: crates/buzz-dev-mcp/src/shell.rs (git_bash_from_registry, KillGroup) already uses #[cfg(windows)] + fn-scoped #[allow(unsafe_code)] + SAFETY comments.
Proposal
- Keep crate-level
#![deny(unsafe_code)].
- Allow fn/module-scoped
#[allow(unsafe_code)] only in:
crates/buzz-runtime/src/artifacts.rs (process identity, macOS/Windows paths)
crates/buzz-runtime/src/windows_job.rs (Job Objects, windows-only)
crates/buzz-acp/src/job_runner.rs (process_group_has_live_members, macOS)
crates/buzz-acp/src/job_windows.rs (windows-only module)
- Every block carries a SAFETY comment; every
#[allow] cites this issue.
@themiguelamador — per your review on #5954: happy to restructure, but stdlib/tokio genuinely lack these APIs. If there's a preferred safe wrapper crate you'd accept instead, name it and I'll switch.
Context
PR #5954 (durable managed-agent runtime) needs three platform capabilities with no safe-Rust equivalent in std or existing deps:
proc_pidinfo(PROC_PIDTBSDINFO), WindowsGetProcessTimes, Linux/proc/<pid>/stat— Linux side is already safe file reads) — used to detect PID reuse before resuming/terminating managed adapters.CreateJobObjectW,AssignProcessToJobObject,TerminateJobObject) — crash-safe process-tree cleanup; std has nothing comparable.proc_listpids— enumerate a process group's live members.Current state
Repo policy (CONTRIBUTING.md § "No Unsafe Code"): all crates
#![deny(unsafe_code)], exceptions to be discussed in an issue first. Existing precedent:crates/buzz-dev-mcp/src/shell.rs(git_bash_from_registry,KillGroup) already uses#[cfg(windows)]+ fn-scoped#[allow(unsafe_code)]+ SAFETY comments.Proposal
#![deny(unsafe_code)].#[allow(unsafe_code)]only in:crates/buzz-runtime/src/artifacts.rs(process identity, macOS/Windows paths)crates/buzz-runtime/src/windows_job.rs(Job Objects, windows-only)crates/buzz-acp/src/job_runner.rs(process_group_has_live_members, macOS)crates/buzz-acp/src/job_windows.rs(windows-only module)#[allow]cites this issue.@themiguelamador — per your review on #5954: happy to restructure, but stdlib/tokio genuinely lack these APIs. If there's a preferred safe wrapper crate you'd accept instead, name it and I'll switch.