You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched existing feature requests and discussions to confirm this has not been requested
Problem or motivation
When I used devsy with wsl, I try to mount X11 socket in devcontainer but I need env variable of DISPLAY so dev container know which display to use. Problem is (if it work as I think) as it work now, the shell that devsy used to create container, connection, etc... don't have this variable so just adding in devcontainer.json 's devcontainerEnv key don't work...
Proposed solution
Be able to access all env variable from wsl shell (like DISPLAY, WAYLAND_DISPLAY), maybe using wsl command line to get them ? Or instead of ssh use wsl as wrapper for all command ?
ANother propostion regardless of the solution/implementation choosed, add an option for display env variable injection like the existing ones (SSh, docker credentials, etc....)
Alternatives considered
Manually write once and for all the display variable but can break easily if it changes
Area
Providers
Acceptance criteria
-[]: User can inject their wsl DISPLAY variables through devcontainer.json and/or docker-compose file
-[]: When launching a simple GUI app through devcontainer with the right packages and socket, it should open as a windows GUI program.
-[]: (Optionnal) Add an option like SSH and docker credential to inject DISPLAY and WAYLAND_DISPLAY variable in devcontainer
Investigation and implementation handoff: complete WSLg support through PR #1503
Review date: 30 October 2026. Disposition: still outstanding. Continue the existing Draft PR #1503; do not start a competing implementation.
Source reviewed: main 9bc12ee041ca854c6f81de95fd8c6e49d7cc028c, plus PR head 7321d115f896e1db5dec56a2d7c9509ddd96725d. WSLg discovery is absent from the reviewed main source. The PR is open, draft and conflicting with main. Its recorded CI has completed successfully or with expected skipped/neutral checks, including the ordinary Compose suite. Two unresolved review findings remain. Green checks do not establish the requested visible Windows GUI outcome.
1. What is already built and should be retained
The PR implements a useful, deliberately bounded feature:
Existing PR behavior
Source
Owner-controlled context options WSLG_ENABLED, WSLG_DISTRO, WSLG_USER; disabled by default.
Native Windows calls the system wsl.exe with fixed argv to read only DISPLAY, WAYLAND_DISPLAY, XDG_RUNTIME_DIR for an explicitly selected non-root WSL user. Discovery has bounded output and a total deadline.
An invocation-owned snapshot supplies DEVSY_WSLG_DISPLAY, DEVSY_WSLG_WAYLAND_DISPLAY, DEVSY_WSLG_XDG_RUNTIME_DIR to devcontainer substitution and both Compose consumers. It does not modify the parent environment.
This supplies the missing interpolation inputs using Devsy's existing context, runner and Compose paths. Keep the original request focused on display connectivity. Importing an entire WSL shell environment or wrapping every provider command in WSL is unnecessary and would change unrelated command, credential and transport behavior.
The supported initial topology is Windows Devsy, the built-in Docker provider under any installation name, and Docker Engine in the selected WSL2 distribution. Docker Desktop, Podman, remote SSH/Kubernetes providers and Devsy running inside WSL are not established by this PR. The optional Desktop toggle is not required for this initial scope: Desktop uses the same context options as CLI.
2. Confirmed corrections required in the existing PR
T1. Update the branch to current architecture
Reconcile the current main changes in the existing PR branch, preserving signed commits and Draft status.
Preserve the current secret preflight and configuration overlay ordering while restoring WSLg preflight before provisioning and snapshot preparation before interpolation.
Preserve current CLI --no-status, result/status contracts and lifecycle behavior. WSLg output must not enter protocol stdout.
Port CI to the current suite manifest. Main now provisions Docker-over-WSL through .github/workflows/pr-ci.yml and hack/ci/suites.yaml. Do not resurrect the PR's obsolete standalone docker-buildkit-windows.yml.
Register a wslg integration suite for windows-latest, runtime: docker-wsl, with its actual expected spec count, bounded timeout and normal fail-on-empty/report validation. Preserve the existing six-spec BuildKit suite as its own entry.
Carry the pinned Windows Compose installation/hash check and real probe parity test into the current WSL fixture path, conditional on the WSLg suite. Supply the selected fixture distro/user to its probe and workspace specs. Keep fixture cleanup and diagnostic upload on failure.
Completion: the rebased branch contains one supported CI path, all new specs execute rather than merely register, and existing BuildKit/Compose coverage still runs.
T2. Accept named installations of the built-in Docker provider
The existing PR incorrectly uses installation names as provider identity:
In cmd/workspace/up/wslg.go, retain the native Windows, non-platform and local-agent checks. Resolve the installed provider through provider.LoadProviderConfig(client.Context(), client.Provider()) and require the canonical built-in Docker source (Source.Internal and Source.Raw == provider.DockerDriver), independent of installation name.
Retain the resolved agent-driver validation and actual runtime check. A provider named docker that resolves to Podman, an external/custom driver or a remote agent must still fail.
Apply the same source-based decision in pkg/devcontainer/wslg.go using the locally loaded provider for the workspace's context/name. Propagate loading errors; do not treat missing source metadata as permission to run a WSL probe. Avoid extending the general client interface solely for this check.
Keep owner authorization in the local context. Serialized workspace JSON and project files must not turn discovery on.
Extend cmd/workspace/up/wslg_test.go and pkg/devcontainer/wslg_test.go: canonical Docker; alias my-docker; renamed built-in installation; misleading installation name with a non-Docker source; local Docker driver configured with Podman; missing provider; platform/remote provider. Rejected cases must make zero probe/provision calls.
Completion: a workspace created through devsy provider add docker --name my-docker ... reaches the same allowed WSLg path as the default installation, without widening support to unrelated provider sources.
T3. Prevent stale Compose overrides from recreating a missing service
The current ensureComposeContainer calls checkWSLgReuse(nil, false), which succeeds when the development service has been removed. tryStartExistingProject can then discover old override paths from a surviving sidecar and start the missing service with old literal environment and labels. A fresh Compose process environment cannot update already substituted literal values in those files.
Required changes:
In tryStartExistingProject, skip persisted-project reuse when params.container == nil. There is no target-container metadata with which to validate those generated overrides. Return the normal not-started result before calling the saved-file compose up path.
Let startContainer regenerate overrides from the newly parsed config/current snapshot. Its existing missing-container branch already calls buildComposeOverrideArgs; preserve that behavior.
Apply this rule whether WSLg is currently enabled or has just been disabled. Otherwise old WSLg values can survive opt-out after the target container was removed.
Preserve existing running/stopped-container checks, explicit --recreate requirements, selected-service behavior, named volumes, project identity and unrelated services. Do not implement freshness by compose down --volumes or deleting the project.
Add a regression in the existing Compose/WSLg test suite with two services: create at display A; remove only the development container; retain a sidecar and generated files; discover display B; run ordinary up; assert the recreated target has B, current labels and preserved sidecar data.
Add the opt-out counterpart, current-snapshot counterpart and non-WSLg missing-target case. Assert the old generated-file command was never invoked and a second ordinary up succeeds with the new metadata.
Completion: no successful startup can silently combine fresh discovery with stale stored display metadata.
3. Finish the supported contract and acceptance
T4. Test complete data flow
Retain the existing package tests and extend the narrowly missing cases:
Boundary
Required assertion
Fixed probe
Selected distro/user matches the tested interactive WSL session; cancellation/deadline/oversized output/nonzero exit do not fall back to Windows values or import arbitrary shell variables.
Substitution
Image/Dockerfile containerEnv and Compose original files consume the same immutable snapshot. Missing versus empty values, literal dollar signs and spaces retain their meaning.
Concurrent invocations
Two workspaces using different distro/user/display snapshots cannot see one another's keys or mutate os.Environ/shared Docker helpers.
Collisions
Windows case-insensitive environment names, --init-env, provider env and every supported Compose interpolation env-file source reject reserved assignments before provision. Ordinary DISPLAY remains user-controlled.
Compose
Relative/absolute file paths, multiple Compose files, project-directory selection, empty/default/required interpolation expressions and service env files behave consistently between compose-go and the pinned CLI.
Reuse
Unchanged running container reuses; changed values, enabled/disabled transition or stopped WSLg container requires explicit recreation; missing target regenerates as T3 specifies.
Cleanup
Stop/delete work without the discovery distro available, using validated saved invocation metadata; corrupt/unknown metadata yields an error without executing an arbitrary command.
Ordinary workspaces
Disabled discovery executes no WSL command and keeps Docker, Compose, remote and Linux/macOS behavior unchanged.
The original head's successful Actions run is historical evidence only. Repeat affected suites on the corrected head. Resolve each existing review finding against that head and obtain normal reviews without changing review-plan restrictions or bypassing checks.
T5. Prove GUI behavior on an interactive Windows host
A printed display value, mounted socket or successful X11 connection is insufficient for the customer's acceptance. Use a real Windows AMD64 desktop with WSLg, a selected non-root WSL user and the supported Docker Engine topology. Record exact Windows/WSL/distro/Docker/Devsy versions and the tested commit.
First launch an X11 GUI directly in the selected WSL distro to establish the fixture.
Launch an X11 client from an image-based Devsy workspace and from a Compose workspace using the documented explicit environment/mount mapping. Observe an actual Windows window, not only process/socket existence.
Qualify native Wayland separately with a Wayland client, explicit socket mapping and a container runtime directory owned by the selected container user. An XWayland window does not establish native Wayland acceptance.
Cover the intended non-root container user and any root/rootless configuration the documentation claims to support. Record an unsupported permission configuration accurately; do not solve it with blanket chmod 777, xhost +, privileged mode or mounting the whole host user runtime directory.
Stop/recreate, change display/user, restart WSL and recreate again. Verify replacement sockets are usable and the old container is not silently reused.
Exercise the same configured context from Desktop and CLI. The Desktop launch should consume the shared backend behavior without a second discovery implementation.
Microsoft's WSLg container guidance confirms that both connection variables and corresponding sockets are needed. Only publish a Wayland recipe after its concrete user/ownership/mount flow passes.
T6. Update documentation and close the issue
Update the existing WSL tutorial, not a separate competing guide:
Show named built-in Docker installations, supported topology, owner-controlled options, explicit containerEnv/Compose mapping and the need for the daemon and selected WSL distro to match.
Explain fixed noninteractive discovery, no all-environment import, explicit socket authorization and no automatic GPU/audio/session-bus forwarding.
Document fresh generation when the development service is missing, explicit recreation for stopped/changed WSLg containers and recreation after WSL restart.
Keep stop/delete's replay contract and label visibility clear.
Include the first released version containing the completed change.
Closure criteria: T1-T4 pass on the corrected PR head; T5 demonstrates the supported X11 and Wayland customer flows or the issue explicitly records an approved narrower supported contract; the change is merged and delivered in a release; the issue links the artifact/commit and recorded acceptance. The optional Desktop checkbox can remain a later enhancement. This investigation changed no product code and did not run native WSLg GUI tests.
Activity
skevetter commentedon Oct 12, 2026
Notes for me for later: WSLG https://github.com/microsoft/wslg
skevetter commentedon Oct 31, 2026
Investigation and implementation handoff: complete WSLg support through PR #1503
Review date: 30 October 2026. Disposition: still outstanding. Continue the existing Draft PR #1503; do not start a competing implementation.
Source reviewed: main 9bc12ee041ca854c6f81de95fd8c6e49d7cc028c, plus PR head 7321d115f896e1db5dec56a2d7c9509ddd96725d. WSLg discovery is absent from the reviewed main source. The PR is open, draft and conflicting with main. Its recorded CI has completed successfully or with expected skipped/neutral checks, including the ordinary Compose suite. Two unresolved review findings remain. Green checks do not establish the requested visible Windows GUI outcome.
1. What is already built and should be retained
The PR implements a useful, deliberately bounded feature:
WSLG_ENABLED,WSLG_DISTRO,WSLG_USER; disabled by default.wsl.exewith fixed argv to read onlyDISPLAY,WAYLAND_DISPLAY,XDG_RUNTIME_DIRfor an explicitly selected non-root WSL user. Discovery has bounded output and a total deadline.DEVSY_WSLG_DISPLAY,DEVSY_WSLG_WAYLAND_DISPLAY,DEVSY_WSLG_XDG_RUNTIME_DIRto devcontainer substitution and both Compose consumers. It does not modify the parent environment.This supplies the missing interpolation inputs using Devsy's existing context, runner and Compose paths. Keep the original request focused on display connectivity. Importing an entire WSL shell environment or wrapping every provider command in WSL is unnecessary and would change unrelated command, credential and transport behavior.
The supported initial topology is Windows Devsy, the built-in Docker provider under any installation name, and Docker Engine in the selected WSL2 distribution. Docker Desktop, Podman, remote SSH/Kubernetes providers and Devsy running inside WSL are not established by this PR. The optional Desktop toggle is not required for this initial scope: Desktop uses the same context options as CLI.
2. Confirmed corrections required in the existing PR
T1. Update the branch to current architecture
--no-status, result/status contracts and lifecycle behavior. WSLg output must not enter protocol stdout..github/workflows/pr-ci.ymlandhack/ci/suites.yaml. Do not resurrect the PR's obsolete standalonedocker-buildkit-windows.yml.wslgintegration suite forwindows-latest,runtime: docker-wsl, with its actual expected spec count, bounded timeout and normal fail-on-empty/report validation. Preserve the existing six-spec BuildKit suite as its own entry.Completion: the rebased branch contains one supported CI path, all new specs execute rather than merely register, and existing BuildKit/Compose coverage still runs.
T2. Accept named installations of the built-in Docker provider
The existing PR incorrectly uses installation names as provider identity:
preflightWSLgClientrejectsclient.Provider() != "docker".localDockerWSLgScoperejectsWorkspace.Provider.Name != "docker".workspaceClient.Provider()returns the installed name. The repository already tests a built-in Docker installation namedmy-dockerinload_internal_test.go.Required changes:
cmd/workspace/up/wslg.go, retain the native Windows, non-platform and local-agent checks. Resolve the installed provider throughprovider.LoadProviderConfig(client.Context(), client.Provider())and require the canonical built-in Docker source (Source.InternalandSource.Raw == provider.DockerDriver), independent of installation name.dockerthat resolves to Podman, an external/custom driver or a remote agent must still fail.pkg/devcontainer/wslg.gousing the locally loaded provider for the workspace's context/name. Propagate loading errors; do not treat missing source metadata as permission to run a WSL probe. Avoid extending the general client interface solely for this check.cmd/workspace/up/wslg_test.goandpkg/devcontainer/wslg_test.go: canonical Docker; aliasmy-docker; renamed built-in installation; misleading installation name with a non-Docker source; local Docker driver configured with Podman; missing provider; platform/remote provider. Rejected cases must make zero probe/provision calls.Completion: a workspace created through
devsy provider add docker --name my-docker ...reaches the same allowed WSLg path as the default installation, without widening support to unrelated provider sources.T3. Prevent stale Compose overrides from recreating a missing service
The current
ensureComposeContainercallscheckWSLgReuse(nil, false), which succeeds when the development service has been removed.tryStartExistingProjectcan then discover old override paths from a surviving sidecar and start the missing service with old literal environment and labels. A fresh Compose process environment cannot update already substituted literal values in those files.Required changes:
tryStartExistingProject, skip persisted-project reuse whenparams.container == nil. There is no target-container metadata with which to validate those generated overrides. Return the normal not-started result before calling the saved-filecompose uppath.startContainerregenerate overrides from the newly parsed config/current snapshot. Its existing missing-container branch already callsbuildComposeOverrideArgs; preserve that behavior.--recreaterequirements, selected-service behavior, named volumes, project identity and unrelated services. Do not implement freshness bycompose down --volumesor deleting the project.up; assert the recreated target has B, current labels and preserved sidecar data.upsucceeds with the new metadata.Completion: no successful startup can silently combine fresh discovery with stale stored display metadata.
3. Finish the supported contract and acceptance
T4. Test complete data flow
Retain the existing package tests and extend the narrowly missing cases:
containerEnvand Compose original files consume the same immutable snapshot. Missing versus empty values, literal dollar signs and spaces retain their meaning.os.Environ/shared Docker helpers.--init-env, provider env and every supported Compose interpolation env-file source reject reserved assignments before provision. OrdinaryDISPLAYremains user-controlled.The original head's successful Actions run is historical evidence only. Repeat affected suites on the corrected head. Resolve each existing review finding against that head and obtain normal reviews without changing review-plan restrictions or bypassing checks.
T5. Prove GUI behavior on an interactive Windows host
A printed display value, mounted socket or successful X11 connection is insufficient for the customer's acceptance. Use a real Windows AMD64 desktop with WSLg, a selected non-root WSL user and the supported Docker Engine topology. Record exact Windows/WSL/distro/Docker/Devsy versions and the tested commit.
chmod 777,xhost +, privileged mode or mounting the whole host user runtime directory.Microsoft's WSLg container guidance confirms that both connection variables and corresponding sockets are needed. Only publish a Wayland recipe after its concrete user/ownership/mount flow passes.
T6. Update documentation and close the issue
Update the existing WSL tutorial, not a separate competing guide:
containerEnv/Compose mapping and the need for the daemon and selected WSL distro to match.Closure criteria: T1-T4 pass on the corrected PR head; T5 demonstrates the supported X11 and Wayland customer flows or the issue explicitly records an approved narrower supported contract; the change is merged and delivered in a release; the issue links the artifact/commit and recorded acceptance. The optional Desktop checkbox can remain a later enhancement. This investigation changed no product code and did not run native WSLg GUI tests.
skevetter commentedon Nov 6, 2026
Implemented in #1503