Skip to content

dcode --sandbox <provider> fails server startup with Blocking call to socket.socket.connect (blockbuster guard kills sync sandbox creation on the event loop) #6018

Description

Submission checklist

  • This is a bug, not a usage question.
  • I added a clear and descriptive title.
  • I searched existing issues and didn't find this.
  • I can reproduce this with the latest released version.
  • I included a minimal reproducible example and steps to reproduce.

Area (Required)

  • deepagents (SDK)
  • dcode
  • talon
  • acp
  • evals
  • harbor
  • daytona
  • modal
  • quickjs
  • runloop
  • vercel
  • langsmith-sandbox
  • Other / not sure / general

Related Issues / PRs

Reproduction Steps / Example Code (Python)

# langsmith (needs valid LANGSMITH_API_KEY or LANGSMITH_SANDBOX_API_KEY)
dcode --sandbox langsmith

# agentcore (needs AWS credentials)
dcode --sandbox agentcore

# Both abort before the server passes readiness. Reproduced on langsmith and agentcore

Error Message and Stack Trace (if applicable)

# langsmith
Error: Server failed to start: RuntimeError: Server graph 'agent' failed readiness
check (status: 500): Sandbox creation failed for 'langsmith': Failed to list
snapshots: Blocking call to socket.socket.connect

# agentcore
Error: Server failed to start: RuntimeError: Server graph 'agent' failed readiness
check (status: 500): Sandbox creation failed for 'agentcore': Blocking call to
socket.socket.connect

Description

dcode --sandbox <provider> fails at server startup for the synchronous-SDK providers I tried (langsmith and agentcore). The same failure was previously reproduced with daytona in #5278. The server runs python -m langgraph_cli dev, which arms the blockbuster blocking-I/O guard on the event loop (langgraph_runtime_inmem/queue.py -> _enable_blockbuster()). dcode's graph factory then creates the sandbox synchronously on that loop:

_make_graph()                      async  server_graph.py
  └─ create_sandbox(...)            sync  server_graph.py   ← creates context manager
       └─ __enter__()                 sync  server_graph.py   ← on the event loop
            └─ provider.get_or_create()  sync  sandbox_factory.py
                 └─ socket / filesystem I/O    ← guard fires here

For langsmith specifically, _LangSmithProvider._ensure_snapshot -> list_snapshots() uses the sync SandboxClient from langsmith.sandbox, so the first blocking HTTP connect raises BlockingError. The readiness probe 500s and startup aborts.

Unfortunately, inheriting LANGGRAPH_ALLOW_BLOCKING=true does not work around this: langgraph dev rewrites it from the CLI --allow-blocking option, which dcode does not pass, so it becomes false.

Suggested fix: offload the complete synchronous context-manager entry (create_sandbox(...) plus __enter__()) via asyncio.to_thread, with cancellation and late-cleanup handling. SandboxProvider.aget_or_create already exists but has zero call sites. Using AsyncSandboxClient would address LangSmith only; __exit__() currently runs from atexit, outside the guarded event loop.

Environment / System Info

OS: macOS 15.7.4
Python: 3.13.2
deepagents: 0.7.10
deepagents-code: 0.1.65
langsmith: 0.11.2
langgraph-cli: 0.4.31

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdcodeRelated to `deepagents-code`externalUser is not a member of the `langchain-ai` GitHub organizationlangsmith-sandboxLangSmith sandbox backend

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions