Skip to content

MCP gateway startup failure leaves orphaned sandbox running #1498

Description

@AdaAibaby

Body:

When Sandbox.create() is called with an mcp config and the MCP gateway fails to start (non-zero exit code or exception from commands.run), the already-created sandbox is never killed. This leaves orphaned sandboxes consuming resources until they time out.

Affected: Python SDK (async + sync) and JS/TS SDK.

Steps to reproduce:

Call Sandbox.create(mcp={"invalid_server": {}}) with a config that causes mcp-gateway to fail
Observe the exception is raised
The sandbox remains running (visible via Sandbox.list())
Expected: The sandbox should be killed before the error is propagated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions