From ee9e187899b19752dcd7280c9c5c8741c74f4cd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=CC=A7ag=CC=86an=20Kiraz?= Date: Thu, 6 Aug 2026 12:45:52 +0300 Subject: [PATCH] fix(api): handle reasoning and generating polling statuses BFL's get_result reference documents two intermediate statuses the Status enum was missing: Reasoning and Generating (returned by FLUX 3 tasks). Status(status) raised ValueError on them, which landed in the JSON-parsing error handler with a misleading log line. Both now retry like Pending, and the retry log prints the actual status. --- nodes/base.py | 4 ++-- nodes/status.py | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/nodes/base.py b/nodes/base.py index b964e33..1e144a5 100644 --- a/nodes/base.py +++ b/nodes/base.py @@ -107,8 +107,8 @@ class BaseFlux: if Status(status) == Status.READY: print(f"[BFL] Task {task_id} ready after {elapsed:.1f}s — downloading image") return self.process_result(result, output_format=output_format) - elif Status(status) == Status.PENDING: - print(f"[BFL] Attempt {attempt}/{max_attempts}: pending — retrying in 5s") + elif Status(status) in [Status.PENDING, Status.REASONING, Status.GENERATING]: + print(f"[BFL] Attempt {attempt}/{max_attempts}: {status} — retrying in 5s") attempt += 1 if attempt <= max_attempts: time.sleep(5) diff --git a/nodes/status.py b/nodes/status.py index ba4efe5..826828d 100644 --- a/nodes/status.py +++ b/nodes/status.py @@ -1,9 +1,12 @@ from enum import Enum + class Status(Enum): TASK_NOT_FOUND = "Task not found" PENDING = "Pending" + REASONING = "Reasoning" + GENERATING = "Generating" REQUEST_MODERATED = "Request Moderated" CONTENT_MODERATED = "Content Moderated" READY = "Ready" - ERROR = "Error" \ No newline at end of file + ERROR = "Error"