Build and run agents you can see, understand and trust.
Python agentchatbotlarge-language-modelsllmllm-agentmcpmulti-agentmulti-modalreact-agentrealtime-agentvoice-agentvoice-assistant
fix(deps): upgrade certifi, pip, uv and node to drop distrusted CAs (#3410)
qbc15ab3daa86a0
diff --git a/.github/workflows/github-monitor.yml b/.github/workflows/github-monitor.ymlindex 891d1323a..641be4158 100644--- a/.github/workflows/github-monitor.yml+++ b/.github/workflows/github-monitor.yml@@ -45,7 +45,12 @@ jobs:python-version: '3.11'cache: pip- - run: pip install -r requirements.txt+ - name: Upgrade pip certificate bundle+ # Verify the bootstrap wheel even if the old pip trusts unsafe CAs.+ # Hash from the Python.org emSign incident advisory.+ run: python -m pip install "pip @ https://files.pythonhosted.org/packages/3f/06/3e4420302363fbb71be3c7f35ce042f54bfca330e3e66b3a2e3c4cca579f/pip-26.2.2-py3-none-any.whl#sha256=fd7f4dfa8190e014013b9f08f3e973f4e4c26ffd179a204895533a7254813a70"++ - run: python -m pip install "certifi>=2026.10.19" -r requirements.txt- name: Send notificationenv:diff --git a/.github/workflows/issue-claim.yml b/.github/workflows/issue-claim.ymlindex b9851d785..04aee9aab 100644--- a/.github/workflows/issue-claim.yml+++ b/.github/workflows/issue-claim.yml@@ -64,6 +64,7 @@ jobs:- uses: astral-sh/setup-uv@v5if: steps.gate.outputs.verdict == 'maybe'with:+ version: "0.13.4"python-version: '3.11'- name: Ask whether the comment is really a claimdiff --git a/.github/workflows/issue-triage.yml b/.github/workflows/issue-triage.ymlindex 34bd262d5..1235454fa 100644--- a/.github/workflows/issue-triage.yml+++ b/.github/workflows/issue-triage.yml@@ -110,6 +110,7 @@ jobs:- uses: astral-sh/setup-uv@v5with:+ version: "0.13.4"python-version: '3.11'# There is no uv.lock, so without this the cache key never# changes and the cache is never invalidated.diff --git a/.github/workflows/k8s-workspace.yml b/.github/workflows/k8s-workspace.ymlindex d8bda37f7..209041def 100644--- a/.github/workflows/k8s-workspace.yml+++ b/.github/workflows/k8s-workspace.yml@@ -32,6 +32,7 @@ jobs:- name: Install uvuses: astral-sh/setup-uv@v5with:+ version: "0.13.4"python-version: '3.11'- name: Create kind cluster@@ -42,7 +43,7 @@ jobs:- name: Build K8s workspace test imagerun: |- docker build \+ docker build --pull --no-cache \-f tests/docker/k8s_workspace_test.Dockerfile \-t agentscope-k8s-test:ci .diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.ymlindex a7316d96b..76a083ca2 100644--- a/.github/workflows/pre-commit.yml+++ b/.github/workflows/pre-commit.yml@@ -12,15 +12,24 @@ jobs:env:OS: ${{ matrix.os }}PYTHON: '3.11'+ # Hooks use separate virtualenvs; upgrading only the outer pip is not enough.+ VIRTUALENV_PIP: "26.2.2"+ VIRTUALENV_NO_PERIODIC_UPDATE: "1"steps:- uses: actions/checkout@master- name: Install uvuses: astral-sh/setup-uv@v5with:+ version: "0.13.4"python-version: '3.11'- name: Install AgentScoperun: |- uv pip install -q -e .[dev]+ uv pip install -q "pip>=26.2.2" -e .[dev]+ seed="$RUNNER_TEMP/precommit-seed"+ echo "VIRTUALENV_EXTRA_SEARCH_DIR=$seed" >> "$GITHUB_ENV"+ # Fetch the hook seed wheel with patched pip, not virtualenv's bundled pip.+ python -m pip download --no-deps --only-binary=:all: \+ --dest "$seed" "pip==26.2.2"- name: Install pre-commitrun: |pre-commit installdiff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.ymlindex 58f4f08a1..3658b3f54 100644--- a/.github/workflows/publish-pypi.yml+++ b/.github/workflows/publish-pypi.yml@@ -26,12 +26,14 @@ jobs:- name: Install uvuses: astral-sh/setup-uv@v5with:+ version: "0.13.4"python-version: '3.11'- name: Install dependenciesrun: |uv pip install build- name: Build package- run: python -m build+ # Use patched uv instead of pip seeded into the isolated build env.+ run: python -m build --installer=uv- name: Test installationrun: |uv pip install dist/*.whl@@ -40,4 +42,4 @@ jobs:uses: pypa/gh-action-pypi-publish@release/v1with:user: __token__- password: ${{ secrets.PYPI_API_TOKEN }}\ No newline at end of file+ password: ${{ secrets.PYPI_API_TOKEN }}diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.ymlindex aa3b1fc7b..c549fb157 100644--- a/.github/workflows/unittest.yml+++ b/.github/workflows/unittest.yml@@ -17,6 +17,7 @@ jobs:- name: Install uvuses: astral-sh/setup-uv@v5with:+ version: "0.13.4"python-version: ${{ matrix.python-version }}- name: Install Bubblewrap (Linux only)if: runner.os == 'Linux'diff --git a/.github/workflows/web-ui.yml b/.github/workflows/web-ui.ymlindex 7572e8003..89d584176 100644--- a/.github/workflows/web-ui.yml+++ b/.github/workflows/web-ui.yml@@ -32,7 +32,7 @@ jobs:- name: Setup Node.jsuses: actions/setup-node@v4with:- node-version: 20+ node-version: "22.23.4"cache: pnpmcache-dependency-path: examples/web_ui/pnpm-lock.yamldiff --git a/pyproject.toml b/pyproject.tomlindex 51704ace9..791822f59 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -21,6 +21,7 @@ requires-python = ">=3.11"dependencies = ["aioitertools","anthropic",+ "certifi>=2026.10.19","dashscope","docstring_parser","filetype",diff --git a/src/agentscope/app/workspace_manager/_docker_workspace_manager.py b/src/agentscope/app/workspace_manager/_docker_workspace_manager.pyindex e2153cdaf..79323441b 100644--- a/src/agentscope/app/workspace_manager/_docker_workspace_manager.py+++ b/src/agentscope/app/workspace_manager/_docker_workspace_manager.py@@ -68,7 +68,7 @@ class DockerWorkspaceManager(*,isolation: IsolationPolicy = IsolationPolicy.PER_AGENT,base_image: str = DEFAULT_BASE_IMAGE,- node_version: str = "20",+ node_version: str = "22.23.4",extra_pip: list[str] | None = None,gateway_port: int = DEFAULT_GATEWAY_PORT,env: dict[str, str] | None = None,@@ -99,9 +99,8 @@ class DockerWorkspaceManager(session creation always wins over this policy.base_image (`str`, defaults to `DEFAULT_BASE_IMAGE`):Base Docker image; must provide ``python3``.- node_version (`str`, defaults to `"20"`):- Major Node.js version (e.g. ``"20"``) to bake into- the image.+ node_version (`str`, defaults to `"22.23.4"`):+ Node.js image version to bake into the image.extra_pip (`list[str] | None`, optional):Extra Python packages to install into the gatewayvenv at image-build time.@@ -280,36 +279,35 @@ class DockerWorkspaceManager("""del session_id # accepted for interface parity; not used here- if not workspace_id:- workspace_id = await self.assign_workspace_id(- user_id=user_id,- agent_id=agent_id,- session_id="",- )+ resolved_id: str = workspace_id or await self.assign_workspace_id(+ user_id=user_id,+ agent_id=agent_id,+ session_id="",+ )async with self._lock:- cached = self._cache.get(workspace_id)+ cached = self._cache.get(resolved_id)if cached is not None:ws, _ = cached- self._cache[workspace_id] = (ws, time.monotonic())+ self._cache[resolved_id] = (ws, time.monotonic())return ws# Cache miss: build under the lock to prevent two concurrent# get_workspace(workspace_id=X) calls from creating two# workspaces for the same id.async with self._lock:- cached = self._cache.get(workspace_id)+ cached = self._cache.get(resolved_id)if cached is not None:ws, _ = cached- self._cache[workspace_id] = (ws, time.monotonic())+ self._cache[resolved_id] = (ws, time.monotonic())return wsws = await self._build_and_start(- workspace_id=workspace_id,+ workspace_id=resolved_id,user_id=user_id,agent_id=agent_id,)- self._cache[workspace_id] = (ws, time.monotonic())+ self._cache[resolved_id] = (ws, time.monotonic())return ws@deprecated(diff --git a/src/agentscope/workspace/_applecontainer/_applecontainer_workspace.py b/src/agentscope/workspace/_applecontainer/_applecontainer_workspace.pyindex 469ea4442..cdba52fcc 100644--- a/src/agentscope/workspace/_applecontainer/_applecontainer_workspace.py+++ b/src/agentscope/workspace/_applecontainer/_applecontainer_workspace.py@@ -43,7 +43,7 @@ import shlexfrom ..._logging import loggerfrom ...mcp import MCPClientfrom .._sandboxed_base import SandboxedWorkspaceBase-from .._utils import _GATEWAY_BASE_REQUIREMENTS+from .._utils import UV_VERSION, _GATEWAY_BASE_REQUIREMENTSfrom ._applecontainer_backend import AppleContainerBackendfrom ._constants import (CONTAINER_WORKDIR,@@ -512,9 +512,10 @@ class AppleContainerWorkspace(SandboxedWorkspaceBase):# 1. System deps + uv installer."apt-get update -qq ""&& apt-get install -y --no-install-recommends "- "curl ripgrep "+ "curl ca-certificates ripgrep "+ "&& update-ca-certificates ""&& rm -rf /var/lib/apt/lists/*",- "curl -LsSf https://astral.sh/uv/install.sh "+ f"curl -LsSf https://astral.sh/uv/{UV_VERSION}/install.sh ""| env UV_INSTALL_DIR=/usr/local/bin ""INSTALLER_NO_MODIFY_PATH=1 sh",# 2. Gateway venv + base requirements + agentscope.diff --git a/src/agentscope/workspace/_bubblewrap/_bubblewrap_workspace.py b/src/agentscope/workspace/_bubblewrap/_bubblewrap_workspace.pyindex 77c1177d6..68f13c6cd 100644--- a/src/agentscope/workspace/_bubblewrap/_bubblewrap_workspace.py+++ b/src/agentscope/workspace/_bubblewrap/_bubblewrap_workspace.py@@ -20,6 +20,7 @@ from ...mcp import MCPClientfrom .._gateway_client import GatewayClientfrom .._sandboxed_base import SandboxedWorkspaceBasefrom .._utils import (+ UV_VERSION,_GATEWAY_BASE_REQUIREMENTS,_read_gateway_script_bytes,_read_glob_helper_bytes,@@ -556,7 +557,7 @@ class BubblewrapWorkspace(SandboxedWorkspaceBase):"curl -LsSf --retry 5 --retry-delay 2 --retry-all-errors ""--connect-timeout 15 --max-time 60 --retry-max-time 180 "'-o "$tmp_installer" '- "https://astral.sh/uv/install.sh; "+ f"https://astral.sh/uv/{UV_VERSION}/install.sh; "f"env UV_INSTALL_DIR={quoted_bin_dir} "'INSTALLER_NO_MODIFY_PATH=1 sh "$tmp_installer"; ''rm -f "$tmp_installer"; 'diff --git a/src/agentscope/workspace/_daytona/_daytona_workspace.py b/src/agentscope/workspace/_daytona/_daytona_workspace.pyindex 808063ab8..64deee992 100644--- a/src/agentscope/workspace/_daytona/_daytona_workspace.py+++ b/src/agentscope/workspace/_daytona/_daytona_workspace.py@@ -50,7 +50,11 @@ from typing import Anyfrom ..._logging import loggerfrom ...mcp import MCPClientfrom .._sandboxed_base import SandboxedWorkspaceBase-from .._utils import _GATEWAY_BASE_REQUIREMENTS, DEFAULT_WORKSPACE_INSTRUCTIONS+from .._utils import (+ UV_VERSION,+ _GATEWAY_BASE_REQUIREMENTS,+ DEFAULT_WORKSPACE_INSTRUCTIONS,+)from ._constants import (DEFAULT_GATEWAY_PORT,DEFAULT_TIMEOUT,@@ -450,16 +454,18 @@ class DaytonaWorkspace(SandboxedWorkspaceBase):uv_install_dir = f"{self._user_home}/.local/bin"return [- # 1. Install ripgrep for the Grep builtin tool. Daytona+ # 1. Refresh system CAs and install curl and ripgrep. Daytona# snapshots may run as non-root users, so use sudo here# and avoid assuming the SDK-selected OS user is root."sudo apt-get update -qq "- "&& sudo apt-get install -y --no-install-recommends ripgrep "+ "&& sudo apt-get install -y --no-install-recommends "+ "curl ca-certificates ripgrep "+ "&& sudo update-ca-certificates ""&& sudo rm -rf /var/lib/apt/lists/*",# 2. Astral uv — same shell installer as Docker/E2B. The# SDK-reported user home is the install root so we do not# assume /home/daytona or any fixed OS user.- f"curl -LsSf https://astral.sh/uv/install.sh "+ f"curl -LsSf https://astral.sh/uv/{UV_VERSION}/install.sh "f"| env UV_INSTALL_DIR={shlex.quote(uv_install_dir)} "f"INSTALLER_NO_MODIFY_PATH=1 sh",# 3. Gateway venv + base requirements.diff --git a/src/agentscope/workspace/_docker/Dockerfile.template b/src/agentscope/workspace/_docker/Dockerfile.templateindex 7a56a0a73..006d8d00e 100644--- a/src/agentscope/workspace/_docker/Dockerfile.template+++ b/src/agentscope/workspace/_docker/Dockerfile.template@@ -17,9 +17,13 @@# patch shell rc files (we don't need it — PATH already covers it).RUN apt-get update \&& apt-get install -y --no-install-recommends curl ca-certificates ripgrep \+ && update-ca-certificates \&& rm -rf /var/lib/apt/lists/* \- && curl -LsSf https://astral.sh/uv/install.sh \- | env UV_INSTALL_DIR=/usr/local/bin INSTALLER_NO_MODIFY_PATH=1 sh+ && curl -LsSf -o /tmp/uv-installer.sh \+ https://astral.sh/uv/{uv_version}/install.sh \+ && env UV_INSTALL_DIR=/usr/local/bin INSTALLER_NO_MODIFY_PATH=1 \+ sh /tmp/uv-installer.sh \+ && rm /tmp/uv-installer.sh{node_copy_block}ENV UV_PROJECT_ENVIRONMENT={gateway_home}/.venv \UV_LINK_MODE=copy \diff --git a/src/agentscope/workspace/_docker/_docker_workspace.py b/src/agentscope/workspace/_docker/_docker_workspace.pyindex 016b32d2a..ccad1d519 100644--- a/src/agentscope/workspace/_docker/_docker_workspace.py+++ b/src/agentscope/workspace/_docker/_docker_workspace.py@@ -80,7 +80,7 @@ class DockerWorkspace(SandboxedWorkspaceBase):Host directory bind-mounted to ``/workspace``. ``None``makes the workspace ephemeral.node_version (`str | None`, optional):- Major Node.js version to bake into the image.+ Node.js image version to bake into the image.extra_pip (`list[str] | None`, optional):Extra Python packages installed into the gateway venvat image-build time.diff --git a/src/agentscope/workspace/_docker/_make_dockerfile.py b/src/agentscope/workspace/_docker/_make_dockerfile.pyindex ecba46138..e7893612e 100644--- a/src/agentscope/workspace/_docker/_make_dockerfile.py+++ b/src/agentscope/workspace/_docker/_make_dockerfile.py@@ -25,6 +25,7 @@ import tempfilefrom pathlib import Pathfrom .._utils import (+ UV_VERSION,_GATEWAY_BASE_REQUIREMENTS,_read_gateway_script_bytes,_read_glob_helper_bytes,@@ -74,7 +75,7 @@ def render_dockerfile(container_workdir: Container-side workdir; bind-mounted fromthe host when the workspace's ``workdir`` is set, elsean empty in-image directory.- node_version: When given (e.g. ``"20"``) a ``node`` and ``npm``+ node_version: When given (e.g. ``"22.23.4"``) a ``node`` and ``npm``of that version are copied from the official Node slimimage. ``None`` skips Node installation.install_agentscope_block: Pre-rendered block (no surrounding@@ -99,6 +100,7 @@ def render_dockerfile(node_copy_block = ""return _read_template(_DOCKERFILE_TEMPLATE).format(+ uv_version=UV_VERSION,base_image=base_image,gateway_home=gateway_home,container_workdir=container_workdir,diff --git a/src/agentscope/workspace/_e2b/_e2b_workspace.py b/src/agentscope/workspace/_e2b/_e2b_workspace.pyindex d601f8237..42d3ad238 100644--- a/src/agentscope/workspace/_e2b/_e2b_workspace.py+++ b/src/agentscope/workspace/_e2b/_e2b_workspace.py@@ -44,7 +44,11 @@ from typing import Anyfrom ..._logging import loggerfrom ...mcp import MCPClientfrom .._sandboxed_base import SandboxedWorkspaceBase-from .._utils import _GATEWAY_BASE_REQUIREMENTS, DEFAULT_WORKSPACE_INSTRUCTIONS+from .._utils import (+ UV_VERSION,+ _GATEWAY_BASE_REQUIREMENTS,+ DEFAULT_WORKSPACE_INSTRUCTIONS,+)from ._constants import (DEFAULT_GATEWAY_PORT,DEFAULT_TEMPLATE,@@ -349,9 +353,11 @@ class E2BWorkspace(SandboxedWorkspaceBase):# at /usr/local/bin (on PATH — no absolute-path plumbing# needed downstream)."sudo apt-get update -qq "- "&& sudo apt-get install -y --no-install-recommends ripgrep "+ "&& sudo apt-get install -y --no-install-recommends "+ "curl ca-certificates ripgrep "+ "&& sudo update-ca-certificates ""&& sudo rm -rf /var/lib/apt/lists/*",- "curl -LsSf https://astral.sh/uv/install.sh "+ f"curl -LsSf https://astral.sh/uv/{UV_VERSION}/install.sh ""| sudo env UV_INSTALL_DIR=/usr/local/bin ""INSTALLER_NO_MODIFY_PATH=1 sh",# 2. Gateway venv + base requirements + agentscope.diff --git a/src/agentscope/workspace/_k8s/_k8s_workspace.py b/src/agentscope/workspace/_k8s/_k8s_workspace.pyindex 2a99b3e03..fca290083 100644--- a/src/agentscope/workspace/_k8s/_k8s_workspace.py+++ b/src/agentscope/workspace/_k8s/_k8s_workspace.py@@ -33,7 +33,11 @@ from typing import Anyfrom ..._logging import loggerfrom ...mcp import MCPClientfrom .._sandboxed_base import SandboxedWorkspaceBase-from .._utils import _GATEWAY_BASE_REQUIREMENTS, DEFAULT_WORKSPACE_INSTRUCTIONS+from .._utils import (+ UV_VERSION,+ _GATEWAY_BASE_REQUIREMENTS,+ DEFAULT_WORKSPACE_INSTRUCTIONS,+)from ._k8s_backend import K8sBackendfrom ._constants import (DEFAULT_GATEWAY_PORT,@@ -604,8 +608,9 @@ class K8sWorkspace(SandboxedWorkspaceBase):return [f"apt-get update -qq "f"&& apt-get install -y --no-install-recommends {sys_deps} "+ "&& update-ca-certificates "f"&& rm -rf /var/lib/apt/lists/*",- "curl -LsSf https://astral.sh/uv/install.sh "+ f"curl -LsSf https://astral.sh/uv/{UV_VERSION}/install.sh ""| env UV_INSTALL_DIR=/usr/local/bin ""INSTALLER_NO_MODIFY_PATH=1 sh",f"uv venv {self._gateway_venv}",diff --git a/src/agentscope/workspace/_opensandbox/_opensandbox_workspace.py b/src/agentscope/workspace/_opensandbox/_opensandbox_workspace.pyindex 346a118b8..42ff1dc4a 100644--- a/src/agentscope/workspace/_opensandbox/_opensandbox_workspace.py+++ b/src/agentscope/workspace/_opensandbox/_opensandbox_workspace.py@@ -11,7 +11,11 @@ from typing import TYPE_CHECKING, Literalfrom ..._logging import loggerfrom ...mcp import MCPClientfrom .._sandboxed_base import SandboxedWorkspaceBase-from .._utils import _GATEWAY_BASE_REQUIREMENTS, DEFAULT_WORKSPACE_INSTRUCTIONS+from .._utils import (+ UV_VERSION,+ _GATEWAY_BASE_REQUIREMENTS,+ DEFAULT_WORKSPACE_INSTRUCTIONS,+)from ._constants import (DEFAULT_GATEWAY_PORT,DEFAULT_IMAGE,@@ -377,10 +381,11 @@ class OpenSandboxWorkspace(SandboxedWorkspaceBase):"apt-get update -qq ""&& apt-get install -y --no-install-recommends curl ""ca-certificates ripgrep "+ "&& update-ca-certificates ""&& rm -rf /var/lib/apt/lists/*",# Astral uv → /usr/local/bin (on PATH). INSTALLER_NO_MODIFY_PATH# suppresses shell rc edits.- "curl -LsSf https://astral.sh/uv/install.sh "+ f"curl -LsSf https://astral.sh/uv/{UV_VERSION}/install.sh ""| env UV_INSTALL_DIR=/usr/local/bin ""INSTALLER_NO_MODIFY_PATH=1 sh",# Gateway venv + base requirements + agentscope from PyPI.diff --git a/src/agentscope/workspace/_sandboxed_base.py b/src/agentscope/workspace/_sandboxed_base.pyindex b6f77ee93..6a9b607b7 100644--- a/src/agentscope/workspace/_sandboxed_base.py+++ b/src/agentscope/workspace/_sandboxed_base.py@@ -64,6 +64,9 @@ class SandboxedWorkspaceBase(WorkspaceBase):is_alive: bool"""Inherited lifecycle flag, repeated for file-scoped type checks."""+ _mcp_specs: dict[tuple[str, str], list[MCPClient]]+ """Inherited MCP declarations, repeated for file-scoped type checks."""+_bootstrap_cmd_timeout: float = 1800.0"""Per-command timeout applied to every :meth:`_setup_mcp_gateway`bootstrap step. Subclasses lower this for lighter base imagesdiff --git a/src/agentscope/workspace/_utils.py b/src/agentscope/workspace/_utils.pyindex 28a99054d..ca8e69f6d 100644--- a/src/agentscope/workspace/_utils.py+++ b/src/agentscope/workspace/_utils.py@@ -14,6 +14,9 @@ import importlib.resources as _res# ── shared constants ───────────────────────────────────────────────+#: Pinned installer version shared by sandbox bootstraps and Docker.+UV_VERSION = "0.13.4"+#: Standard prompt injected to the system promptDEFAULT_WORKSPACE_INSTRUCTIONS = """<workspace>You have access to a {backend} \workspace at {workdir} with the following structure:@@ -106,6 +109,7 @@ DEFAULT_GLOB_HELPER_SCRIPT = "_glob_helper.py"#: The version on ``mcp`` mirrors ``pyproject.toml``, so the gateway#: speaks the same protocol version as the process driving it._GATEWAY_BASE_REQUIREMENTS: tuple[str, ...] = (+ "certifi>=2026.10.19","mcp>=2.0.0","uvicorn","fastapi",diff --git a/tests/docker/k8s_workspace_test.Dockerfile b/tests/docker/k8s_workspace_test.Dockerfileindex 86a1be4f9..bf8c6dbad 100644--- a/tests/docker/k8s_workspace_test.Dockerfile+++ b/tests/docker/k8s_workspace_test.Dockerfile@@ -27,11 +27,16 @@ FROM python:3.11-slimRUN apt-get update -qq \&& apt-get install -y --no-install-recommends \curl ca-certificates ripgrep \+ && update-ca-certificates \&& rm -rf /var/lib/apt/lists/*# uv — matches the bootstrap command exactly.-RUN curl -LsSf https://astral.sh/uv/install.sh \- | env UV_INSTALL_DIR=/usr/local/bin INSTALLER_NO_MODIFY_PATH=1 sh+# Keep in sync with agentscope.workspace._utils.UV_VERSION.+RUN curl -LsSf -o /tmp/uv-installer.sh \+ https://astral.sh/uv/0.13.4/install.sh \+ && env UV_INSTALL_DIR=/usr/local/bin INSTALLER_NO_MODIFY_PATH=1 \+ sh /tmp/uv-installer.sh \+ && rm /tmp/uv-installer.sh# Keep in sync with agentscope.workspace._k8s._k8s_bootstrap.GATEWAY_HOMEENV GATEWAY_HOME=/root/.agentscope@@ -41,7 +46,8 @@ ENV GATEWAY_HOME=/root/.agentscopeRUN mkdir -p "${GATEWAY_HOME}" \&& uv venv "${GATEWAY_HOME}/.venv" \&& uv pip install --python "${GATEWAY_HOME}/.venv/bin/python" \- 'mcp>=2.0.0' uvicorn fastapi httpx 'httpx2>=2.5.0'+ 'mcp>=2.0.0' uvicorn fastapi httpx 'httpx2>=2.5.0' \+ 'certifi>=2026.10.19'# Install agentscope itself from the local checkout.# Build context is repo root, so pyproject.toml + src/ are visible at /src.diff --git a/tests/workspace_docker_build_test.py b/tests/workspace_docker_build_test.pyindex 8a0a653ef..f7d4eef44 100644--- a/tests/workspace_docker_build_test.py+++ b/tests/workspace_docker_build_test.py@@ -1,7 +1,13 @@# -*- coding: utf-8 -*-+# pylint: disable=protected-access"""Tests for the Docker build context, which needs no Docker daemon."""import shutilimport unittest+from collections.abc import AsyncIterator+from unittest.mock import AsyncMock, MagicMock, patch++from agentscope.workspace._utils import UV_VERSION+from agentscope.workspace._docker._docker_workspace import DockerWorkspacefrom agentscope.workspace._docker._make_dockerfile import (prepare_build_context,@@ -27,3 +33,74 @@ class DockerGatewayInstallTest(unittest.TestCase):'RUN uv pip install --no-deps "agentscope"',],)++ def test_certificate_requirements(self) -> None:+ """Update gateway certificates without modifying system Python."""+ ctx_dir, _, copy_files = prepare_build_context()+ try:+ self.assertEqual(+ sorted(copy_files),+ ["_glob_helper.py", "_mcp_gateway_app.py", "requirements.txt"],+ )+ requirements = (ctx_dir / "requirements.txt").read_text()+ dockerfile = (ctx_dir / "Dockerfile").read_text()+ self.assertIn("certifi>=2026.10.19\n", requirements)+ self.assertIn(+ f"https://astral.sh/uv/{UV_VERSION}/install.sh",+ dockerfile,+ )+ self.assertNotIn("uv pip install --system", dockerfile)+ self.assertNotIn("--break-system-packages", dockerfile)+ self.assertIn("update-ca-certificates", dockerfile)+ self.assertNotIn("| env", dockerfile)+ finally:+ shutil.rmtree(ctx_dir)++ def test_uv_version_changes_image_tag(self) -> None:+ """Changing the installer pin invalidates the generated image tag."""+ ctx_dir, original_tag, _ = prepare_build_context()+ self.addCleanup(shutil.rmtree, ctx_dir)+ with patch(+ "agentscope.workspace._docker._make_dockerfile.UV_VERSION",+ "0.13.5",+ ):+ updated_dir, updated_tag, _ = prepare_build_context()+ self.addCleanup(shutil.rmtree, updated_dir)+ self.assertNotEqual(original_tag, updated_tag)+ self.assertIn(+ "https://astral.sh/uv/0.13.5/install.sh",+ (updated_dir / "Dockerfile").read_text(),+ )+++class DockerBuildCompatibilityTest(unittest.IsolatedAsyncioTestCase):+ """Builds preserve local image support and normal layer caching."""++ async def test_local_base_does_not_force_pull_or_disable_cache(+ self,+ ) -> None:+ """A local-only base must not require access to a registry."""+ workspace = DockerWorkspace(+ workspace_id="local-build",+ base_image="local-only:custom",+ )+ workspace._client = MagicMock()+ workspace._client.images.inspect = AsyncMock(side_effect=ValueError)++ async def stream() -> AsyncIterator[dict[str, str]]:+ """Yield one successful Docker build event."""+ yield {"stream": "built"}++ workspace._client.images.build.return_value = stream()+ await workspace._build_or_reuse_image()+ options = workspace._client.images.build.call_args.kwargs+ self.assertNotIn("pull", options)+ self.assertNotIn("nocache", options)++ async def test_current_image_can_be_reused(self) -> None:+ """The changed template yields a new tag; safe cache hits stay fast."""+ workspace = DockerWorkspace(workspace_id="tls-cache")+ workspace._client = MagicMock()+ workspace._client.images.inspect = AsyncMock()+ await workspace._build_or_reuse_image()+ workspace._client.images.build.assert_not_called()diff --git a/tests/workspace_manager_docker_test.py b/tests/workspace_manager_docker_test.pyindex 3a476f79f..8e6fb62fe 100644--- a/tests/workspace_manager_docker_test.py+++ b/tests/workspace_manager_docker_test.py@@ -67,7 +67,7 @@ class TestDockerWorkspaceManager(IsolatedAsyncioTestCase):"workspace_id": "fixed-id","host_workdir": os.path.join(self.basedir, "fixed-id"),"base_image": "python:3.11-slim",- "node_version": "20",+ "node_version": "22.23.4","extra_pip": [],"gateway_port": 5600,"env": {},@@ -77,6 +77,59 @@ class TestDockerWorkspaceManager(IsolatedAsyncioTestCase):)self.assertTrue(os.path.isdir(os.path.join(self.basedir, "fixed-id")))+ async def test_missing_id_is_assigned_and_cached(self) -> None:+ """Missing and empty ids resolve before cache lookup and build."""+ for workspace_id in (None, ""):+ with self.subTest(workspace_id=workspace_id):+ manager = DockerWorkspaceManager(self.basedir)+ created_before = len(_FakeWorkspace.created)+ with patch.object(+ manager,+ "assign_workspace_id",+ AsyncMock(return_value="assigned-id"),+ ) as assign:+ ws = await manager.get_workspace(+ "u1",+ "a1",+ "s1",+ workspace_id,+ )+ cached = await manager.get_workspace(+ "u1",+ "a1",+ "s1",+ "assigned-id",+ )++ assign.assert_awaited_once_with(+ user_id="u1",+ agent_id="a1",+ session_id="",+ )+ self.assertIs(cached, ws)+ self.assertEqual(+ len(_FakeWorkspace.created) - created_before,+ 1,+ )+ self.assertEqual(list(manager._cache), ["assigned-id"])+ self.assertDictEqual(+ ws.kwargs,+ {+ "workspace_id": "assigned-id",+ "host_workdir": os.path.join(+ self.basedir,+ "assigned-id",+ ),+ "base_image": "python:3.11-slim",+ "node_version": "22.23.4",+ "extra_pip": [],+ "gateway_port": 5600,+ "env": {},+ "default_mcps": [],+ "skill_paths": [],+ },+ )+async def test_workspace_id_cannot_escape_the_basedir(self) -> None:"""A caller-supplied id may not point the bind-mount outside."""manager = DockerWorkspaceManager(self.basedir)@@ -99,7 +152,7 @@ class TestDockerWorkspaceManager(IsolatedAsyncioTestCase):"workspace_id": "fixed-id","host_workdir": legacy,"base_image": "python:3.11-slim",- "node_version": "20",+ "node_version": "22.23.4","extra_pip": [],"gateway_port": 5600,"env": {},