From cd846cc9d4e32a19e684c59a1f302601027ef976 Mon Sep 17 00:00:00 2001 From: Wang Qi Date: Mon, 27 Jul 2026 15:20:09 +0800 Subject: [PATCH] Enhance: localhost:9385 -> sandbox-executor-manager:9385 (#17414) --- agent/sandbox/providers/base.py | 2 +- agent/sandbox/sandbox_spec.md | 18 +++++++++--------- .../tests/sandbox_security_tests_full.py | 2 +- agent/sandbox/tests/test_providers.py | 10 +++++----- conf/system_settings.json | 4 ++-- internal/admin/service_variables_test.go | 2 +- internal/agent/sandbox/self_managed.go | 2 +- .../agent/tool/code_exec_sandbox_design.md | 4 ++-- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/agent/sandbox/providers/base.py b/agent/sandbox/providers/base.py index 915487cf59..012eaff009 100644 --- a/agent/sandbox/providers/base.py +++ b/agent/sandbox/providers/base.py @@ -171,7 +171,7 @@ class SandboxProvider(ABC): "type": "string", "required": True, "label": "API Endpoint", - "placeholder": "http://localhost:9385" + "placeholder": "http://sandbox-executor-manager:9385" }, "timeout": { "type": "integer", diff --git a/agent/sandbox/sandbox_spec.md b/agent/sandbox/sandbox_spec.md index 6734a54d17..7a156f88b2 100644 --- a/agent/sandbox/sandbox_spec.md +++ b/agent/sandbox/sandbox_spec.md @@ -135,17 +135,17 @@ Wraps the existing executor_manager implementation. The implementation file is l **Configuration**: Docker API endpoint, pool size, resource limits: -- `endpoint`: HTTP endpoint (default: "http://localhost:9385") +- `endpoint`: HTTP endpoint (default: "http://sandbox-executor-manager:9385") - `timeout`: Request timeout in seconds (default: 30) - `max_retries`: Maximum retry attempts (default: 3) - `pool_size`: Container pool size (default: 10) -**Languages**: +**Languages**: - Python - Node.js - JavaScript -**Security**: +**Security**: - gVisor (runsc runtime) - seccomp - read-only filesystem @@ -507,7 +507,7 @@ Each provider's configuration is stored as a **single JSON object** in the `valu "name": "sandbox.self_managed", "source": "variable", "data_type": "json", - "value": "{\"endpoint\": \"http://localhost:9385\", \"pool_size\": 10, \"max_memory\": \"256m\", \"timeout\": 30}" + "value": "{\"endpoint\": \"http://sandbox-executor-manager:9385\", \"pool_size\": 10, \"max_memory\": \"256m\", \"timeout\": 30}" } ``` @@ -606,7 +606,7 @@ class SelfManagedProvider(SandboxProvider): "type": "string", "required": True, "label": "API Endpoint", - "placeholder": "http://localhost:9385" + "placeholder": "http://sandbox-executor-manager:9385" }, "pool_size": { "type": "integer", @@ -1316,7 +1316,7 @@ Structured logging for all provider operations: class TestSelfManagedProvider: def test_initialize_with_config(): provider = SelfManagedProvider() - assert provider.initialize({"endpoint": "http://localhost:9385"}) + assert provider.initialize({"endpoint": "http://sandbox-executor-manager:9385"}) def test_create_python_instance(): provider = SelfManagedProvider() @@ -1538,7 +1538,7 @@ PROVIDER_CLASSES = { "name": "sandbox.self_managed", "source": "variable", "data_type": "json", - "value": "{\"endpoint\": \"http://sandbox-internal:9385\", \"pool_size\": 20, \"max_memory\": \"512m\", \"timeout\": 60, \"enable_seccomp\": true, \"enable_ast_analysis\": true}" + "value": "{\"endpoint\": \"http://sandbox-executor-manager:9385\", \"pool_size\": 20, \"max_memory\": \"512m\", \"timeout\": 60, \"enable_seccomp\": true, \"enable_ast_analysis\": true}" }, { "name": "sandbox.aliyun_codeinterpreter", @@ -1562,7 +1562,7 @@ PROVIDER_CLASSES = { { "provider_type": "self_managed", "config": { - "endpoint": "http://sandbox-internal:9385", + "endpoint": "http://sandbox-executor-manager:9385", "pool_size": 20, "max_memory": "512m", "timeout": 60, @@ -1583,7 +1583,7 @@ PROVIDER_CLASSES = { "data": { "active": "self_managed", "self_managed": { - "endpoint": "http://sandbox-internal:9385", + "endpoint": "http://sandbox-executor-manager:9385", "pool_size": 20, "max_memory": "512m", "timeout": 60, diff --git a/agent/sandbox/tests/sandbox_security_tests_full.py b/agent/sandbox/tests/sandbox_security_tests_full.py index 758120758e..bb6975d205 100644 --- a/agent/sandbox/tests/sandbox_security_tests_full.py +++ b/agent/sandbox/tests/sandbox_security_tests_full.py @@ -24,7 +24,7 @@ from typing import Dict, Optional import requests from pydantic import BaseModel -API_URL = os.getenv("SANDBOX_API_URL", "http://localhost:9385/run") +API_URL = os.getenv("SANDBOX_API_URL", "http://sandbox-executor-manager:9385/run") TIMEOUT = 15 MAX_WORKERS = 5 diff --git a/agent/sandbox/tests/test_providers.py b/agent/sandbox/tests/test_providers.py index 12d3d0a129..a85e23eb76 100644 --- a/agent/sandbox/tests/test_providers.py +++ b/agent/sandbox/tests/test_providers.py @@ -117,7 +117,7 @@ class TestSelfManagedProvider: """Test provider initialization.""" provider = SelfManagedProvider() - assert provider.endpoint == "http://localhost:9385" + assert provider.endpoint == "http://sandbox-executor-manager:9385" assert provider.timeout == 30 assert provider.max_retries == 3 assert provider.pool_size == 10 @@ -163,7 +163,7 @@ class TestSelfManagedProvider: result = provider.initialize({}) assert result is True - assert provider.endpoint == "http://localhost:9385" + assert provider.endpoint == "http://sandbox-executor-manager:9385" assert provider.timeout == 30 def test_create_instance_python(self): @@ -176,7 +176,7 @@ class TestSelfManagedProvider: assert instance.provider == "self_managed" assert instance.status == "running" assert instance.metadata["language"] == "python" - assert instance.metadata["endpoint"] == "http://localhost:9385" + assert instance.metadata["endpoint"] == "http://sandbox-executor-manager:9385" assert len(instance.instance_id) > 0 # Verify instance_id exists def test_create_instance_nodejs(self): @@ -299,7 +299,7 @@ class TestSelfManagedProvider: result = provider.health_check() assert result is True - mock_get.assert_called_once_with("http://localhost:9385/healthz", timeout=5) + mock_get.assert_called_once_with("http://sandbox-executor-manager:9385/healthz", timeout=5) @patch("requests.get") def test_health_check_failure(self, mock_get): @@ -329,7 +329,7 @@ class TestSelfManagedProvider: assert "endpoint" in schema assert schema["endpoint"]["type"] == "string" assert schema["endpoint"]["required"] is True - assert schema["endpoint"]["default"] == "http://localhost:9385" + assert schema["endpoint"]["default"] == "http://sandbox-executor-manager:9385" assert "timeout" in schema assert schema["timeout"]["type"] == "integer" diff --git a/conf/system_settings.json b/conf/system_settings.json index f546aa1436..f123e4508d 100644 --- a/conf/system_settings.json +++ b/conf/system_settings.json @@ -70,7 +70,7 @@ "name": "sandbox.self_managed", "source": "variable", "data_type": "json", - "value": "{\"endpoint\": \"http://localhost:9385\", \"timeout\": 30, \"max_retries\": 3, \"pool_size\": 10}" + "value": "{\"endpoint\": \"http://sandbox-executor-manager:9385\", \"timeout\": 30, \"max_retries\": 3, \"pool_size\": 10}" }, { "name": "sandbox.aliyun_codeinterpreter", @@ -85,4 +85,4 @@ "value": "{}" } ] -} \ No newline at end of file +} diff --git a/internal/admin/service_variables_test.go b/internal/admin/service_variables_test.go index fd135de13b..c61486985c 100644 --- a/internal/admin/service_variables_test.go +++ b/internal/admin/service_variables_test.go @@ -35,7 +35,7 @@ func TestValidateSystemSettingValue(t *testing.T) { {name: "bool accepts true", dataType: "bool", value: "true"}, {name: "bool accepts false", dataType: "bool", value: "false"}, {name: "bool rejects non bool", dataType: "bool", value: "yes", wantError: true}, - {name: "json accepts object", dataType: "json", value: `{"endpoint":"http://localhost:9385"}`}, + {name: "json accepts object", dataType: "json", value: `{"endpoint":"http://sandbox-executor-manager:9385"}`}, {name: "json rejects invalid", dataType: "json", value: "{", wantError: true}, {name: "unknown type rejects", dataType: "float", value: "1.2", wantError: true}, } diff --git a/internal/agent/sandbox/self_managed.go b/internal/agent/sandbox/self_managed.go index 10bc60a03a..2ae90f4e4e 100644 --- a/internal/agent/sandbox/self_managed.go +++ b/internal/agent/sandbox/self_managed.go @@ -75,7 +75,7 @@ import ( // selfManagedDefaultEndpoint is the canonical executor_manager // endpoint baked into the Python side. Operators override via // SANDBOX_EXECUTOR_MANAGER_URL. -const selfManagedDefaultEndpoint = "http://localhost:9385" +const selfManagedDefaultEndpoint = "http://sandbox-executor-manager:9385" // SelfManagedProvider is the Go port of // `agent/sandbox/providers/self_managed.py::SelfManagedProvider`. diff --git a/internal/agent/tool/code_exec_sandbox_design.md b/internal/agent/tool/code_exec_sandbox_design.md index d574316e98..b46d4b03e1 100644 --- a/internal/agent/tool/code_exec_sandbox_design.md +++ b/internal/agent/tool/code_exec_sandbox_design.md @@ -27,7 +27,7 @@ class SandboxProvider(ABC): | Provider | File | Backend | |----------|------|---------| -| `SelfManagedProvider` | `self_managed.py` | HTTP at `localhost:9385` (the `executor_manager`, which runs a Docker pool with gVisor) | +| `SelfManagedProvider` | `self_managed.py` | HTTP at `sandbox-executor-manager:9385` (the `executor_manager`, which runs a Docker pool with gVisor) | | `AliyunCodeInterpreterProvider` | `aliyun_codeinterpreter.py` | Alibaba Cloud sandbox (uses `agentrun` SDK / Function Compute) | | `E2BProvider` | `e2b.py` | e2b cloud sandbox (SaaS) | @@ -94,7 +94,7 @@ Cons Read the three provider implementations and write Go equivalents: -- `SelfManagedProvider` → Go HTTP client to `localhost:9385` +- `SelfManagedProvider` → Go HTTP client to `sandbox-executor-manager:9385` (the executor_manager). Smallest of the three. - `AliyunCodeInterpreterProvider` → Go reimplementation of the `agentrun` SDK client. ~Vendor SDK surface to maintain.