Repository navigation
feat(runtime): spill oversized output to disk and expose TimedOut on results - #849
Merged
Merged
Conversation
…results Two gaps surfaced when embedding gbash as a shell runtime for AI agents (godex): 1. Large-output spilling. captureBuffer previously truncated and dropped stdout/stderr once the policy byte limit was reached, losing the tail (build/test errors). With ExecutionRequest.SpillDir set, overflow is now written to a temp file and exposed via ExecutionResult.StdoutSpillPath / StderrSpillPath so callers can read the full output. Without a spill dir the legacy truncate-and-drop behavior is unchanged. 2. Timeout semantics. A deadline-triggered stop now sets ExecutionResult.TimedOut=true (exit 124), so callers can distinguish 'killed by timeout' from 'script exited on its own' instead of mis-attributing exit code 124. Threaded through all three layers (public ExecutionRequest/ExecutionResult, internal runtime, and the nested commands.ExecutionResult) with full conversion-chain sync.
- Spill create/write failures no longer surface as script write errors; the partial file is removed and the stream falls back to truncation. - Cap each spill file with ExecutionRequest.MaxSpillBytes (default 64 MiB). - Close capture buffers and record spill paths after control-error classification so a spilled timeout/cancel message is reported, and stop spilling after Close so late writes cannot leak unreported files. - Copy SpillDir/MaxSpillBytes in normalizeSubexecRequest so nested Invocation.Exec honors them; test it with a real nested exec. - Document that spill files hold only the overflow and that callers own cleanup; drop unused spillDirFor; annotate host-side os calls for forbidigo; record the spill contract and TimedOut in SPEC.md.
ewhauser
enabled auto-merge (squash)
October 19, 2026 03:30
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two gaps surfaced when embedding gbash as a shell runtime for our AI agents project (godex):
Large-output spilling. captureBuffer previously truncated and dropped stdout/stderr once the policy byte limit was reached, losing the tail (build/test errors). With ExecutionRequest.SpillDir set, overflow is now written to a temp file and exposed via ExecutionResult.StdoutSpillPath / StderrSpillPath so callers can read the full output. Without a spill dir the legacy truncate-and-drop behavior is unchanged.
Timeout semantics. A deadline-triggered stop now sets ExecutionResult.TimedOut=true (exit 124), so callers can distinguish 'killed by timeout' from 'script exited on its own' instead of mis-attributing exit code 124.
Threaded through all three layers (public ExecutionRequest/ExecutionResult, internal runtime, and the nested commands.ExecutionResult) with full conversion-chain sync.