Skip to content

fix: count non-dict items in outputs_count#12166

Merged
Kosinkadink merged 1 commit intomasterfrom
cbyrne/fix-outputs-count-non-dict
Jan 30, 2026
Merged

fix: count non-dict items in outputs_count#12166
Kosinkadink merged 1 commit intomasterfrom
cbyrne/fix-outputs-count-non-dict

Conversation

@christian-byrne
Copy link
Contributor

Fix outputs_count not counting non-dict output items (e.g., text strings from PreviewAny node).

Problem

The get_outputs_summary() function in comfy_execution/jobs.py increments count after the isinstance(item, dict) check, causing non-dict items to be skipped from the count.

Text outputs from nodes like PreviewAny come as inline strings ["test"] rather than dicts, so they were never counted. This caused outputs_count: 0 in the jobs API response even when text outputs existed, which prevented the frontend from fetching and displaying them. Example problem:

curl "http://localhost:8188/api/jobs/9c1e37e9-7644-4189-a456-88935b629d70" | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2243  100  2243    0     0  2589k      0 --:--:-- --:--:-- --:--:-- 2190k
{
  "id": "9c1e37e9-7644-4189-a456-88935b629d70",
  "status": "completed",
  "priority": 0,
  "create_time": 1769675441110,
  "execution_start_time": 1769675441111,
  "execution_end_time": 1769675441129,
  "outputs_count": 0,
  "workflow_id": "d2a78457-e57e-448b-a5dc-b1c4edbf74a0",
  "outputs": {
    "37": {
      "text": [
        "test"
      ]
    }
  },

The solution in this PR aligns OSS Python with Cloud's Go implementation which uses len(itemsArray) to count ALL items regardless of type.

Move count increment before isinstance(item, dict) check so that
non-dict output items (like text strings from PreviewAny node)
are included in outputs_count.

This aligns OSS Python with Cloud's Go implementation which uses
len(itemsArray) to count ALL items regardless of type.

Amp-Thread-ID: https://ampcode.com/threads/T-019c0bb5-14e0-744f-8808-1e57653f3ae3
Co-authored-by: Amp <amp@ampcode.com>
@christian-byrne christian-byrne added the Core Core team dependency label Jan 29, 2026
@christian-byrne
Copy link
Contributor Author

This only affects /jobs API so the risk is low (only consumed by pre-release versions of the frontend). It matches cloud implementation, so it has also already been tested.

Copy link
Member

@Kosinkadink Kosinkadink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, merging

@Kosinkadink Kosinkadink merged commit 3aace5c into master Jan 30, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Core Core team dependency

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants