Feature/workflow batch cache - #2730
Conversation
while the stream runs one frame at a time; slice by frame_id so batch lengths match the current image batch.
serialize_single_workflow_result_field assigned the whole kind list instead of the current element when a kind is a plain string (not a Kind object), making kinds_serializers.get() throw "unhashable type: 'list'". String kinds occur for outputs resolving to WorkflowBatchInput lineage, e.g. selectors rewritten to injected batch inputs. Use the element; unknown kinds keep the existing raw-value fallback.
|
👋 Thanks for the pull request! Here is how automated Claude review works here, so you spend credits (and reviewer time) wisely. 🚧 Right now this is a draft, so automated Claude review is paused — nothing is being spent yet. Mark it Ready for review to trigger it. Warning 💸 The Claude reviewer bills in credits, not vibesAutomated review spins up a real agent that reads real code and spends real credits on every pass. It is glad to help — but it is not a rubber duck, a linter you poke in a loop, or a substitute for reading the contributing guide. Treat it like an expensive senior reviewer whose time you booked, and show up prepared. Draft when unsure, Ready when you mean it:
However you get there, arrive prepared:
Reviews are not free. A draft costs nothing to review; a Ready PR is a promise that it is worth reviewing.
|
What does this PR do?
Fixes a
TypeError: unhashable type: 'list'(HTTP 500) in workflow output serialization.In
serialize_single_workflow_result_field(
inference/core/workflows/execution_engine/v1/executor/output_constructor.py), theper-kind loop resolves the serializer key as:
When single_kind is a plain string rather than a Kind object, the else branch
assigns kind — the whole list — instead of single_kind, and
kinds_serializers.get() raises unhashable type: 'list', failing the entire
/workflows/run request.
The string-kind case is reachable whenever an output resolves to input-induced lineage
whose kind declarations are raw strings from the workflow JSON — e.g. an output whose
selector points at a WorkflowBatchInput. Concretely: any workflow that pre-computes a
block's outputs client-side and injects them as a WorkflowBatchInput (with the output
selector rewritten to that input) hits this on every run.
One-word fix: else single_kind. With it, string kinds resolve serializers normally, and
kinds without a registered serializer fall through to the existing raw-value passthrough
instead of crashing.
Related Issue(s): none filed — found while building block-output caching for Workflow
Builder previews (roboflow/roboflow), which rewrites cached blocks' output selectors to
injected WorkflowBatchInputs and hits this path on every cached image-preview run.
Type of Change
Testing
Test details:
Reproduced against a local inference server with a workflow whose output selector points
at a WorkflowBatchInput (cached-block preview run from the Workflow Builder):
POST /workflows/run returned 500 with the traceback above. After the fix, the same
request serializes correctly and returns 200 with the expected outputs. No unit test
added — happy to add one exercising serialize_single_workflow_result_field with a
string kind if maintainers want it in this PR.
Checklist
Additional Context
The bug is dormant in most workflows because kinds attached to step outputs arrive as
Kind objects — only the string-kind branch is affected, which is why it survived
unnoticed. Full traceback for searchability:
File ".../executor/output_constructor.py", line 509, in serialize_single_workflow_result_field
serializer = kinds_serializers.get(kind_name)
TypeError: unhashable type: 'list'
One honest gap flagged in the form: no unit test in the diff. If you want it bulletproof before review, say so — a ~10-line test on
serialize_single_workflow_result_fieldwith a string kind would pin it, and I can write it in yourinference checkout now.