Internalize Windows sandbox backend / 内置 Windows 沙箱后端#6076
Merged
SivanCola merged 3 commits intoJul 6, 2026
Conversation
…osed without it The Windows bash sandbox relaunches os.Executable() as a hidden helper process, but the desktop binary never routed that subcommand: every sandboxed command started a second GUI instance that forwarded to the running app via the single-instance lock and exited 0 with no output, so bash silently returned empty on Windows (esengine#6046, esengine#6051, esengine#6067, esengine#6070, esengine#6072). The 1.17.3 escape prompt never fired because it keys on the helper's exit-code-126 failure marker, which a dispatch-less binary never prints. - desktop/main.go dispatches the helper subcommand before any Wails/single-instance setup, with tests pinning the route. - Entry points now declare the route via sandbox.RegisterHelperDispatch(); on Windows, Available() stays false without it and Command/CommandArgs refuse to wrap, so a future dispatch-less embedder fails closed with the existing clear error and escape-approval path instead of swallowing output. - Queueing behind another sandboxed command's per-root lock now emits a one-line notice (sliced mutex waits) instead of blocking silently for up to 10 minutes; recorded as a local modification in the winsandbox NOTICE. - reasonix doctor reports the resolved shell (Git Bash vs PowerShell is the first thing to check for low-integrity launch failures) and warns when a project reasonix.toml pins [sandbox], which overrides Settings/user-config edits (esengine#5961 confusion). - GUIDE/GUIDE.zh-CN gain a Windows sandbox troubleshooting note.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Commit 1 — vendor (
5fe20ebda):internal/winsandboxwith its MIT license and source notice.github.com/SivanCola/windows-sandboxdependency from root and desktop modules, and update sandbox docs.Commit 2 — Windows sandbox fixes (
387cc2251):Root cause of the "bash returns empty output on Windows" reports (#6046, #6051, #6067, #6070, #6072): the sandbox wrapper relaunches
os.Executable()as a hidden helper (__reasonix_windows_sandbox), but only the CLI routed that subcommand — the desktop binary did not. On desktop, every sandboxed command therefore started a second GUI instance, which the Wails single-instance lock forwarded to the running app before exiting 0 with no output. The 1.17.3 escape prompt (#6032) never fired because it keys on the helper's exit-code-126 failure marker, which a dispatch-less binary never prints.desktop/main.godispatches the helper subcommand before any Wails/single-instance setup, with cross-platform tests pinning the route (desktop/windows_sandbox_helper_test.go).sandbox.RegisterHelperDispatch(); on WindowsAvailable()stays false without it andCommand/CommandArgsrefuse to wrap — mirroring the darwin/linux wrappers — so a future dispatch-less embedder hits the existing clear-error / escape-approval path instead of silently swallowing output.WINDOWS_SANDBOX_LOCK_MS). First local modification to the vendored package, recorded ininternal/winsandbox/NOTICE.md; covered by a new contention test.reasonix doctorreports the resolved shell (Git Bash vs PowerShell is the first thing to check for low-integrity launch failures) and warns when a projectreasonix.tomlpins[sandbox], which overrides Settings/user-config edits.GUIDE.md/GUIDE.zh-CN.md.Fixes #6051, fixes #6067, fixes #6070, fixes #6072. Likely fixes #6046 (empty output matches the desktop dispatch gap; the "non-global workspace" detail there is unconfirmed). Improves diagnostics for #5961.
Verification
go test ./...(root) andcd desktop && go test ./...— all green, including the new desktop helper-route tests and winsandbox lock-notice test.GOOS=windows GOARCH=amd64 go build ./...(root),go build .(desktop), andgo test -cforinternal/sandbox/internal/winsandbox/ desktop — all compile.go vet(host +GOOS=windows) andgofmtclean.go list -m allin root and desktop has noSivanCola/windows-sandboxentry.