Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
chore: various bug fixes (#1145)
Jakub Dobry85f5b8d2b3b9
diff --git a/.github/workflows/publish_candidates.yml b/.github/workflows/publish_candidates.ymlindex dc6425379..1c48d632b 100644--- a/.github/workflows/publish_candidates.yml+++ b/.github/workflows/publish_candidates.yml@@ -99,9 +99,12 @@ jobs:- name: Publish JS RCif: ${{ inputs.js-sdk }}working-directory: packages/js-sdk+ env:+ RC_PREID: ${{ inputs.preid }}+ RC_TAG: ${{ inputs.tag }}run: |- npm version prerelease --preid=${{ inputs.preid }}.${{ github.run_number }} --no-git-tag-version- npm publish --tag ${{ inputs.tag }} --provenance+ npm version prerelease --preid="${RC_PREID}.${{ github.run_number }}" --no-git-tag-version+ npm publish --tag "$RC_TAG" --provenance- name: Reinstall dependenciesif: ${{ inputs.js-sdk || inputs.cli }}@@ -110,6 +113,9 @@ jobs:- name: Publish CLI RCif: ${{ inputs.cli }}working-directory: packages/cli+ env:+ RC_PREID: ${{ inputs.preid }}+ RC_TAG: ${{ inputs.tag }}run: |- npm version prerelease --preid=${{ inputs.preid }}.${{ github.run_number }} --no-git-tag-version- npm publish --tag ${{ inputs.tag }} --provenance+ npm version prerelease --preid="${RC_PREID}.${{ github.run_number }}" --no-git-tag-version+ npm publish --tag "$RC_TAG" --provenancediff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex ad5cc31d2..269b6928b 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -172,8 +172,9 @@ jobs:steps:- name: Sanitize tagid: tag+ env:+ RAW_TAG: ${{ github.event.inputs.tag }}run: |- RAW_TAG="${{ github.event.inputs.tag }}"SAFE_TAG="$(echo "$RAW_TAG" | sed 's/[^0-9A-Za-z-]/-/g')"echo "tag=$SAFE_TAG" >> "$GITHUB_OUTPUT"@@ -186,8 +187,9 @@ jobs:- name: Sanitize preidid: preid+ env:+ RAW_PREID: ${{ github.event.inputs.preid || github.ref_name }}run: |- RAW_PREID="${{ github.event.inputs.preid || github.ref_name }}"echo "preid=$(echo "$RAW_PREID" | sed 's/[^0-9A-Za-z-]/-/g')" >> "$GITHUB_OUTPUT"rc-python-tests:diff --git a/packages/cli/src/commands/sandbox/utils.ts b/packages/cli/src/commands/sandbox/utils.tsindex 11070c800..063e60ba6 100644--- a/packages/cli/src/commands/sandbox/utils.ts+++ b/packages/cli/src/commands/sandbox/utils.ts@@ -53,7 +53,8 @@ export async function isRunning(sandboxID: string) {apiKey,})return info.state === 'running'- } catch {+ } catch (err) {+ console.error(`Failed to check sandbox status: ${err}`)return false}}diff --git a/packages/js-sdk/tests/sandbox/internetAccess.test.ts b/packages/js-sdk/tests/sandbox/internetAccess.test.tsindex c67cd996b..498d3e4fc 100644--- a/packages/js-sdk/tests/sandbox/internetAccess.test.ts+++ b/packages/js-sdk/tests/sandbox/internetAccess.test.ts@@ -15,10 +15,10 @@ describe('internet access enabled', () => {async ({ sandbox }) => {// Test internet connectivity by making a curl request to a reliable external siteconst result = await sandbox.commands.run(- "curl -s -o /dev/null -w '%{http_code}' https://e2b.dev"+ "curl -s -o /dev/null -w '%{http_code}' https://connectivitycheck.gstatic.com/generate_204")assert.equal(result.exitCode, 0)- assert.equal(result.stdout.trim(), '200')+ assert.equal(result.stdout.trim(), '204')})})@@ -36,7 +36,7 @@ describe('internet access disabled', () => {// Test that internet connectivity is blocked by making a curl requesttry {await sandbox.commands.run(- 'curl --connect-timeout 3 --max-time 5 -Is https://e2b.dev'+ 'curl --connect-timeout 3 --max-time 5 -Is https://connectivitycheck.gstatic.com/generate_204')// If we reach here, the command succeeded, which means internet access is not properly disabledassert.fail('Expected command to fail when internet access is disabled')@@ -55,10 +55,10 @@ describe('internet access default', () => {async ({ sandbox }) => {// Test internet connectivity by making a curl request to a reliable external siteconst result = await sandbox.commands.run(- "curl -s -o /dev/null -w '%{http_code}' https://e2b.dev"+ "curl -s -o /dev/null -w '%{http_code}' https://connectivitycheck.gstatic.com/generate_204")assert.equal(result.exitCode, 0)- assert.equal(result.stdout.trim(), '200')+ assert.equal(result.stdout.trim(), '204')})})diff --git a/packages/python-sdk/pytest.ini b/packages/python-sdk/pytest.iniindex b3593565b..a4ef0d93d 100644--- a/packages/python-sdk/pytest.ini+++ b/packages/python-sdk/pytest.ini@@ -5,7 +5,7 @@ markers =asyncio_mode=autoaddopts = "--import-mode=importlib"-timeout = 300+timeout = 30filterwarnings =ignore:'asyncio\.iscoroutinefunction' is deprecated.*:DeprecationWarning:pytest_asyncio\.pluginignore:'asyncio\.get_event_loop_policy' is deprecated.*:DeprecationWarning:pytest_asyncio\.plugindiff --git a/packages/python-sdk/tests/async/sandbox_async/test_internet_access.py b/packages/python-sdk/tests/async/sandbox_async/test_internet_access.pyindex 3a48249ab..4eb6e2f07 100644--- a/packages/python-sdk/tests/async/sandbox_async/test_internet_access.py+++ b/packages/python-sdk/tests/async/sandbox_async/test_internet_access.py@@ -10,10 +10,10 @@ async def test_internet_access_enabled(async_sandbox_factory):# Test internet connectivity by making a curl request to a reliable external siteresult = await sbx.commands.run(- "curl -s -o /dev/null -w '%{http_code}' https://e2b.dev"+ "curl -s -o /dev/null -w '%{http_code}' https://connectivitycheck.gstatic.com/generate_204")assert result.exit_code == 0- assert result.stdout.strip() == "200"+ assert result.stdout.strip() == "204"@pytest.mark.skip_debug()@@ -24,7 +24,7 @@ async def test_internet_access_disabled(async_sandbox_factory):# Test that internet connectivity is blocked by making a curl requestwith pytest.raises(CommandExitException) as exc_info:await sbx.commands.run(- "curl --connect-timeout 3 --max-time 5 -Is https://e2b.dev"+ "curl --connect-timeout 3 --max-time 5 -Is https://connectivitycheck.gstatic.com/generate_204")# The command should fail or timeout when internet access is disabledassert exc_info.value.exit_code != 0@@ -36,7 +36,7 @@ async def test_internet_access_default(async_sandbox):# Test internet connectivity by making a curl request to a reliable external siteresult = await async_sandbox.commands.run(- "curl -s -o /dev/null -w '%{http_code}' https://e2b.dev"+ "curl -s -o /dev/null -w '%{http_code}' https://connectivitycheck.gstatic.com/generate_204")assert result.exit_code == 0- assert result.stdout.strip() == "200"+ assert result.stdout.strip() == "204"diff --git a/packages/python-sdk/tests/async/template_async/conftest.py b/packages/python-sdk/tests/async/template_async/conftest.pynew file mode 100644index 000000000..520f64f20--- /dev/null+++ b/packages/python-sdk/tests/async/template_async/conftest.py@@ -0,0 +1,11 @@+import os++import pytest++_DIR = os.path.dirname(os.path.abspath(__file__))+++def pytest_collection_modifyitems(items):+ for item in items:+ if str(item.fspath).startswith(_DIR):+ item.add_marker(pytest.mark.timeout(180))diff --git a/packages/python-sdk/tests/conftest.py b/packages/python-sdk/tests/conftest.pyindex 6b2ad92e7..0ac8c938b 100644--- a/packages/python-sdk/tests/conftest.py+++ b/packages/python-sdk/tests/conftest.py@@ -41,9 +41,6 @@ def template():@pytest.fixture()def sandbox_factory(request, template, sandbox_test_id):def factory(*, template_name: str = template, **kwargs):- kwargs.setdefault("secure", False)- kwargs.setdefault("timeout", 5)-metadata = kwargs.setdefault("metadata", dict())metadata.setdefault("sandbox_test_id", sandbox_test_id)@@ -81,8 +78,6 @@ def event_loop():@pytest.fixturedef async_sandbox_factory(request, template, sandbox_test_id, event_loop):async def factory(*, template_name: str = template, **kwargs):- kwargs.setdefault("timeout", 5)-metadata = kwargs.setdefault("metadata", dict())metadata.setdefault("sandbox_test_id", sandbox_test_id)diff --git a/packages/python-sdk/tests/sync/sandbox_sync/test_internet_access.py b/packages/python-sdk/tests/sync/sandbox_sync/test_internet_access.pyindex fecb2f9ba..d35216c01 100644--- a/packages/python-sdk/tests/sync/sandbox_sync/test_internet_access.py+++ b/packages/python-sdk/tests/sync/sandbox_sync/test_internet_access.py@@ -9,9 +9,11 @@ def test_internet_access_enabled(sandbox_factory):sbx = sandbox_factory(allow_internet_access=True)# Test internet connectivity by making a curl request to a reliable external site- result = sbx.commands.run("curl -s -o /dev/null -w '%{http_code}' https://e2b.dev")+ result = sbx.commands.run(+ "curl -s -o /dev/null -w '%{http_code}' https://connectivitycheck.gstatic.com/generate_204"+ )assert result.exit_code == 0- assert result.stdout.strip() == "200"+ assert result.stdout.strip() == "204"@pytest.mark.skip_debug()@@ -21,7 +23,9 @@ def test_internet_access_disabled(sandbox_factory):# Test that internet connectivity is blocked by making a curl requestwith pytest.raises(CommandExitException) as exc_info:- sbx.commands.run("curl --connect-timeout 3 --max-time 5 -Is https://e2b.dev")+ sbx.commands.run(+ "curl --connect-timeout 3 --max-time 5 -Is https://connectivitycheck.gstatic.com/generate_204"+ )# The command should fail or timeout when internet access is disabledassert exc_info.value.exit_code != 0@@ -32,7 +36,7 @@ def test_internet_access_default(sandbox):# Test internet connectivity by making a curl request to a reliable external siteresult = sandbox.commands.run(- "curl -s -o /dev/null -w '%{http_code}' https://e2b.dev"+ "curl -s -o /dev/null -w '%{http_code}' https://connectivitycheck.gstatic.com/generate_204")assert result.exit_code == 0- assert result.stdout.strip() == "200"+ assert result.stdout.strip() == "204"diff --git a/packages/python-sdk/tests/sync/template_sync/conftest.py b/packages/python-sdk/tests/sync/template_sync/conftest.pynew file mode 100644index 000000000..520f64f20--- /dev/null+++ b/packages/python-sdk/tests/sync/template_sync/conftest.py@@ -0,0 +1,11 @@+import os++import pytest++_DIR = os.path.dirname(os.path.abspath(__file__))+++def pytest_collection_modifyitems(items):+ for item in items:+ if str(item.fspath).startswith(_DIR):+ item.add_marker(pytest.mark.timeout(180))