refactor(process): add bounded blocking execution - #2671
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a blocking (synchronous) process execution path to moon_process intended for environments that can’t use async execution (like synchronous Extism host calls), while still supporting bounded execution via timeouts and output limits.
Changes:
- Introduces a new blocking capture executor (
CaptureOptions, blocking capture methods, and process-group/job-object cleanup) incrates/process/src/blocking.rs. - Adds new
ProcessErrorvariants for output limits and timeouts to surface bounded-execution failures. - Expands test coverage for blocking capture behavior (timeouts, output limits, byte-preserving output, and descendant cleanup).
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/process/tests/exec_command_test.rs | Adds unit tests covering blocking capture behavior, bounds enforcement, and descendant cleanup. |
| crates/process/src/shared_child.rs | Exposes convert_exit_status internally for reuse by the blocking executor. |
| crates/process/src/process_error.rs | Adds OutputLimitExceeded and Timeout error variants (with diagnostics). |
| crates/process/src/lib.rs | Wires in the new blocking module and re-exports its public API. |
| crates/process/src/exec_command.rs | Exposes internal helpers (create_sync_command, handle_nonzero_status) for blocking executor reuse. |
| crates/process/src/blocking.rs | New blocking capture implementation with timeout/output-limit enforcement and process-tree cleanup. |
| crates/process/Cargo.toml | Updates Windows windows-sys features to support job objects used for cleanup on Windows. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Merging this PR will improve performance by 43.81%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | WallTime | hash_files[1000] |
17.5 ms | 12.1 ms | +43.81% |
Tip
Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.
Comparing lamalex:vcs/process-refactor (556463a) with master (c3de6c9)
0d236d0 to
556463a
Compare
|
Setting to draft while command changes are being extracted to starbase |
Adds bounded blocking process execution to
moon_process.VCS plugins invoke executables through synchronous
extismhost functions. Centralizing this behavior inmoon_processavoids embedding generic subprocess infrastructure in the plugin host, and enables sharing some of moon's existing sub process code.