Repository navigation
feat(module-images): markup-guided image edits with --markup - #3972
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7 of 9 tasks
This was referenced Nov 11, 2026
This was referenced Nov 11, 2026
schlessera
marked this pull request as ready for review
November 11, 2026 13:24
…eck (#3785) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
schlessera
marked this pull request as draft
November 11, 2026 13:48
schlessera
marked this pull request as ready for review
November 11, 2026 13:48
schlessera
marked this pull request as draft
November 11, 2026 14:08
schlessera
marked this pull request as ready for review
November 11, 2026 14:08
Owner
Author
|
Candidate confirmation is blocked by a CI runner outage, not by this change. Head Two consecutive confirmations of this head failed at the same step, before any test ran:
The earlier strict-typecheck failure (run 43028828486) was real and is fixed in I am not retrying while the mirror lookup is failing. To resume: once a CI run passes that prerequisite step again, run |
This was referenced Nov 11, 2026
schlessera
marked this pull request as draft
November 12, 2026 09:43
schlessera
marked this pull request as ready for review
November 12, 2026 09:43
7 tasks
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.
Closes #3785. Part of #3781.
What changed
brain image --ref <image> --markup <layer.png>sends an annotation layer with an edit. The layer is a transparent PNG, exactly the size of the first--ref, whose strokes and notes guide the change. It is posted as the multipartmarkuppart on/v1/images/edits, next toimage[]and never with amask. The models are the GPT Image 2.6 and 2.5 pairs (a newmarkupGuidancecapability), and the default staysgpt-image-2.6-sunburst.Refused before any request:
--ref.--mask.tRNSchunk, is required.The checks read file headers only (
src/markup.ts: PNG IHDR/tRNS, JPEG SOF plus EXIF Orientation, WebP VP8X/VP8L/VP8). The CLI runs them before routing, dry runs included.openaiProvider.generateruns them again for direct callers.geminiProvider.generatenow refuses a markup layer instead of silently dropping it.Help text, the README, the
image-genskill and a minor changeset document the above. Two citation ranges into the image module have moved with the new lines.Why this shape
Markup is a model capability, like masks, so routing narrows on it the same way. It is exclusive with
mask, needs a reference, and is refused when no capable model remains.The size and alpha checks follow OpenAI's image-generation guide, re-read on 2026-11-11: "a separate transparent PNG", "must contain transparent pixels; do not flatten it", "the same width and height after orientation", "Do not combine
markupwithmask", and the 16,777,216-pixel and 50 MB limits. Requiring an alpha channel is the header-level form of "must contain transparent pixels". Decoding pixels to prove that some are actually transparent would need an image decoder, which this module does not carry. A first reference whose header cannot be read is refused rather than sent unchecked.The guide says nothing about markup with GIF output, so this PR adds no rule for that combination. JSON-body edits (
image_url/file_id) and any drawing UI stay out of scope, as the issue says.Guard checklist (proportionate containment):
Proof
bun run test packages/module-images: 246 pass, 0 fail. Rootbun run typecheckpasses on head4e95e0d10. The first candidate run failed strict typecheck on a test byte comparison (Uint8Array<ArrayBufferLike>passed totoEqual); my earlier local typecheck predated the tests. The comparison now uses plain arrays. It neededNODE_OPTIONS=--max-old-space-size=12288locally, because the default heap aborted.bun run lintis clean.Failing-first. I put
packages/module-images/srcback toorigin/main, deletingmarkup.ts, and kept the new tests. The 20 new tests failed and the existing 226 passed. Every failure was an assertion, not a load error:--markupis parsed and silently ignored. The edit therefore goes out with no markup part:IMAGE_MARKUP_PARTexpected aBloband receivednull.impossiblewas expected, and its reason lacked/markup/.markupGuidancewasundefined.ImageProviderErrorwas expected.Mutations, each restored afterwards:
if (layer.width !== base.width)). Two tests failed:ImageProviderError, received an image result.After restoring, all 246 pass.
{"version":1,"kind":"brain-check-pr-receipt","head":"4e95e0d10dce1ef6a5af672b8c77b43afea70221","base":"origin/main","mode":"focused","startedAt":"2026-11-11T13:46:21.438Z","finishedAt":"2026-11-11T13:47:23.265Z","checks":[{"name":"all lint and leakage gates","categories":["changeset"],"outcome":"passed","elapsedMs":12556.239324999999},{"name":"environment documentation","categories":["changeset"],"outcome":"passed","elapsedMs":102.82368200000201},{"name":"pending changeset package names","categories":["changeset"],"outcome":"passed","elapsedMs":78.70594600000186},{"name":"contribution changeset","categories":["changeset"],"outcome":"passed","elapsedMs":17.277658999999403},{"name":"affected fast invariants","categories":["verify","unit"],"outcome":"passed","elapsedMs":49055.530439999995}]}Collisions (
bun scripts/collisions.ts --json --pr 3972at heade65925c498b9103d84d48d1ab1d055ed58e71198): 0 path or unknown collisions. Two textual overlaps ondocs/decisions/governed-writable-workers.md, with #3393 and #3464, come only from the one-line citation range. The rest are closure-level, through shared test consumers: #3056, #3059, #3116, #3437, #3581, #3622, #3662, #3726, #3806, #3968, #3971.Checklist
docs/reflect the change, or nothing documented moved.docs/decisions/provider-history.md): the provider-history guard passes, or nothing on a turn's path changed.Anything left open
Nothing. The
--jsonenvelopes are unchanged.🤖 Generated with Claude Code