Skip to content

fix: eliminate duplicate uploads and wasted credits in ref image gen - #2

Merged
crisng95 merged 2 commits into
mainfrom
fix/ref-image-no-duplicate-upload
Apr 2, 2026
Merged

crisng95 merged 2 commits into
mainfrom
fix/ref-image-no-duplicate-upload

Conversation

@crisng95

@crisng95 crisng95 commented Apr 2, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Direct UUID extraction: After batchGenerateImages, extract UUID from response before uploading. If found, use it directly — no duplicate image in Google Flow
  • Skip regen on retry: If reference_image_url exists but media_id is missing, only retry the upload (saves credits)
  • SSL fix: macOS Python lacks root certs for storage.googleapis.com, causing _upload_character_image to always fail with SSLCertVerificationError

Problem

Previously each entity generated 2 images in Google Flow:

  1. Generated image (from batchGenerateImages) — named from prompt
  2. Re-uploaded copy (from uploadImage) — named "Viktor.jpeg"

On upload failure, the worker retried the entire generation (up to 5x), burning credits each time.

Flow after fix

Generate → UUID in response? → YES → use it (1 image, no duplicate)
                              → NO  → upload copy (2 images, fallback only)
Retry    → image exists?     → YES → upload only (no regen, no credit)

Test plan

  • Generate ref image — verify only 1 image appears in Google Flow (not 2)
  • Verify media_id is valid UUID and works as imageInputs in scene image gen
  • Simulate upload failure — verify retry doesn't regenerate image

Supersedes #1

🤖 Generated with Claude Code

crisng95 and others added 2 commits April 2, 2026 14:13
…ration

Three fixes to _handle_generate_character_image:

1. Direct UUID extraction — after batchGenerateImages, try extracting
   UUID from the response before uploading. If found, use it directly
   (no duplicate image in Google Flow).

2. Skip regen on retry — if reference_image_url exists but media_id
   is missing, only retry the upload (no credit burned on regen).

3. SSL fix for GCS downloads — macOS Python often lacks root certs
   for storage.googleapis.com, causing upload to always fail.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ration

Two fixes on top of the retry-saves-credits change:

1. Direct UUID extraction — after batchGenerateImages, try extracting
   UUID from the response before uploading. If found, use it directly
   (no duplicate image in Google Flow).

2. SSL fix for GCS downloads — macOS Python often lacks root certs
   for storage.googleapis.com, causing upload to always fail.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@crisng95
crisng95 merged commit e0b1c65 into main Apr 2, 2026
sethliao added a commit to sethliao/flowkit that referenced this pull request Jul 27, 2026
Per HANDOVER_CURSOR.md P0 crisng95#2 — Veo models consume significant credits.
All video gen types (i2v, r2v, start-end, edit) now use Omni Flash
via abra_t2v_8s across both PAYGATE_TIER_ONE and PAYGATE_TIER_TWO.

Note: P0 crisng95#1 (NARWHAL for images) was already correct in flow_client.py.
stop_motion material already exists as a built-in.

Co-authored-by: Cursor <cursoragent@cursor.com>
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