Repository navigation
Sonny: bound the shared MCP host and pin a T3 thread to its bot's identity - #474
Merged
Merged
Conversation
…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
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGF1uDHaNjs42Bgs9Uu
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ 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: a0ad3e1b2c
ℹ️ 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 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
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGF1uDHaNjs42Bgs9Uu
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGF1uDHaNjs42Bgs9Uu # Conflicts: # sonny/FEATURES.md
lydakis
pushed a commit
that referenced
this pull request
Oct 31, 2026
lydakis
added a commit
that referenced
this pull request
Oct 31, 2026
* Sonny: bound the shared MCP host and pin a T3 thread to its bot's identity 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 * FEATURES: MCP bounds and T3 identity pinning (#474) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGF1uDHaNjs42Bgs9Uu * exec: one text past the output cap keeps its own start 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 * tests: a T3 thread's record holds its bot's identity and store Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGF1uDHaNjs42Bgs9Uu * Split Sonny's tool answering out of the lookout into its own companion 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 * FEATURES: tool host rows for #481 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGF1uDHaNjs42Bgs9Uu * Lookout: reread on a subscriptions or goal call's end in the stream, 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 * cargo fmt Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGF1uDHaNjs42Bgs9Uu --------- Co-authored-by: Claude <[email protected]>
lydakis
added a commit
that referenced
this pull request
Oct 31, 2026
…text (#494) * Sonny: bound the shared MCP host and pin a T3 thread to its bot's identity 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 * FEATURES: MCP bounds and T3 identity pinning (#474) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGF1uDHaNjs42Bgs9Uu * exec: one text past the output cap keeps its own start 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 * tests: a T3 thread's record holds its bot's identity and store Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGF1uDHaNjs42Bgs9Uu * Split Sonny's tool answering out of the lookout into its own companion 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 * FEATURES: tool host rows for #481 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGF1uDHaNjs42Bgs9Uu * Lookout: reread on a subscriptions or goal call's end in the stream, 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 * cargo fmt Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGF1uDHaNjs42Bgs9Uu * Sonny: exec's image() shows the model the picture, in order with the 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 * FEATURES: #494 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGF1uDHaNjs42Bgs9Uu * exec: a picture's mark opens and closes with its own characters 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 --------- Co-authored-by: Claude <[email protected]>
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.
From the external review's priority list ("memory bounds in the shared MCP host"). Sonny only, no daemon change. Closes #347 and #332, and closes items 2 and 3 of #335. Item 1 of #335, the macOS allocator footprint, stays parked.
The precedents
DEFAULT_MAX_LINE_LENGTH) and an HTTP event-stream event (DEFAULT_MAX_SSE_EVENT_SIZE). Sonny uses the same 16 MiB as its per-result cap. What rmcp does not bound is two things: how many results a single script holds at once, and an HTTP server that answers with a plain JSON body.text(), instead of applying the budget only after the run ends.What changes
exec (
sonny/src/exec.rs)Promise.allover thousands queues). Together with the 16 MB result cap and the four running scripts, results held outside QuickJS are at most about 512 MB in the worst case. Before this change there was no limit.serde_json::Valuetree plus a string.timeout_ms: 300against a server that takes 5 s to start ends in about 300 ms with "ran out of time before it started". Servers now list their tools concurrently.my-serverandmy_serverboth givemcp__my_server__search), neither one is put ontoolsor inALL_TOOLS. The description and the call error both explain why.MCP host (
sonny/src/mcp.rs)envandhttp_headersvalues. The file is written0600inside a0700folder.sha2is already in the lockfile through portable-pty, so no new crate is built.ACP (
sonny/src/acp.rs,sonny/src/t3.rs)bot_idand the store lineage, not just the bot's name. On resume or load, Sonny refuses a different store. It also refuses a bot that was removed and then created again under the same name: the daemon'sinspectreturns abot_not_founderror for a stalebot_id. Everysubmitnow carriesbot_id.Docs:
docs/SONNY.md(exec bounds, cache, stderr) andsonny/README.md(T3 identity) are updated, and FEATURES.md history now includes this PR.Known gap
rmcp drops a stdio line over 16 MiB and leaves the connection open, so a call whose result is that large waits out its 60 s timeout instead of failing right away. rmcp also reads an HTTP server's non-streamed JSON body without a limit (
response.bytes()). Both are upstream; I'll note them on #335.Tests
cargo test -p sonny -- exec:: mcp:: t3::: 28 pass. New tests cover the deadline (a slow server), collisions, calls in flight and output bounding, the head/tailOutput, the cache's secrets and file modes, stderr cutting, and the pinned thread record.tests/test_acp.py::test_a_thread_comes_back_as_its_bot_and_not_another_made_under_its_namepasses locally. The thread resumes, then the lead is deleted and created again under the same name, and the resume is refused with "calc.lead is gone".