Skip to content

fix: complete Responses image generation calls with results#596

Open
SantaDiegoKairos wants to merge 1 commit into
justlovemaki:mainfrom
SantaDiegoKairos:fix-image-generation-completed-status
Open

fix: complete Responses image generation calls with results#596
SantaDiegoKairos wants to merge 1 commit into
justlovemaki:mainfrom
SantaDiegoKairos:fix-image-generation-completed-status

Conversation

@SantaDiegoKairos
Copy link
Copy Markdown
Contributor

Summary

Normalize OpenAI Responses image_generation_call items that already contain a final result so they are returned with status: "completed" instead of preserving an upstream/intermediate status: "generating".

Why

Some Responses image generation flows can produce a completed response and a valid base64 PNG in image_generation_call.result, while the output item still has status: "generating".

That shape is confusing for strict Responses clients: the image payload is present, but the item still looks unfinished. In practice this can lead clients to treat the image result as blank or still pending.

The affected shapes are:

  • non-stream response.output[]
  • stream response.output_item.done.item
  • stream response.completed.response.output[]

The fix is intentionally conservative: only image_generation_call items with a non-empty result are marked completed. In-progress image calls without a result are left unchanged.

Validation

node --check src/utils/common.js
npm test -- --runInBand tests/responses-image-status-normalize.test.js

Local result:

PASS tests/responses-image-status-normalize.test.js
4 passed

Also validated against a live OpenAI Responses-compatible route:

  • non-stream image response: top-level response.status=completed, image item has non-empty result, normalized to status=completed
  • stream image response: response.output_item.done.item.status=completed
  • stream completed response: response.completed.output[0].status=completed
  • decoded image payload is a valid PNG

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant