Repository navigation
Description
User Story
I ran a mini scale test of OpenShell on Kubernetes. Plain ssh into a sandbox worked, but every scp and sftp transfer stalled for about 30 seconds and then failed with exit code 74. I need SFTP to work so file copy tools and editors like VS Code Remote can use a sandbox.
Problem Statement
An SFTP session (from scp, sftp, or VS Code Remote) finishes its work, then hangs for about 30 seconds and fails with:
openshell: exec output could not be delivered intact
The exit code is 74, even when the file was copied correctly.
Why This Happens
The supervisor hands the sftp subsystem to a helper built into the sandbox runtime. When the helper finishes, OpenShell waits for the helper's output stream to close before it reports the exit status.
The output stream never closes. The helper keeps a second copy of its output socket so it can be cancelled later (boundary_exec.rs). That copy is only closed when the helper is killed (signal), not when it exits normally. Because one copy is still open, the reader never sees end-of-file.
After 30 seconds the runtime gives up waiting (REMOTE_OUTPUT_DRAIN_TIMEOUT), marks the output as lost, and returns 74.
I confirmed this with a unit test on main (624acee). The test runs a real SFTP session through the helper and closes it. The helper exits 0, but its output never closes. Closing the extra socket copy when the helper exits makes the test pass. The existing test trusted_sftp_helper_round_trips_through_boundary_streams misses this because it checks only the exit status, not end-of-file on the output.
Impact / Why This Matters
scp,sftp, and anything built on SFTP (such as VS Code Remote) fail or hang against every sandbox.- Scripts treat the transfer as failed because of exit code 74, even when the file arrived.
- The workaround is
openshell sandbox uploadandopenshell sandbox download, which don't use SFTP. They don't help tools that expect plain SSH file transfer.scp -O(legacy mode) doesn't help either, because sandbox images usually have noscpbinary.
Acceptance Criteria
-
scpandsftpto a sandbox exit 0 as soon as the transfer finishes, with no 30-second stall. - A unit test checks that the SFTP helper's output reaches end-of-file after a normal exit.
Reproduction Steps
- Create a sandbox:
openshell sandbox create --name mybox - Add its SSH config:
openshell sandbox ssh-config mybox >> ~/.ssh/config - Copy a file:
time scp ./somefile openshell-mybox.default:/tmp/ - The command hangs for about 30 seconds and exits 74 with "exec output could not be delivered intact".
Environment
- OpenShell: mini scale test build; code path confirmed on
mainat 624acee - Deployment: Kubernetes (Helm), shared supervisor pool
Activity