From 98a1aa38f9a228ef26ffd4bd657e0aa828066aaa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 29 Jul 2026 02:14:06 +0000 Subject: [PATCH 1/3] chore(deps): bump github.com/alibaba/OpenSandbox/sdks/sandbox/go Bumps [github.com/alibaba/OpenSandbox/sdks/sandbox/go](https://github.com/alibaba/OpenSandbox) from 1.0.4 to 1.0.5. - [Release notes](https://github.com/alibaba/OpenSandbox/releases) - [Commits](https://github.com/alibaba/OpenSandbox/compare/docker/execd/v1.0.4...docker/execd/v1.0.5) --- updated-dependencies: - dependency-name: github.com/alibaba/OpenSandbox/sdks/sandbox/go dependency-version: 1.0.5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index b06cb11..b178bb3 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/yuluo-yx/agentscope-go go 1.26.4 require ( - github.com/alibaba/OpenSandbox/sdks/sandbox/go v1.0.4 + github.com/alibaba/OpenSandbox/sdks/sandbox/go v1.0.5 github.com/anthropics/anthropic-sdk-go v1.58.1 github.com/cloudevents/sdk-go/v2 v2.16.2 github.com/daytonaio/daytona/libs/sdk-go v0.190.0 diff --git a/go.sum b/go.sum index 96f91ee..a105911 100644 --- a/go.sum +++ b/go.sum @@ -8,8 +8,8 @@ cloud.google.com/go/compute/metadata v0.9.0/go.mod h1:E0bWwX5wTnLPedCKqk3pJmVgCB github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= -github.com/alibaba/OpenSandbox/sdks/sandbox/go v1.0.4 h1:HBfEpY3rsNIznmcQeF92YyZ2zI1TpgVOMA2Rgih2Mmc= -github.com/alibaba/OpenSandbox/sdks/sandbox/go v1.0.4/go.mod h1:w0nIMCTL1L3oSS67ABFOdYxrezYQZhk01UtmKSi2UhA= +github.com/alibaba/OpenSandbox/sdks/sandbox/go v1.0.5 h1:7mZNkBh4VaI+i4VOTJIknLCBkbGizTkdHYqgcMqeDBM= +github.com/alibaba/OpenSandbox/sdks/sandbox/go v1.0.5/go.mod h1:w0nIMCTL1L3oSS67ABFOdYxrezYQZhk01UtmKSi2UhA= github.com/anthropics/anthropic-sdk-go v1.58.1 h1:ReZ+Inn6WBDOXUGY64ue7zA1uDoW8FFSzMU/lViFd4E= github.com/anthropics/anthropic-sdk-go v1.58.1/go.mod h1:3EfIfmFqxH6rbiLcIP4tPFyXL/IHakx2wDG4OU+TIEI= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= From 8edb244643bd45e178f47db18b2489eeab5842e4 Mon Sep 17 00:00:00 2001 From: yuluo-yx Date: Thu, 30 Jul 2026 23:43:54 +0800 Subject: [PATCH 2/3] test(opensandbox): capture MCP failure diagnostics --- pkg/workspace/opensandbox/integration_test.go | 85 ++++++++++++++++++- 1 file changed, 84 insertions(+), 1 deletion(-) diff --git a/pkg/workspace/opensandbox/integration_test.go b/pkg/workspace/opensandbox/integration_test.go index 5224f48..6094bd8 100644 --- a/pkg/workspace/opensandbox/integration_test.go +++ b/pkg/workspace/opensandbox/integration_test.go @@ -20,6 +20,7 @@ import ( "context" "crypto/rand" "encoding/hex" + "fmt" "os" "strings" "testing" @@ -141,7 +142,11 @@ if __name__ == "__main__": ExecutionTimeout: 30 * time.Second, }} if err := workspaceInstance.AddMCP(ctx, mcpClient); err != nil { - t.Fatalf("AddMCP returned error: %v", err) + t.Fatalf( + "AddMCP returned error: %v\n%s", + err, + openSandboxFailureDiagnostics(ctx, workspaceInstance, mcpScriptPath), + ) } mcps, err := workspaceInstance.ListMCPs(ctx) if err != nil || len(mcps) != 1 || mcps[0].Name() != "e2e-echo" { @@ -217,6 +222,84 @@ func executeIntegrationTool( return output.String() } +func openSandboxFailureDiagnostics( + ctx context.Context, + workspaceInstance *Workspace, + mcpScriptPath string, +) string { + var output strings.Builder + if workspaceInstance == nil || workspaceInstance.provider == nil { + return "diagnostics unavailable: workspace provider is nil" + } + + workspaceInstance.provider.mu.Lock() + handle := workspaceInstance.provider.handle + workspaceInstance.provider.mu.Unlock() + if handle == nil { + return "diagnostics unavailable: sandbox handle is nil" + } + + diagnosticCtx, cancel := context.WithTimeout(context.WithoutCancel(ctx), 30*time.Second) + defer cancel() + gatewayLog, err := handle.ReadFile( + diagnosticCtx, + defaultGatewayHome+"/gateway.log", + ) + if err != nil { + fmt.Fprintf(&output, "gateway log error: %v\n", err) + } else { + fmt.Fprintf(&output, "gateway log:\n%s\n", gatewayLog) + } + + versionScript := `import importlib.metadata as m +for package in ("agentscope", "mcp", "fastapi", "uvicorn"): + print(f"{package}={m.version(package)}") +` + appendDiagnosticCommand( + &output, + "python package versions", + handle, + diagnosticCtx, + []string{ + defaultGatewayHome + "/.venv/bin/python", + "-c", + versionScript, + }, + ) + appendDiagnosticCommand( + &output, + "MCP server probe", + handle, + diagnosticCtx, + []string{ + "timeout", + "5s", + defaultGatewayHome + "/.venv/bin/python", + mcpScriptPath, + }, + ) + return output.String() +} + +func appendDiagnosticCommand( + output *strings.Builder, + name string, + handle sandboxHandle, + ctx context.Context, + argv []string, +) { + result, err := handle.Run(ctx, argv, defaultWorkdir, nil, 10*time.Second) + fmt.Fprintf( + output, + "%s: error=%v exit=%d\nstdout:\n%s\nstderr:\n%s\n", + name, + err, + result.ExitCode, + result.Stdout, + result.Stderr, + ) +} + func cleanupOpenSandboxes( t *testing.T, ctx context.Context, From 65bdc5e20a86e48a4d69042be90a5b4da9aab5f2 Mon Sep 17 00:00:00 2001 From: yuluo-yx Date: Thu, 30 Jul 2026 23:56:48 +0800 Subject: [PATCH 3/3] fix(opensandbox): keep MCP Python SDK on v1 --- pkg/workspace/opensandbox/integration_test.go | 85 +------------------ .../opensandbox/options_workspace_test.go | 4 +- pkg/workspace/opensandbox/types.go | 1 + pkg/workspace/opensandbox/workspace.go | 2 +- 4 files changed, 6 insertions(+), 86 deletions(-) diff --git a/pkg/workspace/opensandbox/integration_test.go b/pkg/workspace/opensandbox/integration_test.go index 6094bd8..5224f48 100644 --- a/pkg/workspace/opensandbox/integration_test.go +++ b/pkg/workspace/opensandbox/integration_test.go @@ -20,7 +20,6 @@ import ( "context" "crypto/rand" "encoding/hex" - "fmt" "os" "strings" "testing" @@ -142,11 +141,7 @@ if __name__ == "__main__": ExecutionTimeout: 30 * time.Second, }} if err := workspaceInstance.AddMCP(ctx, mcpClient); err != nil { - t.Fatalf( - "AddMCP returned error: %v\n%s", - err, - openSandboxFailureDiagnostics(ctx, workspaceInstance, mcpScriptPath), - ) + t.Fatalf("AddMCP returned error: %v", err) } mcps, err := workspaceInstance.ListMCPs(ctx) if err != nil || len(mcps) != 1 || mcps[0].Name() != "e2e-echo" { @@ -222,84 +217,6 @@ func executeIntegrationTool( return output.String() } -func openSandboxFailureDiagnostics( - ctx context.Context, - workspaceInstance *Workspace, - mcpScriptPath string, -) string { - var output strings.Builder - if workspaceInstance == nil || workspaceInstance.provider == nil { - return "diagnostics unavailable: workspace provider is nil" - } - - workspaceInstance.provider.mu.Lock() - handle := workspaceInstance.provider.handle - workspaceInstance.provider.mu.Unlock() - if handle == nil { - return "diagnostics unavailable: sandbox handle is nil" - } - - diagnosticCtx, cancel := context.WithTimeout(context.WithoutCancel(ctx), 30*time.Second) - defer cancel() - gatewayLog, err := handle.ReadFile( - diagnosticCtx, - defaultGatewayHome+"/gateway.log", - ) - if err != nil { - fmt.Fprintf(&output, "gateway log error: %v\n", err) - } else { - fmt.Fprintf(&output, "gateway log:\n%s\n", gatewayLog) - } - - versionScript := `import importlib.metadata as m -for package in ("agentscope", "mcp", "fastapi", "uvicorn"): - print(f"{package}={m.version(package)}") -` - appendDiagnosticCommand( - &output, - "python package versions", - handle, - diagnosticCtx, - []string{ - defaultGatewayHome + "/.venv/bin/python", - "-c", - versionScript, - }, - ) - appendDiagnosticCommand( - &output, - "MCP server probe", - handle, - diagnosticCtx, - []string{ - "timeout", - "5s", - defaultGatewayHome + "/.venv/bin/python", - mcpScriptPath, - }, - ) - return output.String() -} - -func appendDiagnosticCommand( - output *strings.Builder, - name string, - handle sandboxHandle, - ctx context.Context, - argv []string, -) { - result, err := handle.Run(ctx, argv, defaultWorkdir, nil, 10*time.Second) - fmt.Fprintf( - output, - "%s: error=%v exit=%d\nstdout:\n%s\nstderr:\n%s\n", - name, - err, - result.ExitCode, - result.Stdout, - result.Stderr, - ) -} - func cleanupOpenSandboxes( t *testing.T, ctx context.Context, diff --git a/pkg/workspace/opensandbox/options_workspace_test.go b/pkg/workspace/opensandbox/options_workspace_test.go index f46b8d9..1e36f6a 100644 --- a/pkg/workspace/opensandbox/options_workspace_test.go +++ b/pkg/workspace/opensandbox/options_workspace_test.go @@ -168,7 +168,9 @@ func TestNewWorkspaceConstructsProviderSpec(t *testing.T) { t.Fatalf("create options mismatch: %#v", spec) } requirements := bootstrapCommands([]string{"httpx==0.28.1"})[5] - if !slices.Contains(requirements, "httpx==0.28.1") || requirements[len(requirements)-1] != "httpx==0.28.1" { + if !slices.Contains(requirements, pythonMCP) || + !slices.Contains(requirements, "httpx==0.28.1") || + requirements[len(requirements)-1] != "httpx==0.28.1" { t.Fatalf("bootstrap requirements mismatch: %#v", requirements) } agentScopeInstall := bootstrapCommands(nil)[6] diff --git a/pkg/workspace/opensandbox/types.go b/pkg/workspace/opensandbox/types.go index fee7461..9dc5bbd 100644 --- a/pkg/workspace/opensandbox/types.go +++ b/pkg/workspace/opensandbox/types.go @@ -35,6 +35,7 @@ const ( defaultGatewayHome = "/root/.agentscope" metadataWorkspaceID = "agentscope.workspace.id" pythonAgentScope = "agentscope==2.0.4" + pythonMCP = "mcp<2" ) // ResourceLimits aliases the OpenSandbox SDK resource limit map. diff --git a/pkg/workspace/opensandbox/workspace.go b/pkg/workspace/opensandbox/workspace.go index fe0be2a..4f6f844 100644 --- a/pkg/workspace/opensandbox/workspace.go +++ b/pkg/workspace/opensandbox/workspace.go @@ -152,7 +152,7 @@ func bootstrapCommands(extraRequirements []string) [][]string { requirements := make([]string, 0, 8+len(extraRequirements)) requirements = append(requirements, "uv", "pip", "install", "--python", gatewayPython, - "mcp", "uvicorn", "fastapi", + pythonMCP, "uvicorn", "fastapi", ) requirements = append(requirements, extraRequirements...) return [][]string{