Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
254cd8f
feat(sdk): Go SDK with oapi-codegen for Lifecycle, Execd, and Egress …
AlexandrePh Mar 30, 2026
61a8b7f
feat(sdk): add high-level Sandbox API, SandboxManager, and Go e2e tests
AlexandrePh Mar 30, 2026
ebdb986
refactor(sdk): simplify code from review — DRY config, strings.Builde…
AlexandrePh Mar 30, 2026
f2dfd1a
feat(sdk): expand e2e coverage — filesystem CRUD, sessions, connect, …
AlexandrePh Mar 30, 2026
e37f1f8
feat(sdk): add CodeInterpreter wrapper + 6 e2e tests
AlexandrePh Mar 30, 2026
7de8373
feat(sdk): close e2e gaps — env injection, sessions, volumes, network…
AlexandrePh Mar 30, 2026
6fe1ad8
feat(sdk): add real scenario e2e tests — LLM agent in sandbox
AlexandrePh Mar 30, 2026
7fa5d42
docs(sdk): add Go SDK examples — agent loop + code interpreter agent
AlexandrePh Mar 30, 2026
dece184
style(sdk): run gofmt on Go SDK files
AlexandrePh Mar 30, 2026
8440231
fix(sdk): address code review — error handling, race condition, doc a…
AlexandrePh Mar 30, 2026
7959da0
fix(sdk): replace sync.Once with mutex for endpoint resolution
AlexandrePh Mar 30, 2026
5a83b20
test(sdk): add concurrent sandbox creation test + PVC volume test now…
AlexandrePh Mar 30, 2026
9d6a77c
fix(sdk): address Copilot review — nested events, unused config, test…
AlexandrePh Mar 30, 2026
d83a932
fix(sdk): parse nested error/results objects per execd OpenAPI spec
AlexandrePh Mar 30, 2026
d50d837
docs(sdk): fix README streaming example and stale API signatures
AlexandrePh Mar 30, 2026
22f8493
fix(sdk): preserve endpoint headers and apply custom headers to strea…
AlexandrePh Mar 30, 2026
8c4b239
feat(sdk): address review — image auth, manual cleanup, resume, CI, p…
AlexandrePh Apr 2, 2026
ae0fcac
feat(sdk): e2e tests for pause/resume, manual cleanup + EndpointHostR…
AlexandrePh Apr 2, 2026
2b7c624
test(sdk): close all Go SDK test coverage gaps (43% → 100%)
AlexandrePh Apr 2, 2026
9eca358
test(sdk): close E2E parity gaps with other language SDKs
AlexandrePh Apr 2, 2026
9fc6a19
test(sdk): add staging tests for PVC volumes, network policy, env vars
AlexandrePh Apr 2, 2026
1dafec7
fix(sdk): egress client missing auth header through server proxy
AlexandrePh Apr 2, 2026
f900bb6
revert(sdk): remove egress proxy auth workaround, fix Caddy instead
AlexandrePh Apr 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions .github/workflows/real-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -360,3 +360,84 @@ jobs:
docker ps -aq --filter "label=opensandbox" | xargs -r docker rm -f || true
docker run --rm -v /tmp:/host_tmp alpine rm -rf /host_tmp/opensandbox-e2e || true
pkill -f "python -m opensandbox_server.main" || true

go-e2e:
name: Go E2E (docker bridge)
runs-on: self-hosted
env:
UV_BIN: /home/admin/.local/bin
steps:
- name: Checkout code
uses: actions/checkout@v6

- name: Set up uv PATH and verify
run: |
echo "${UV_BIN}" >> "$GITHUB_PATH"
export PATH="${UV_BIN}:${PATH}"
uv --version
uv run python --version

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.24"
cache-dependency-path: sdks/sandbox/go/go.sum

- name: Clean up previous E2E resources
run: |
docker ps -aq --filter "label=opensandbox" | xargs -r docker rm -f || true
docker run --rm -v /tmp:/host_tmp alpine rm -rf /host_tmp/opensandbox-e2e || true
docker image prune -f || true

- name: Build local egress image
run: docker build -t opensandbox/egress:local -f components/egress/Dockerfile .

- name: Run tests
run: |
set -e

cat <<EOF > ~/.sandbox.toml
[server]
host = "127.0.0.1"
port = 8080
log_level = "INFO"
api_key = ""
[runtime]
type = "docker"
execd_image = "opensandbox/execd:local"
[egress]
image = "opensandbox/egress:local"
[docker]
network_mode = "bridge"
[storage]
allowed_host_paths = ["/tmp/opensandbox-e2e"]
EOF

bash ./scripts/go-e2e.sh

- name: Eval server logs
if: ${{ always() }}
run: cat server/server.log

- name: Upload Test Report
if: always()
uses: actions/upload-artifact@v7
with:
name: go-test-report
path: tests/go/reports/
retention-days: 5

- name: Upload execd logs
if: always()
uses: actions/upload-artifact@v7
with:
name: execd-log-for-go-e2e
path: /tmp/opensandbox-e2e/logs/
retention-days: 5

- name: Clean up after E2E
if: always()
run: |
docker ps -aq --filter "label=opensandbox" | xargs -r docker rm -f || true
docker run --rm -v /tmp:/host_tmp alpine rm -rf /host_tmp/opensandbox-e2e || true
pkill -f "python -m opensandbox_server.main" || true
33 changes: 33 additions & 0 deletions .github/workflows/sdk-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -364,3 +364,36 @@ jobs:
name: csharp-${{ matrix.package_name }}-reports
path: |
${{ matrix.package_dir }}/TestResults/**

go-sdk-quality:
name: Go SDK Quality And Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.24"
cache-dependency-path: sdks/sandbox/go/go.sum

- name: Run go vet
working-directory: sdks/sandbox/go
run: |
go vet ./...

- name: Run tests with race detector
working-directory: sdks/sandbox/go
run: |
mkdir -p reports
go test -v -race -coverprofile=reports/coverage.out ./...
go tool cover -func=reports/coverage.out

- name: Upload Go reports
if: always()
uses: actions/upload-artifact@v4
with:
name: go-sdk-reports
path: |
sdks/sandbox/go/reports/**
36 changes: 36 additions & 0 deletions docker-compose.test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
configs:
opensandbox-config:
content: |
[server]
host = "0.0.0.0"
port = 8090
log_level = "INFO"

[runtime]
type = "docker"
execd_image = "opensandbox/execd:v1.0.9"

[egress]
image = "opensandbox/egress:v1.0.4"

[docker]
network_mode = "bridge"
host_ip = "host.docker.internal"
pids_limit = 4096

[ingress]
mode = "direct"

services:
opensandbox-server:
image: opensandbox/server:latest
container_name: opensandbox-test-server
ports:
- "8091:8090"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
configs:
- source: opensandbox-config
target: /etc/opensandbox/config.toml
environment:
- SANDBOX_CONFIG_PATH=/etc/opensandbox/config.toml
57 changes: 57 additions & 0 deletions scripts/go-e2e.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/bash
# Copyright 2025 Alibaba Group Holding Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -euxo pipefail

TAG=${TAG:-latest}

REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"

# build execd image locally (context must include internal/)
docker build -f components/execd/Dockerfile -t opensandbox/execd:local "${REPO_ROOT}"

# prepare required images from registry
docker pull opensandbox/code-interpreter:${TAG}
echo "-------- Eval test images --------"
docker images

# prepare hostpath volume for e2e test
mkdir -p /tmp/opensandbox-e2e/host-volume-test
mkdir -p /tmp/opensandbox-e2e/logs
echo "opensandbox-e2e-marker" > /tmp/opensandbox-e2e/host-volume-test/marker.txt
chmod -R 755 /tmp/opensandbox-e2e

# prepare Docker named volume for pvc e2e test
docker volume rm opensandbox-e2e-pvc-test 2>/dev/null || true
docker volume create opensandbox-e2e-pvc-test
# seed the named volume with a marker file and subpath test data via a temporary container
docker run --rm -v opensandbox-e2e-pvc-test:/data alpine sh -c "\
echo 'pvc-marker-data' > /data/marker.txt && \
mkdir -p /data/datasets/train && \
echo 'pvc-subpath-marker' > /data/datasets/train/marker.txt"
echo "-------- GO E2E test logs for execd --------" > /tmp/opensandbox-e2e/logs/execd.log

# setup server
cd server
uv sync && uv run python -m opensandbox_server.main > server.log 2>&1 &
cd ..

# wait for server
sleep 10

# run Go e2e tests
cd tests/go
mkdir -p reports
go test -v -tags=e2e -timeout 5m ./... 2>&1 | tee reports/test-output.txt
27 changes: 27 additions & 0 deletions sdks/sandbox/go/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.PHONY: all build vet test lint generate

all: build vet test

generate:
cd opensandbox/api/lifecycle && oapi-codegen --config cfg.yaml ../specs/sandbox-lifecycle.yml
cd opensandbox/api/execd && oapi-codegen --config cfg.yaml ../specs/execd-api.yaml
cd opensandbox/api/egress && oapi-codegen --config cfg.yaml ../specs/egress-api.yaml
@echo "Generated all API clients from OpenAPI specs"

build:
go build ./...

vet:
go vet ./...

test:
go test ./opensandbox/ -v

test-integration:
go test -tags=integration ./opensandbox/ -v -timeout 3m

test-staging:
go test -tags=staging ./opensandbox/ -v -timeout 3m

lint:
@which staticcheck >/dev/null 2>&1 && staticcheck ./... || echo "staticcheck not installed — skipping lint"
Loading
Loading