fix(agent): align Binding file upload timeouts (#41027)

This commit is contained in:
Ingram Z authored and GitHub committed 2026-08-20 18:59:44 +00:00
1 parent 785ca4b915
commit 0ca99312c1
20 files changed
+154 -21

No files matched your search

+1
View File
@@ -76,6 +76,7 @@ def create_app(settings: ServerSettings | None = None) -> FastAPI:
execution_bindings=runtime_backend_profile.execution_bindings,
agent_stub_api_base_url=resolved_settings.agent_stub_api_base_url,
agent_stub_token_factory=agent_stub_token_factory,
download_command_timeout_seconds=resolved_settings.binding_file_download_command_timeout_seconds,
)
if runtime_backend_profile is not None
else None
@@ -39,7 +39,6 @@ logger = logging.getLogger(__name__)
_LIST_MAX_ENTRIES = 1000
_BROWSE_TIMEOUT_SECONDS = 60.0
_BROWSE_OUTPUT_MAX_BYTES = 1024 * 1024
_DOWNLOAD_TIMEOUT_SECONDS = 60.0
_DOWNLOAD_OUTPUT_MAX_BYTES = 32 * 1024
_PAYLOAD_BEGIN = "<<<DIFY_BINDING_FILE_BEGIN>>>"
_PAYLOAD_END = "<<<DIFY_BINDING_FILE_END>>>"
@@ -149,6 +148,7 @@ class BindingFileService:
execution_bindings: ExecutionBindingBackend
agent_stub_api_base_url: str | None
agent_stub_token_factory: ShellAgentStubTokenFactory | None
download_command_timeout_seconds: float
async def list_files(self, request: BindingFileListRequest) -> BindingFileListResponse:
try:
@@ -243,7 +243,7 @@ class BindingFileService:
f"dify-agent file upload --no-download-link {shlex.quote(resolved_path)}",
cwd=lease.layout.workspace_dir,
env=env,
timeout=_DOWNLOAD_TIMEOUT_SECONDS,
timeout=self.download_command_timeout_seconds,
max_output_bytes=_DOWNLOAD_OUTPUT_MAX_BYTES,
mode="stdio",
)
@@ -82,6 +82,7 @@ class ServerSettings(BaseSettings):
description="Maximum Agent Stub upload size in MiB",
validation_alias="DIFY_AGENT_STUB_UPLOAD_FILE_SIZE_LIMIT",
)
binding_file_download_command_timeout_seconds: float = Field(default=210.0, gt=0)
server_secret_key: str | None = None
api_token: str | None = None
shell_redact_patterns: str = ""