bug(sandbox): scp and sftp stall for 30 s and exit 74 after a successful transfer

Ouverte Adaptée aux débutants
#5,658 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
2/5
Temps estimé
1-3 heures
Accessibilité débutants
83/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
rust

Piste de recherche

Commencez par crates/openshell-sandbox/src/boundary_exec.rs, où la copie du socket de sortie de l’assistant SFTP est conservée, et examinez le chemin de sortie normal de l’assistant ainsi que signal. Lisez ensuite trusted_sftp_helper_round_trips_through_boundary_streams et la gestion du vidage de la sortie dans crates/openshell-sandbox/src/main_session.rs. Le travail est terminé lorsqu’un test unitaire confirme que la sortie de l’assistant atteint EOF après une sortie normale, et que les transferts SFTP et scp de l’issue se terminent avec succès sans l’attente de 30 secondes.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

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 (624aceea3). 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 upload and openshell 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 no scp binary.

Acceptance Criteria

  • scp and sftp to 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

  1. Create a sandbox: openshell sandbox create --name mybox
  2. Add its SSH config: openshell sandbox ssh-config mybox >> ~/.ssh/config
  3. Copy a file: time scp ./somefile openshell-mybox.default:/tmp/
  4. 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 main at 624aceea3
  • Deployment: Kubernetes (Helm), shared supervisor pool
Langage dominant
Rust
Étoiles
21.5k
Forks
2.1k
Merge moyen
2 j 20 h
PR mergées (30 j)
246

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de NVIDIA/OpenShell

Toutes les issues de NVIDIA/OpenShell

Issues similaires

Plus d'issues Rust

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.