fix: enhance error messages for missing bash command and SSH configuration validation

This commit is contained in:
Harry
2026-02-10 19:22:17 +08:00
parent 4b1af0d525
commit a5271baea0
2 changed files with 7 additions and 1 deletions

View File

@ -91,7 +91,11 @@ class SandboxBashTool(Tool):
) -> Generator[ToolInvokeMessage, None, None]:
command = tool_parameters.get("bash", "")
if not command:
yield self.create_text_message("Error: No command provided")
sandbox_debug("bash_tool", "parameters", tool_parameters)
yield self.create_text_message(
'Error: No command provided. The "bash" parameter is required and must contain '
'the shell command to execute. Example: {"bash": "ls -la"}'
)
return
try:

View File

@ -105,6 +105,8 @@ class SSHSandboxEnvironment(VirtualEnvironment):
self._run_command(client, f"mkdir -p {shlex.quote(working_path)}")
arch_stdout = self._run_command(client, "uname -m")
os_stdout = self._run_command(client, "uname -s")
except SandboxConfigValidationError as e:
raise ValueError(f"SSH configuration validation failed, please check sandbox provider: {e}") from e
except Exception as e:
raise VirtualEnvironmentLaunchFailedError(f"Failed to construct SSH environment: {e}") from e