block / block/buzz

Security decision: platform FFI for managed-agent runtime (process identity, Job Objects)

Open
#6,047 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
32.7k
Forks
4.3k
Avg merge
1d 13h
Merged PRs (30d)
253

Description

## Context

PR #5954 (durable managed-agent runtime) needs three platform capabilities with no safe-Rust equivalent in std or existing deps:

1. **Process start-time identity** (macOS `proc_pidinfo(PROC_PIDTBSDINFO)`, Windows `GetProcessTimes`, Linux `/proc//stat` — Linux side is already safe file reads) — used to detect PID reuse before resuming/terminating managed adapters.
2. **Windows Job Objects** (`CreateJobObjectW`, `AssignProcessToJobObject`, `TerminateJobObject`) — crash-safe process-tree cleanup; std has nothing comparable.
3. **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.

Contributor guide

Open the contributing guide

Research direction

Start with CONTRIBUTING.md's “No Unsafe Code” policy, PR #5954, and the existing precedent in crates/buzz-dev-mcp/src/shell.rs. Review the proposed scoped allowances in the named buzz-runtime and buzz-acp files, then determine whether an accepted safe wrapper exists or whether the documented FFI exception is approved. Done means the preferred approach and scope are agreed.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, macos, rust
Domain
operating-systems, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.