Skip to content

Commit 2bd878a

Browse files
wan9chiGemini 4 Neon
andauthored
refactor(vt): split piped and inherited spawn handles and drop dead fspy branch (#1021)
## Motivation The process-spawning boundary in `crates/vt/src/session/execute/` represented coupled stdio and tracking invariants as independent booleans and `Option`s: - `ChildHandle` stored parallel `stdout: Option<ChildStdout>` and `stderr: Option<ChildStderr>`, allowing half-piped states and forcing two `.take().expect("SpawnStdio::Piped yields a ...")` unwraps in `run_child` to pair the handle back with `Option<PipeSinks>`. - `ExecutionMode::spawn_config()` returned `(SpawnStdio, bool)`, making the invalid `(SpawnStdio::Inherited, true)` (inherited stdio + fspy) combination representable and leaving a dead `SpawnStdio::Inherited` branch inside `spawn_fspy`. - `RunHandles` stored independent `sinks: Option<PipeSinks>` and `ipc: Option<IpcHandles>`, even though cached execution always has both and uncached inherited execution has neither. ## Changes - Replaced `SpawnStdio`, `fspy: bool`, `ChildHandle`, and `spawn()` in `crates/vt/src/session/execute/spawn.rs` with `PipedMode` (`Plain` | `Tracked`), coupled `ChildPipes`, `ChildWait`, `PipedChild`, `InheritedChild`, `spawn_piped`, and `spawn_inherited`. - Removed the dead `SpawnStdio::Inherited` arm from `spawn_fspy` so inherited stdio and fspy tracking cannot be combined at compile time. - Consolidated spawn, pipe drain, and IPC polling in `ExecutionMode::spawn_and_run` (with `run_piped_child`, `wait_child`, and `Tracking::injected_envs`), removing `spawn_config`, `RunHandles`, `IpcHandles`, and both `.take().expect(...)` unwraps in `crates/vt/src/session/execute/mod.rs`. --- <sub>Stack created with <a href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub> <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Touches the core cached-task path where child I/O and IPC are polled together; behavior is preserved but concurrency and cache-update wiring moved. > > **Overview** > Refactors the vt task **spawn pipeline** so stdio mode, fspy tracking, pipes, and IPC are expressed with types instead of separate flags and `Option`s. > > **Spawn layer (`spawn.rs`):** Replaces the single `spawn()` / `ChildHandle` / `SpawnStdio` API with **`spawn_piped`** and **`spawn_inherited`**, returning **`PipedChild`** (paired `ChildPipes` + wait) or **`InheritedChild`**. Piped fspy uses **`PipedMode::Plain` | `Tracked`** only on the piped path, removing the unreachable inherited+fspy branch in `spawn_fspy`. > > **Execute layer (`mod.rs`):** Moves spawn, pipe drain, and (when cached) concurrent IPC polling into **`ExecutionMode::spawn_and_run`**, yielding mode-typed **`RunOutcome`** so uncached runs cannot carry IPC reports and cached runs must. Drops **`RunHandles`**, **`IpcHandles`**, and **`spawn_config`**; splits **`run_child`** into **`run_piped_child`** and **`wait_child`**. **`Tracking::injected_envs`** centralizes env injection for cached children. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit d0b97c8. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Gemini 4 Neon <noreply@google.com>
1 parent 5506727 commit 2bd878a

2 files changed

Lines changed: 325 additions & 279 deletions

File tree

0 commit comments

Comments
 (0)