| 861 | resultPrefix := "" |
| 862 | localFallback := false |
| 863 | if t.sandboxManager != nil && t.sandboxManager.NeedsSetup(in.Command, yolo) { |
| 864 | decision := sandboxSetupDecision(execCtx) |
| 865 | switch decision { |
| 866 | case "install": |
| 867 | if err := t.sandboxManager.InstallWSLSandbox(ctx); err != nil { |
| 868 | return "<tool_use_error>\nWSL sandbox setup failed: " + err.Error() + |
| 869 | "\nConfigure wsl_sandbox_image_path or wsl_sandbox_image_url, or rerun with local fallback.\n</tool_use_error>", nil |
| 870 | } |
| 871 | case "local": |
| 872 | if !t.sandboxManager.AllowLocalFallback() { |
| 873 | return "<tool_use_error>\nWSL sandbox is not available and local fallback is disabled.\nConfigure the WSL sandbox image or set wsl_sandbox_allow_local_fallback=true.\n</tool_use_error>", nil |
| 874 | } |
| 875 | resultPrefix = "[sandbox] WSL sandbox unavailable; command executed locally because local fallback was selected." |
| 876 | localFallback = true |