Problem
The stderr capture path has an EOF race: the timed wait can return before the async output handlers have drained, so captured diagnostics may be truncated or empty exactly when they are most needed — a crashing launch.
Proposed approach
- Call parameterless
WaitForExit() after the timed wait, which is the documented way to ensure async output handlers have completed.
- Treat
Data == null as the EOF signal rather than inferring completion from process exit.
- Use a synchronized ring buffer for captured output.
- Retain first-N + last-N lines, so both the startup context and the failure tail survive truncation.
- Bound both byte count and individual line length, so a pathological engine cannot exhaust memory.
- Apply the same drain check to stdout.
Acceptance criteria
- Diagnostics are complete for a process that exits immediately.
- Capture is bounded in memory under a high-volume or pathological writer.
- Both the head and tail of output are retained when truncation occurs.
- No unbounded growth and no data race on the buffer.
Notes
Stack PR 4 (feat/native-launch).
Problem
The stderr capture path has an EOF race: the timed wait can return before the async output handlers have drained, so captured diagnostics may be truncated or empty exactly when they are most needed — a crashing launch.
Proposed approach
WaitForExit()after the timed wait, which is the documented way to ensure async output handlers have completed.Data == nullas the EOF signal rather than inferring completion from process exit.Acceptance criteria
Notes
Stack PR 4 (
feat/native-launch).