Skip to content

Sonny: exec's image() shows the model the picture, in order with the text - #494

Merged
lydakis merged 15 commits into
mainfrom
claude/project-thread-p6odw4
Oct 31, 2026
Merged

lydakis merged 15 commits into
mainfrom
claude/project-thread-p6odw4

Conversation

@lydakis

@lydakis lydakis commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner

Opened by Claude for @lydakis. George wants images in served tool results from day one. The daemon half landed in #482; this is the Sonny half, in the tool host (#481).

What

  • Images reach the model. An exec script's text() and image() now come back as the daemon's ordered text and image parts, the way Codex's code mode returns them. Before, image() saved a file and the model only got its path. A script that shows no picture still answers with a plain string.
  • What image() takes: a data: URL, {image_url}, or an MCP ImageContent block (image(r.content[0])).
  • Pictures are handled the way the daemon's read handles them:
    • The kind is judged from the bytes themselves: PNG, JPEG, GIF or WebP. SVG and other formats are refused.
    • A picture larger than 1568 px on its longest side, or over 1 MB, is scaled down. It goes out as a PNG, or as a JPEG for a photograph or a PNG that is still too large.
    • A result holds at most 20 pictures, 5 MB together. Past that, image() throws, so the script knows. Those are the daemon's limits, so a result never fails as a whole on image_limit.
  • How a picture keeps its place: it is marked in the output stream by a private-use character, and text() strips that character, so no printed text can forge a mark. When the output budget cuts the middle, a cut picture goes with its place.
  • Text limits: the tool host holds the text parts to its 60 KiB, under the daemon's 64 KiB.
  • Docs: the exec tool description, SONNY.md's MCP section, and the FEATURES row.

Tests

  • Unit tests:
    • Text and pictures come back in order.
    • A mark that a script prints itself is stripped and names no picture.
    • An SVG is refused.
    • A 3000×2000 PNG is scaled to 1568×1045.
    • The parts' text is cut to 60 KiB.
  • End to end: a new test_served test runs a script that shows a picture through the tool host. The model then receives input_text, input_image, input_text, in that order.
  • Checks: cargo clippy -p sonny --all-targets -D warnings is clean, and cargo test -p sonny passes.
  • Local runs: test_served passes, except for two tests that start tasks and need bubblewrap, which this box lacks.

Sonny only.

claude added 13 commits October 31, 2026 01:10
…ntity

The lookout's MCP host held what scripts and servers sent outside QuickJS's
cap without bound, and a resumed T3 Code thread bound by bot name alone.

- exec: a script's output is kept within 1 MB as it runs, its first half
  and its latest, as Codex keeps a command's; eight calls in flight per
  script; a result over 16 MB (rmcp's per-message cap) is refused; results
  reach the script as one JSON string, not a Value tree.
- exec: one deadline from the call, which waiting for a place and listing
  servers' tools spend; servers list concurrently, and a start given up
  stops its process group.
- exec: tools whose identifiers collide are refused, not replaced.
- mcp: the listing cache is keyed by a SHA-256 of the config, not the
  config's debug string with its env and headers, and written 0600 in a
  0700 folder; stderr is read in chunks, each line cut at 1 KB.
- acp: a thread remembers its bot's id and store lineage; resume refuses a
  bot made again under the name, or another store's, and submit carries
  bot_id. A thread kept by name only binds by name once and is pinned then.

Closes #347, closes #332; #335 keeps its macOS allocator item.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGF1uDHaNjs42Bgs9Uu
Codex review on #474: a first text() over 1 MB kept only its end. The
head now fills from the text that overflows it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGF1uDHaNjs42Bgs9Uu
The lookout only watches and tells now. Sonny's tools (start_task, memory,
goal, commons, exec and its MCP servers) are answered by `sonny tool-host`,
the daemon's companion `sonny-tool-host`, kept beside the lookout by Sonny
and `sonny acp`, so a slow, crashing or memory-heavy tool never holds up a
lead's news. The host signals the lookout (SIGUSR1) when a call changes the
subscription or goal files it reads, follows only tool_started and
turn_finished from its own cursor, refreshes agents' declared tools on
start, and gives way to another build as the lookout does. /status says
"tools not answered" when no host runs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGF1uDHaNjs42Bgs9Uu
…not a signal

A SIGUSR1 from the tool host could be handled after the events that
follow the call's tool_result, so news right after a subscribe could be
read with the old subscriptions and lost. The lookout now follows those
calls by their tool_started and rereads on their tool_completed, which
the stream orders before every later event.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGF1uDHaNjs42Bgs9Uu
…text

With the daemon's tool_result parts (#482), an exec script's text() and
image() come back as ordered text and image parts, as Codex's code mode
returns them, rather than a saved file's path. A picture is a PNG, JPEG,
GIF or WebP by its own bytes, scaled to 1568 on its longest side as the
daemon's read scales one; a result holds up to 20, 5 MB together, and
image() throws past that. Pictures are marked in the output by a private
use character that text() strips, so the budget's cut drops a picture
with its place; the tool host holds the parts' text to its 60 KiB.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGF1uDHaNjs42Bgs9Uu
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-31T05:12:28.771156Z a066814 New commits
🔒 Security Review ✅ Completed 2026-10-31T05:14:04.731683Z a066814 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2c08dce3af

ℹ️ 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".

Comment thread sonny/src/exec.rs Resolved
A mark the output budget cut in half shifted the split's alternation, so
later whole marks named no picture. A mark now opens with U+E000 and
closes with U+E001: a half one is dropped and every whole one after it
still shows its picture.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGF1uDHaNjs42Bgs9Uu
@lydakis
lydakis merged commit a7df14a into main Oct 31, 2026
4 checks passed
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.

2 participants