From 21794e1e34a75c47b96e53f22b9bae42b7c15cc8 Mon Sep 17 00:00:00 2001 From: HowardYangAI <13777842855@163.com> Date: Sun, 22 Nov 2026 20:07:06 +0800 Subject: [PATCH] [bugfix] provider: treat a failed vLLM video poll with HTTP 400 as terminal vLLM-Omni returns a failed Video object with HTTP 400 when a request is rejected after it was accepted (for example, MiniMax-H3 input errors). Terminal evidence was only accepted for HTTP 200, or HTTP 500 with the queried job's identity, so a 400 left providerStatus empty. The job was then stored as recovery=remote with resumeAllowed=true, which blocks switching the node's history versions. Accept HTTP 400 under the same identity check as HTTP 500: object=video and the id must match the polled job. --- .../src/opendirector/integrations/generation_errors.py | 9 ++++++--- tests/test_self_hosted_queue.py | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/core/src/opendirector/integrations/generation_errors.py b/packages/core/src/opendirector/integrations/generation_errors.py index 994bd5a52..01b5c5e7b 100644 --- a/packages/core/src/opendirector/integrations/generation_errors.py +++ b/packages/core/src/opendirector/integrations/generation_errors.py @@ -11,6 +11,9 @@ logger = logging.getLogger(__name__) +# HTTP statuses under which a polled vLLM video job may still carry its own failed status. +_VIDEO_FAILURE_STATUSES = {400, 500} + _REASONS = { 'input': ('生成服务拒绝了输入内容或参数。', '请检查生成要求、参数和模型支持范围。'), 'reference': ('生成服务拒绝了参考素材。', '请更换符合服务要求的参考素材,再决定是否重新生成。'), @@ -132,9 +135,9 @@ def provider_failure(value, *, stage, headers=None, http_status=None, secrets=() suggestion = '请核对原任务和结果链接,恢复下载前不要直接重新生成。' terminal_status = None if stage == 'poll' and value.get('status') in {'failed', 'cancelled', 'expired'}: - # vLLM can return a failed Video object with HTTP 500. A gateway error + # vLLM can return a failed Video object with HTTP 400 or 500. A gateway error # is not terminal evidence: require the queried job's exact identity. - if http_status == 200 or (http_status == 500 and expected_task_id + if http_status == 200 or (http_status in _VIDEO_FAILURE_STATUSES and expected_task_id and value.get('object') == 'video' and value.get('id') == expected_task_id): terminal_status = value['status'] if terminal_status == 'failed' and (category == 'temporary' or provider == 'kling' and category == 'provider'): @@ -162,7 +165,7 @@ async def checked(response, *, stage, secrets=()): except (ValueError, UnicodeError): value = None expected_task_id = None - if stage == 'poll' and response.status_code == 500: + if stage == 'poll' and response.status_code in _VIDEO_FAILURE_STATUSES: try: match = re.search(r'/videos/([^/]+)$', response.request.url.path) except RuntimeError: # Detached responses cannot prove task identity. diff --git a/tests/test_self_hosted_queue.py b/tests/test_self_hosted_queue.py index 71d7c0b2b..05063cc69 100644 --- a/tests/test_self_hosted_queue.py +++ b/tests/test_self_hosted_queue.py @@ -319,6 +319,8 @@ async def run(): @pytest.mark.parametrize('status, object_type, returned_id, terminal', [ (200, 'video', 'original-remote', True), + (400, 'video', 'original-remote', True), + (400, 'video', 'another-job', False), (500, 'video', 'original-remote', True), (500, 'video', 'another-job', False), (500, 'error', 'original-remote', False),