mirror of
https://github.com/langgenius/dify.git
synced 2026-08-31 01:36:38 +08:00
fix(dify-agent): use E2B traffic access header (#40891)
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user