Skip to content

fix(dify-agent): retry E2B Shellctl connects in transport - #39879

Draft
zhaohao1004 wants to merge 1 commit into
mainfrom
zhaohao1004/fix-dify-agent-e2b-shellctl-retry
Draft

fix(dify-agent): retry E2B Shellctl connects in transport#39879
zhaohao1004 wants to merge 1 commit into
mainfrom
zhaohao1004/fix-dify-agent-e2b-shellctl-retry

Conversation

@zhaohao1004

Copy link
Copy Markdown
Contributor

Summary

  • retry transient E2B Shellctl connection failures in the HTTP transport
  • keep retry policy scoped to the E2B data-plane client
  • verify the configured transport retry count during Binding acquisition

Root cause

An E2B Sandbox may be connectable through the control plane before its Shellctl endpoint is ready to accept a TCP/TLS connection. A first data-plane request can therefore fail with ConnectError or ConnectTimeout during resume startup.

Retrying the complete Shell adapter operation would re-enter the logical request and can expand its timeout. Connection readiness retries belong at the HTTP transport boundary instead.

Implementation

  • configure the E2B Shellctl AsyncClient with AsyncHTTPTransport(retries=2)
  • preserve the existing Shell adapter behavior without adding an application-level retry loop
  • rely on HTTPX transport semantics so only connection errors and connection timeouts are retried

Impact

E2B Shellctl connections receive up to two additional connection attempts during transient startup races. Read failures, HTTP responses, and accepted Shell jobs are not retried.

Transport retries use per-connection timeouts; this change does not add a hard wall-clock deadline around the complete operation.

Validation

  • make -C dify-agent check
  • Ruff format check for both changed files
  • focused Python 3.12 E2B backend tests: 6 passed

Scope

This PR changes only the E2B Runtime backend and its focused test. It contains no Config Layer changes and is independent of #39873.

From Codex

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant