Skip to content

feat(mxc): stream workload output to the CLI for foreground sandbox create on Windows #6031

Backlog

Description

@nv-rahool

User Story

I use OpenShell on Windows with the MXC compute driver to run a single command in a sandbox from a script or a developer shell, the same way I run openshell sandbox create -- <command> on Linux with Docker. I need the command's output on my terminal while it runs, and I need the command's exit code back in my shell. Today the driver refuses this request, so I can only start the command detached and cannot see its output or exit status from the CLI.

Problem Statement

On Windows with MXC, openshell sandbox create -- <command> without --detach is rejected before anything starts ("Create the sandbox with --detach"). The workload's stdout and stderr are already captured separately by the host supervisor, and the in-process SSH server added for sandbox exec provides a transport, but nothing connects them to the CLI for a foreground create. A foreground create without a terminal therefore cannot stream output, drain it before returning, or return the workload's exit code.

Impact / Why This Matters

Without this, users must create the sandbox detached and then fetch results through other commands. Scripts and CI jobs cannot use the exit code of a foreground create, and the same command behaves differently on Linux and Windows, which the sandbox documentation already describes as the expected behavior for drivers that can attach.

Proposed Design

Reuse the existing openshell-main attachment that Linux/Docker uses, over the Windows supervisor's in-process SSH server. For a foreground create without a terminal (no --detach, no --tty):

openshell sandbox create -- cmd /c "echo step1 & timeout 2 >nul & echo oops 1>&2 & exit 7"
  • step1 appears on the CLI's stdout as soon as it is written, oops about two seconds later on the CLI's stderr.
  • The CLI returns after all output has been delivered, and %ERRORLEVEL% is 7.
  • --detach behaves as it does today.
  • A foreground request with --tty is still rejected before provisioning, with a message that points to --no-tty or --detach.

Windows exit codes are 32-bit values, so a crash code such as 0xC0000005 must not be reported as success.

Acceptance Criteria

  • A foreground, no-TTY sandbox create sends the workload's stdout and stderr to the matching CLI streams while the process runs.
  • A workload that emits delayed output on both streams is visible before it exits, and the final output is delivered before the CLI returns.
  • The CLI exits with the workload's exit code, including nonzero values and Windows crash codes.
  • --detach is unchanged, and --tty is rejected before provisioning with an actionable message.
  • Windows documentation states the supported modes.

Alternatives Considered

  • Fetching output after a detached run through other commands does not give live output or a usable exit code from the create call.
  • A new Windows-specific attach protocol would duplicate the existing openshell-main contract; reusing it keeps the CLI behavior identical across drivers.
  • No existing middleware, interceptor or provider extension point applies, because this concerns the CLI attachment to the main process.

Activity

  1. added
    state:triage-needed
    on Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    state:triage-needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions