Repository navigation
Sonny: a margin holds 6 notes of 12 lines, and says so past either (G6) - #761
Conversation
A margin call past either limit is refused, answered by Sonny with the limit and the notes there or the note's length, where the oldest note went silently. Notes kept from before a lower limit stay. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGE1e3tTWKYGk7x7QbN
Codex Review Summary: ✅ CompletedThis 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: 0fc88bc8b8
ℹ️ 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".
…eckpoint A margin call is refused only by the tool host's answer; the window, a lead's view of a task's note, and the host's own replay go by each call's recorded answer, so notes taken under higher limits stay. The window applies a call once it is answered, not as it starts. The host keeps a checkpoint beside the window's file and reads on from it, up to the first call still waiting on its answer. A side chat's margin starts at its fork. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGE1e3tTWKYGk7x7QbN
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 59a31ccc9b
ℹ️ 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".
A margin call made before this one and not answered yet counts as it would be answered, so calls in one response never take more than the margin holds. A lead's view of a task's note keeps only that note's own calls waiting for their answers, however many the task made at once. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGE1e3tTWKYGk7x7QbN
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 219b5e9e17
ℹ️ 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".
A window's margin can be read past a call still waiting on its answer, so the host no longer adopts it; it keeps its own, and a side chat's start is seeded there. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGE1e3tTWKYGk7x7QbN
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6b450e549c
ℹ️ 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_013jkdGE1e3tTWKYGk7x7QbN
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9600462131
ℹ️ 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".
…file or note Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGE1e3tTWKYGk7x7QbN
…ription Keeps a lead's declared tools within their budget beside its own. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGE1e3tTWKYGk7x7QbN
Wave 2, G6. Part of #670. Builds on #742.
What changes
A margin held 20 notes, and a new one past that silently pushed out the oldest. A note's length was bounded only by bytes. Now:
[sonny] margin_notesdefaults to 6, and a new[sonny] margin_note_linesdefaults to 12. Both are configurable, at least 1, and listed in/config.fileor a task's note (from) isn't limited by length. Removing a note is never refused.How the agent is told
marginused to be declared with a fixed result ("In the margin."), so nothing could refuse it. It's now answered by Sonny's tool host (answered_by), likememoryorshow_agent. The host reads the margin as it stands from the bot's history, counting each call as it was answered (a call taken under higher limits stays taken). It reads on from its own checkpoint, kept apart from the window's file and never past a call still waiting on its answer, so each call reads only what came since. A side chat's margin starts at its fork, so its source's notes don't count against it. Calls made together (several in one response) are answered in the order they were made, so together they never take more than the margin holds. Then it answers "In the margin." or refuses with a typed code:margin_fullmargin_note_too_longThe tool description doesn't mention the limits: an agent learns them when a call meets one, from the refusal, which gives the limit, the notes there, and suggests a file. (A sentence about them in the description put a lead's declared Sonny tools 221 bytes over their budget of half the daemon's 64 KiB cap.)
Only the host refuses (
margin::refusal). The window applies a margin call once it is answered and didn't fail, and a lead's view of a task's note does the same with the task's history, so what's drawn matches what the agent was told. (Before, the window drew a note as its call started; now it shows when Sonny answers, a moment later.)Checked end to end
I ran a real daemon with a scripted model that posts seven notes, then a 13-line note, then removes one and posts the seventh again. The answers:
The window shows notes 2 to 7, and note 1 kept its two lines.
Tests
a_note_past_the_most_is_refused_and_says_what_it_can_change: the first three of five stay, with the exact refusal text; a note already there still changes; removing one makes room; a lower limit keeps what's there, and replaying calls taken earlier keeps them too.a_note_is_as_long_as_its_text_says_not_as_it_is_drawn: long lines that wrap count once; the exact refusal text; a long note taken before the limit was lowered stays; file,fromand removal calls pass.a_margin_call_is_answered_from_where_it_was_last_read_and_a_side_chat_s_from_its_copy: the host reads on from its checkpoint (reads start at 13, 13, 15), pairs a call with its later answer, and a side chat's first note is taken though its source held six.margin_calls_made_together_take_no_more_than_the_margin_holds: five held and two new ones in one response: the first made is taken and the second refused, whichever is answered first.a_note_shows_in_the_margin_once_taken_and_a_marker_pins_where: no note until the call is answered; a failed call changes nothing.a_task_s_note_taken_away_by_the_person_starts_again_empty: a task's call refused there, or not answered yet, changes nothing in the lead's view until its answer says it was taken.the_margin_is_answered_by_sonny_and_says_its_limits_are_told.margin_note_lines.cargo test -p sonny -p agent-client, clippy and fmt pass.Performance
botsread, and the history since the host's checkpoint. A bot's first host-answered call reads its history once from the start (a side chat's from its fork); each later call reads only the nodes since, so the cost per call is the new history, with a few agents or with thousands.Upgrade notes
margin_noteshigher to keep more.margincalls now wait for Sonny's tool host to answer, asmemoryand the other Sonny tools do.Generated by Claude Code