Repository navigation
Pictures in messages and from read, counted at their token cost; Sonny's shell editing keys - #242
Conversation
… messages - A markdown link's underlined text is now a link too, not just the address drawn after it in brackets. Paths of files that exist (relative to the agent's folder, absolute, or under ~/, with :LINE or #L after them) open as file:// links. - Ctrl-H (0x08) deletes like Backspace, in the composer and pickers. - Each staged queued or steered message has a blank row above it, as in the history, and the last one a blank row before the status row. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGDNh4a2FzyND7nayar
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGDNh4a2FzyND7nayar
…s in the daemon Sonny attaches a picture from the clipboard on Ctrl-V, or an image file whose path is pasted or dropped on the terminal, behind an [Image #N] placeholder; PNGs are scaled to 1568px on their longest side. The daemon's submit takes `images` (base64 PNG, JPEG, GIF or WebP), checks them, keeps them with the turn, and sends them after the words in each provider family's own shape. `agent run --image PATH` sends one from the CLI. History reads leave the picture bytes out. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGDNh4a2FzyND7nayar
Ctrl-Y puts back what Ctrl-W, Ctrl-U, Ctrl-K or a word deletion took; Alt-D and Ctrl/Alt-Delete delete the next word; Ctrl-J and Alt-Enter start a new line; Ctrl-P/N move a row; Ctrl-Alt-H deletes a word. Ctrl-Y and Ctrl-N no longer answer a pending approval as `y` and `n` do. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGDNh4a2FzyND7nayar
…it plans Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGDNh4a2FzyND7nayar
…thout a force push Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGDNh4a2FzyND7nayar
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
Security findingsAdvisory findings (1)
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dcc0e58aa3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…tores them once Ctrl-C (or Esc in a side chat) drops the pictures with the text. A /side question sends the pictures its placeholders name. Once a prompt is a node its pictures live there; the turn keeps their SHA-256, which a retry is checked against. History pages and reads leave pictures out in a subquery whose cheap guard spares items without any. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGDNh4a2FzyND7nayar
|
@codex review Generated by Claude Code |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c63195f22a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
A PNG, JPEG, GIF or WebP file comes back as a line naming it and the picture, in each family's result shape. One longer than 1568 px on a side is scaled down, and one over 1 MiB re-encoded as a JPEG. Other binary files stay refused. History reads leave a result's picture bytes out, as they do a prompt's, and elision stubs a picture result as its text. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGDNh4a2FzyND7nayar
A picture counted by its base64 bytes, so a few large ones filled the context budget, brought compaction early, and made the pacer estimate a 1 MiB picture at ~350,000 tokens, which a pool with a learned limit refused before sending. Each picture now weighs four bytes per estimated token (width × height / 750 once the longest side fits 1568, at most 1600). Nodes record what their pictures add beyond that weight (`pictured`, schema 55), and `total_bytes` leaves it out, so every window, compaction and elision budget sees the weight with no change to its query. Only a request's length adds the bytes back: the window and compaction plans carry `pictured` per item for the Content-Length and read-ahead, and `Items.weight` is what the pacer estimates from. A picture result's stub saves what the result weighs over it, so only a large picture is elided. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGDNh4a2FzyND7nayar
|
@codex review Generated by Claude Code |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 821845eccc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
🛡️ Codex Security Review · Automatically triggered
Here are some automated security review suggestions for this pull request.
Reviewed commit: 821845eccc
ℹ️ About Codex security reviews in GitHub
This is an experimental Codex feature. Security reviews are triggered when:
- You comment "@codex security review"
- A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review
Once complete, Codex will leave suggestions, or a comment if no findings are found.
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGDNh4a2FzyND7nayar
There was a problem hiding this comment.
💡 Codex Review
https://github.com/lydakis/agent/blob/9d5d3016cd1bbea6348670c5f9270b23a7faad61/sonny/src/attach.rs#L4651-L4653
Enforce the PNG byte limit before accepting an attachment
When a PNG fits the dimension limit but exceeds the daemon's byte limits, this branch accepts it unchanged, and picture() skips the MOST_BYTES check for PNGs. A valid 1568×1568 RGB noise PNG generated locally occupied 7,379,758 bytes and 9,839,680 base64 bytes: Sonny accepts that attachment, but submitting it exceeds session::LINE_LIMIT (8 MiB), causing socket_reader() to close the connection. Smaller oversized PNGs instead fail check_images()'s 5 MiB limit. Check bytes as well as dimensions, and downscale/re-encode or reject oversized PNGs before adding them to the draft.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…mall ones at full cost - `read` scales a picture in a blocking worker, one at a time, so the daemon's one thread keeps serving every other bot meanwhile. - A picture that must be scaled and has more than 64 megapixels is `image_limit`, refused from its header before decoding, and decoding is capped at 256 MiB besides: a small PNG can claim 12000 × 12000. - A picture that compresses to less than its token cost counts at its cost: `pictured` may be negative, so a blank 1568 × 1568 PNG of a few KB weighs its 1600 tokens. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGDNh4a2FzyND7nayar
An absorption batch now reads a steer's pictures only while they fit an 8 MiB budget past its first steer's, and leaves the rest for the next batch. Sonny refuses a picture past 5 MB once scaled, PNG too, and one that would bring a message's pictures past 5 MB together. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGDNh4a2FzyND7nayar
# Conflicts: # src/store/db.rs
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e5747cb0a2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
The PNG byte limit in Sonny (from the last review's body) is fixed in 4845bd5. @codex review Generated by Claude Code |
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGDNh4a2FzyND7nayar
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9a0a2caad7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1f4d03f8bd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGDNh4a2FzyND7nayar
Two things from day-two use of Sonny.
Pictures now work end to end:
readreturns an image file as a picture instead of refusing its bytesThe composer also gets the rest of the shell editing keys that Codex's composer has.
Pictures with a message
Pictures go in the message itself, as Codex and Claude Code send them. The other option was a path the agent would read later, and George picked this one.
Sonny
osascripton a Mac,wl-pasteorxclipelsewhere.file://addresses. It applies only when every word of the paste is an image file that exists (png, jpg, jpeg, gif, webp), so ordinary text never turns into an attachment.[Image #N]where it goes in the message. Deleting the placeholder leaves that picture out./sidequestion takes the pictures its placeholders name.The composer with two pictures as [Image #1] and [Image #2]
The scripted model replies with what it was sent. The 3000×2000 screenshot reached it at 1568×1045:
Daemon
submittakesimages, a list of{"media_type", "data"}objects with standard base64 data. Up to 20 are allowed, 5 MiB together once decoded.invalid_imagewith theindexit was at. Too many, or too large, isimage_limit.The pictures go in the user item after the words, in each family's own shape:
input_imagedata URLs.imageblocks.This works for a turn of its own and for a steer. One absorption batch reads at most 8 MiB of pictures past its first steer's, and the rest wait for the next batch.
A queued turn keeps its pictures in the new
turns.imagescolumn (schema 56, with a migration).request_idwith other pictures is anidempotency_conflictonimages.History reads (
history_items, and the history tool's item reads) return a person's prompt with each picture's bytes left out andomitted_bytescounted. The model is still sent them whole.A request line may now be 8 MiB, enough for a prompt and its pictures.
agent run --image PATHsends one from the CLI. Repeat the flag for more.readreturns picturesBefore this, an agent that read a screenshot got raw bytes, and since #233 it gets
file_not_text. Nowreadof a PNG, JPEG, GIF or WebP file returns the picture itself, as Claude Code's Read and Codex's view_image do. The picture follows a line naming its kind, its size and its bytes.image_limitbefore it is decoded, and the decoder runs with an allocation limit.input_textand aninput_image.textand a base64imageblock.imagecrate with only its png, jpeg, gif and webp decoders. That adds 7 crates to the build.Pictures count at their token cost
Codex flagged this in review, and so did a performance review. A picture used to count by its base64 bytes, so a 1 MiB picture was about 350,000 estimated tokens. That caused two problems:
Now a picture weighs four bytes per estimated token. The estimate is width × height / 750, once the longest side is scaled to fit 1568 px, and at most 1600 tokens. That's Anthropic's rule, and OpenAI's high detail counts fewer.
picturedcolumn (schema 57, with a migration). It is signed: a picture whose base64 is smaller than its weight still counts at its weight.total_bytesleaves that extra out. Every window, compaction and elision budget therefore sees the weight, with no change to its query.picturedper item, for the Content-Length and the read-ahead batches.Items.weightinstead ofItems.bytes.Shell editing keys
Most were already there: Ctrl-A/E/B/F/D/W/U/K, Alt-B/F, Alt- or Ctrl-Backspace and arrows, plus Ctrl-H from #230. Compared with Codex's editor keymap, these were missing:
This also fixes a related bug. With an approval pending, Ctrl-Y or Ctrl-N used to answer it the way a plain
yornwould. Now only the plain keys answer an approval.Testing
dropped_files_read_as_their_pathsa_large_png_is_scaled_to_fit_and_a_small_one_kepthex_from_applescript_reads_as_byteswhat_a_deletion_takes_comes_back_with_yankthe_shell_editing_keys_work_in_the_composerpictures_go_with_their_placeholders_and_a_discarded_draft_drops_them, which also checks the 5 MB a message's pictures may be togetherpictures_follow_the_words_in_each_familys_shapeanda_picture_weighs_its_estimated_tokens.read:read_shows_a_picture_and_refuses_other_binaries_by_kind, plus the scaling tests insrc/tools/picture.rs.pictures_count_at_their_weight_and_go_whole,a_picture_that_compresses_below_its_cost_counts_at_its_cost, andsteer_batches_bound_the_bytes_of_their_pictures.a_picture_too_large_to_scale_is_refused_before_it_is_decodeduses a 12000×12000 PNG header.a_result_with_a_picture_reads_as_its_text_and_elides_to_it.read_ahead_batches_stop_at_either_boundnow counts a picture's bytes in read-ahead.tests/test_images.py:readof a 3000×2000 PNG reaches the model at 1568×1045cargo test --workspacepasses, except three task tests that needfusermount3, which this machine lacks. Those tests don't touch anything this PR changes.cargo clippy --workspace --all-targets -D warningsandcargo fmtare clean.AGENT_TEST_RUNTIME=1 python3 -m unittest discover -s tests: all 500 tests pass (29 skipped).bench/query_plans.pyknows thePICTURELESSconstant, the history-read SQL that leaves pictures out, sotests/test_query_plans.pyaudits those queries too.🤖 Generated with Claude Code