Skip to content

Build and run agents you can see, understand and trust.

fix(workspace): make the bubblewrap smoke probe require --clearenv (#3550)

Ziyang Guoea903c9dc051
diff --git a/src/agentscope/workspace/_bubblewrap/_constants.py b/src/agentscope/workspace/_bubblewrap/_constants.py
index 702dfbbf7..e5174b646 100644
--- a/src/agentscope/workspace/_bubblewrap/_constants.py
+++ b/src/agentscope/workspace/_bubblewrap/_constants.py
@@ -21,6 +21,12 @@ BWRAP_SMOKE_PROBE_ARGV = [
"/proc",
"--dev",
"/dev",
+ # Require --clearenv, which every backend command uses, and restore
+ # PATH so the probe can resolve its command.
+ "--clearenv",
+ "--setenv",
+ "PATH",
+ "/usr/bin:/bin",
"--",
"true",
]
diff --git a/tests/backend_bubblewrap_test.py b/tests/backend_bubblewrap_test.py
index f99d91c73..0354488de 100644
--- a/tests/backend_bubblewrap_test.py
+++ b/tests/backend_bubblewrap_test.py
@@ -71,6 +71,11 @@ class TestBubblewrapBackendUnit(IsolatedAsyncioTestCase):
self.assertIn("--die-with-parent", argv)
self.assertIn("--clearenv", argv)
+ def test_smoke_probe_covers_clearenv(self) -> None:
+ """Verify the probe includes required environment setup options."""
+ self.assertIn("--clearenv", BWRAP_SMOKE_PROBE_ARGV)
+ self.assertIn("--setenv", BWRAP_SMOKE_PROBE_ARGV)
+
async def test_bwrap_argv_does_not_mount_opt_by_default(self) -> None:
"""Host /opt is not exposed unless a future explicit mount adds it."""
argv = self.backend._bwrap_argv(["true"], cwd=None)