Skip to content

Commit 48d9ab3

Browse files
authored
fix(cli): check final exec status and warn on partial input (#3803)
* feat(cli): stream non-TTY exec input before EOF Add --stream-stdin using the existing interactive exec RPC without a PTY. Preserve separate output streams and enforce the existing 4 MiB cumulative input cap while forwarding input. Require explicit clean stdin EOF and drain the response through its final gRPC status. Cover held-open input, limits, cancellation, trailers, and default finite-input behavior with subprocess and live sandbox regressions. Signed-off-by: Shiju <shiju@nvidia.com> * test(cli): distinguish exec cancellation from stdin EOF Treat transport termination and response cancellation as separate test observations. Verify explicit stdin EOF through the shared frame writer and cover cancellation in the pinned Tonic decoder. Signed-off-by: Shiju <shiju@nvidia.com> * style(cli): use lazy optional stdin dispatch Signed-off-by: Shiju <shiju@nvidia.com> * test(cli): use imported duration in stdin EOF regression Signed-off-by: Shiju <shiju@nvidia.com> --------- Signed-off-by: Shiju <shiju@nvidia.com>
1 parent 121930b commit 48d9ab3

3 files changed

Lines changed: 561 additions & 2 deletions

File tree

‎crates/openshell-cli/src/run.rs‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2506,7 +2506,7 @@ async fn sandbox_exec_streaming_grpc(
25062506
if forwarded > MAX_EXEC_STDIN_BYTES {
25072507
return Err(std::io::Error::new(
25082508
ErrorKind::InvalidInput,
2509-
piped_stdin_limit_error().to_string(),
2509+
"streamed stdin exceeds the 4 MiB limit; the command may have processed partial input; use `sandbox upload` for larger input",
25102510
));
25112511
}
25122512
if stdin_tx
@@ -2648,7 +2648,9 @@ async fn sandbox_exec_streaming_grpc(
26482648
Some(exec_sandbox_event::Payload::Exit(exit)) => {
26492649
exit_code = exit.exit_code;
26502650
exit_seen = true;
2651-
break;
2651+
// Process exit does not complete the RPC. Keep draining so a
2652+
// failing final gRPC status cannot turn partial output into
2653+
// a successful execution result.
26522654
}
26532655
None => {}
26542656
}

0 commit comments

Comments
 (0)