land: bash-posix-spawn

Merged
AF
3d ago
+1500-45

Accepted agent delivery; branch-keyed search descriptor included.


Summary by cubic

Non-PTY bash commands now spawn via posix_spawn on macOS and modern Linux, avoiding a daemon fork and the memory copy it incurs, while keeping sandboxing, session isolation, and process-tree cleanup unchanged.

  • Older libcs that lack the required posix_spawn extensions fall back to the previous fork-based path; the backend and fallback attempt counts are surfaced in health/status metrics.
  • Adds zero-fork, grandchild-kill, fd-isolation, signal-mask, and spawn-latency tests; native-only assertions skip when the local glibc predates the required capability and fail on newer libcs if the backend is unexpectedly missing.

RetriggerView in GreptileConfidence Score: 5/5

The changes since the previous review appear safe to merge.

Summary

Non-PTY Bash commands use posix_spawn on supported hosts, with the existing fork path available when required capabilities are missing.

  • Non-PTY Bash commands use posix_spawn when the host supports it.
  • Health and status show which Bash spawn path is active.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Non-PTY Bash command] --> B{Native capabilities available?}
  B -->|Yes| C[posix_spawn]
  B -->|No| D[Existing fork path]
  C --> E[Track child and process group]
  D --> E
  E --> F[Observe exit or stop descendants]

Reviews (2) · Last reviewed commit: "mason: skip native spawn tests only on o..." · Reviewed by Greptile