From c267e73ca66099f13a5980248e74822f751f0d73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9B=90=E7=B2=92=20Yanli?= Date: Tue, 18 Aug 2026 03:29:50 +0000 Subject: [PATCH] fix(dify-agent): use E2B traffic access header (#40891) --- dify-agent/src/dify_agent/runtime_backend/e2b.py | 4 ++-- dify-agent/tests/local/dify_agent/runtime_backend/test_e2b.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dify-agent/src/dify_agent/runtime_backend/e2b.py b/dify-agent/src/dify_agent/runtime_backend/e2b.py index 376a43a54b7..3140391eb13 100644 --- a/dify-agent/src/dify_agent/runtime_backend/e2b.py +++ b/dify-agent/src/dify_agent/runtime_backend/e2b.py @@ -312,13 +312,13 @@ class E2BExecutionBindingBackend: raise BindingAcquireError("E2B sandbox did not provide a traffic access token") http_client = httpx.AsyncClient( base_url=entrypoint, - headers={"X-Access-Token": traffic_token}, + headers={"e2b-traffic-access-token": traffic_token}, follow_redirects=True, timeout=httpx.Timeout(60.0), ) # Explicit token="" prevents process-level SHELLCTL_AUTH_TOKEN fallback; - # E2B port access is authenticated only by X-Access-Token above. + # E2B port access is authenticated only by e2b-traffic-access-token above. def client_factory() -> ShellctlClientProtocol: from shellctl.client import ShellctlClient diff --git a/dify-agent/tests/local/dify_agent/runtime_backend/test_e2b.py b/dify-agent/tests/local/dify_agent/runtime_backend/test_e2b.py index 60b09224344..9dcddff2b8c 100644 --- a/dify-agent/tests/local/dify_agent/runtime_backend/test_e2b.py +++ b/dify-agent/tests/local/dify_agent/runtime_backend/test_e2b.py @@ -336,7 +336,8 @@ async def test_e2b_acquire_retries_transient_shellctl_failures_until_ready( def handler(request: httpx.Request) -> httpx.Response: nonlocal attempts attempts += 1 - assert request.headers["X-Access-Token"] == "traffic-token" + assert request.headers["e2b-traffic-access-token"] == "traffic-token" + assert "X-Access-Token" not in request.headers assert "Authorization" not in request.headers if attempts == 1: raise httpx.ReadTimeout("shellctl starting", request=request)