Comfy-Org / Comfy-Org/comfy-api-proxy

Successful output reports size_bytes: 0 despite retrievable content

Open
#26 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
11
Forks
5
Avg merge
1d 6h
Merged PRs (30d)
3

Description

## Bug description

A successful v2 job returns a retrievable output file, but the output metadata reports `size_bytes: 0`. The same incorrect size is returned by both the job response and the asset metadata endpoint.

`hash: null` was also returned, although the contract may allow hashes to be computed lazily; the definite defect is the zero byte count for an available file.

## Live reproduction

Observed against:

- `comfy-api-proxy` `2e52c6e01448242a3e23b452c81f9099c1e77d90` (`v0.1.4`)
- ComfyUI `0.31.0` on a remote `mando:8188`
- DarkBeast/Krea2 API-format text-to-image workflow
- Proxy started with `--state-dir`

Job: `826efbdb-18c6-466d-a220-9783c92d0079`

1. Submit the workflow through `POST /api/v2/jobs`.
2. Poll `GET /api/v2/jobs/{id}` until `succeeded`.
3. Fetch the returned output asset with `GET /api/v2/assets/{asset_id}`.
4. Download `GET /api/v2/assets/{asset_id}/content`.

## Actual behavior

Both metadata responses report:

```json
{"size_bytes": 0, "hash": null}
```

The content endpoint returns HTTP 200 with:

- `Content-Length: 1553743`
- valid 1024×1024 RGB PNG
- SHA-256: `51e84d82990b906124249d6127aa57bb81e0683009ea42e5079c72d03a743514`

## Expected behavior

For a retrievable output, `size_bytes` should equal the actual content length. If output hashing is intentionally lazy, `hash: null` is acceptable, but `size_bytes: 0` should not be used for a known available file.

The job output metadata and `GET /api/v2/assets/{id}` should agree.

## Suspected cause

`src/comfy_api_proxy/app.py`, `_outputs()`, currently constructs output records with:

```python
"size_bytes": 0,
"hash": None,
```

The content handler can already retrieve the upstream bytes.

## Suggested regression test

For a successful fake-upstream job:

- fetch the output metadata;
- fetch the content;
- assert `size_bytes == len(content)`;
- assert job and asset metadata agree;
- allow `hash` to remain null if lazy hashing is intentional.

Reproduction harness and raw response capture are available locally if useful.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.