Skip to content

feat(runtime): spill oversized output to disk and expose TimedOut on results - #849

Merged
ewhauser merged 4 commits into
ewhauser:mainfrom
tim5wang:feat/output-spill-and-timedout
Oct 19, 2026
Merged

ewhauser merged 4 commits into
ewhauser:mainfrom
tim5wang:feat/output-spill-and-timedout

Conversation

@tim5wang

Copy link
Copy Markdown
Contributor

Two gaps surfaced when embedding gbash as a shell runtime for our AI agents project (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.

taiwu.wang and others added 2 commits September 11, 2026 17:05
…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
ewhauser enabled auto-merge (squash) October 19, 2026 03:30
@ewhauser
ewhauser merged commit 03c8903 into ewhauser:main Oct 19, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants