Keep the rest of the frame when operators Edit an image - #36
Open
sujanajay wants to merge 6 commits into
Open
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
|
Dobby review · The core compositing logic ( Dobby reviewThe keep-frame design (mask + fail-closed + source copy) is solid. The concern is the empty-mask path: a sub-threshold edit is silently turned into an unchanged new version. 🚨
|
| Area | Result |
|---|---|
| Security | No issues found (PIL decode is wrapped → 502; no unbounded reads; prompt improvement is pre-existing injection surface) |
| Correctness | 1 High — silent unchanged-version on sub-threshold edits; 1 Medium — size-mismatch LANCZOS stretch |
| Performance | No significant issues (single synchronous decode/diff/composite in request path, fine at catalog sizes) |
| Tests | Good synthetic coverage (solid rect, identical, JPEG->PNG, overshoot fail, no-localize-on-text). Missing the sub-threshold/uniform-delta case |
❓ Questions
- Was
_MAX_CHANNEL_DELTA=20 and the 0.35 ceiling validated against any real OpenRouter output? The plan marks live proof optional for merge, but these constants were tuned on synthetic solid rectangles. On textured SKU photos the JPEG/re-encode noise that the feature is meant to fix (12–18% variance loss) could either cross the 0.35 ceiling and fail-close most genuine edits, or sit just above 20 and produce jagged mask edges. A single real-image AE1 run before merge would de-risk this. - If a sub-threshold edit does get silently persisted as an identical version (the High above), is that acceptable to the product, or should it surface as the fail-closed 502 copy?
🧪 Tests to add
- Uniform small delta candidate (all pixels shifted below threshold) → assert not silently returned as unchanged source (the High above).
- Candidate differing only via a small global lighting/color-cast change → on-fraction small but requested change preserved or fail-closed, never an identical new version.
- Size-mismatch where
resizewould inflate the mask → behavior defined (currently under-tested for false-fail).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Operator image Edit used to restyle the whole canvas. It now keeps the current frame and only the requested change should move.
OpenRouter has no mask field, so the server composites after the model returns: copy source pixels outside a binary delta mask, fail closed if too much of the frame changed, and persist PNG. Keep-frame prompt text is attached on operator regenerate only, not first-generate. The Edit modal says so in copy.
Settled in this plan: keep-the-frame Edit is the default (not restage-from-photos, not chaining-only full re-render); restage and print compositing stay out of this slice; actor identity is not required to ship.
Test plan