Repository navigation
Keep expressions when optional background removal fails - #5
Conversation
Reviewer's GuideThe PR makes expression generation resilient to background-removal runtime failures by performing one controlled plain-background retry with the original identity and generation settings, then retaining backgrounds for the remainder of the run and clearly reporting the recovery. It explicitly avoids unsafe retries for GPU OOM, unrelated CUDA or adapter failures, cancellation, and failed fallback attempts, with accompanying UI/documentation updates and mocked regression coverage. Flow diagram for expression generation failure handlingflowchart TD
A[Run expression with background removal] --> B{Generation error?}
B -->|No| C[Save expression]
B -->|Cutout runtime failure| D[Retry once with background kept]
D -->|Success| E[Save expression and keep backgrounds]
D -->|Failure| F[Report error and stop]
B -->|GPU out of memory| G[Report memory guidance and stop]
B -->|Other CUDA or adapter failure| H[Report relevant guidance and stop]
B -->|Cancelled| I[Stop without fallback]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
🟢 Approval recommended
The bounded recovery preserves identity settings, handles unsafe failures explicitly, and has focused regression coverage with no identified blocking issues.
No open issues 🎉
What changed in this PR
Expression generation now recovers from optional background-removal failures without changing the portrait, face adapter, sampler, or seed.
Changes:
- Retry confirmed cutout failures once without background removal, preserving cancellation and memory-error safeguards.
- Report recovery and provide failure-specific guidance.
- Add regression coverage and document the fallback behavior.
| File | Description |
|---|---|
| tests/comfy.test.js | Tests recovery, retry limits, cancellation, and preserved workflow connections. |
| src/ui/image-setup.js | Explains background fallback and memory-error behavior. |
| src/ui/character-pictures.js | Includes recovery warnings in completion reports. |
| src/st/comfy.js | Implements bounded recovery and targeted error guidance. |
| README.md | Documents recovery and updates test counts. |
| docs/STATUS.md | Records verification results and limitations. |
| docs/QUICKSTART.md | Explains fallback and transparency settings. |
Review effort: Balanced
There was a problem hiding this comment.
Hey - I've reviewed your changes and they look great!
Sourcery assessment
Needs a human reviewer. If the retry removes the wrong workflow nodes or reconnects the save input incorrectly, an expression could be generated with an unintended background or image and saved to the project; later expressions in that run would also keep their backgrounds. Those saved results are bounded and can be undone or regenerated, but reverting the code would not undo images already created.
Expression generation stopped when background removal failed to load libnvrtc-builtins.so.13.0, then incorrectly suggested reinstalling the face adapter. Confirmed cutout-node runtime failures now retry once with the background kept and the original sampler, seed, portrait and face adapter unchanged. Subsequent moods keep their backgrounds, and the completion report explains the recovery.
GPU out-of-memory errors stop without retrying the memory failure. CUDA-library and adapter errors get relevant guidance. Cancellation, failures outside background removal, and a failed plain-image retry cannot silently switch to another person or loop through more attempts. Image settings, README and the quick-start guide explain the behavior.
Validation: 201 tests pass. The new tests reproduced the reported failure before implementation and cover recovery on the first or later mood, both face adapters, sampler/cutout out-of-memory, other CUDA failures, bounded retry failure, cancellation, and unchanged reference/adapter/sampler connections. External ComfyUI responses were mocked; no GPU job was launched, and the user's other CUDA installation was not modified or live-validated.
Summary by Sourcery
Make expression generation recover safely from background-removal failures while preserving identity settings and clearly reporting the outcome.
New Features:
Bug Fixes:
Enhancements:
Documentation:
Tests: