Repository navigation
Fix handoff stories counting notes and tool calls as left out for room - #89
Merged
Merged
Conversation
joeychilson
marked this pull request as draft
October 19, 2026 22:33
joeychilson
marked this pull request as ready for review
October 19, 2026 22:38
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.
A handoff's story, "What it found and did", said system notes and tool calls were left out for room when they opened the session or followed the summary, though it leaves them out anyway. That range now starts at the first entry the story would show, as "Where it stopped" does since #80.
Flags: none
Changes
fitreturns that range for both parts; "Where it stopped" says what it said before.Evidence
sessions::handoff::tests::the_story_says_just_what_it_left_out_for_room(a system note at #0, a tool call at #1, then #2 too long to fit) fails onmain:Here it passes:
Entry #2 is left out for room.Handoff cases at five budgets: 44 of 380 handoffs changed, only in that line, each range now starting past system notes or tool calls. "Where it stopped" changed in none.
The 44 changed handoffs
The 76 made-up cases from #80 (the six fixture sessions, 40 random sessions, and 30 in Claude Code's, OpenCode's and Codex's own tool shapes), handed off at 150, 500, 1,200, 3,000 and 16,000 tokens with
main(b4c529b) and this branch. 11 changed at 1,200 tokens and 33 at 3,000, none at the others. 32 ranges now start past tool calls only, 2 past system notes only, 10 past both. The random sessions often open with tool calls, which a real one rarely does; a real one more often opens with a system note, or has one right after a summary.extra-claude-code-0at 1,200: #0 to #96 now Restyle Settings and show Turnscope's logo in the menu bar #2 to #96 (2 tool calls)extra-claude-code-0at 3,000: #0 to Name an OpenCode or notebook read by its file in a handoff #75 now Restyle Settings and show Turnscope's logo in the menu bar #2 to Name an OpenCode or notebook read by its file in a handoff #75 (2 tool calls)extra-claude-code-3at 3,000: #0 to Simplify limits and the providers #44 now Quote session text when reading a session back #5 to Simplify limits and the providers #44 (1 system note, 4 tool calls)extra-claude-code-9at 1,200: #0 to Take what a Codex rewind went back past out of search #32 now Bump sha2 from 0.10.9 to 0.11.0 in the rust group across 1 directory #1 to Take what a Codex rewind went back past out of search #32 (1 tool call)extra-claude-code-9at 3,000: #0 to Make CI check what ships #18 now Bump sha2 from 0.10.9 to 0.11.0 in the rust group across 1 directory #1 to Make CI check what ships #18 (1 tool call)extra-claude-code-18at 3,000: #0 to Simplify the Codex, OpenCode and Grok Build readers #38 now Name the account by its title in the headline and notifications #3 to Simplify the Codex, OpenCode and Grok Build readers #38 (3 tool calls)extra-claude-code-24at 1,200: #0 to #112 now Bump sha2 from 0.10.9 to 0.11.0 in the rust group across 1 directory #1 to #112 (1 tool call)extra-claude-code-24at 3,000: #0 to Show OpenCode's logo for OpenCode and OpenCode Go #91 now Bump sha2 from 0.10.9 to 0.11.0 in the rust group across 1 directory #1 to Show OpenCode's logo for OpenCode and OpenCode Go #91 (1 tool call)extra-claude-code-27at 1,200: #0 to Sign releases on a runner that never builds #4 now Name the account by its title in the headline and notifications #3 to Sign releases on a runner that never builds #4 (3 tool calls)extra-codex-2at 3,000: #0 to Escape what a search quotes from a session #41 now Restyle Settings and show Turnscope's logo in the menu bar #2 to Escape what a search quotes from a session #41 (2 tool calls)extra-codex-5at 3,000: #0 to Fix what the 0.1.3 release audit found #45 now Restyle Settings and show Turnscope's logo in the menu bar #2 to Fix what the 0.1.3 release audit found #45 (2 tool calls)extra-codex-8at 1,200: #0 to Find the files to read in their own function and test ingest by its results #73 now Name the account by its title in the headline and notifications #3 to Find the files to read in their own function and test ingest by its results #73 (2 system notes, 1 tool call)extra-codex-8at 3,000: #0 to Harden how the app updates and starts its engine #6 now Name the account by its title in the headline and notifications #3 to Harden how the app updates and starts its engine #6 (2 system notes, 1 tool call)extra-codex-17at 3,000: #0 to Simplify sessions, the handoff and redaction tests #39 now Name the account by its title in the headline and notifications #3 to Simplify sessions, the handoff and redaction tests #39 (1 system note, 2 tool calls)extra-codex-20at 1,200: #0 to Do less work per status, and keep serve up #21 now Bump sha2 from 0.10.9 to 0.11.0 in the rust group across 1 directory #1 to Do less work per status, and keep serve up #21 (1 tool call)extra-codex-23at 3,000: #0 to Tell what failed in a handoff by its commands #10 now Sign releases on a runner that never builds #4 to Tell what failed in a handoff by its commands #10 (2 system notes, 2 tool calls)extra-codex-29at 3,000: #0 to Cut AGENTS.md to what a model can't find in the repo #52 now Restyle Settings and show Turnscope's logo in the menu bar #2 to Cut AGENTS.md to what a model can't find in the repo #52 (2 tool calls)extra-opencode-4at 3,000: #0 to Count a file a Codex script patched when its tests then failed #31 now Bump sha2 from 0.10.9 to 0.11.0 in the rust group across 1 directory #1 to Count a file a Codex script patched when its tests then failed #31 (1 tool call)extra-opencode-10at 3,000: #0 to Find the files to read in their own function and test ingest by its results #73 now Sign releases on a runner that never builds #4 to Find the files to read in their own function and test ingest by its results #73 (1 system note, 3 tool calls)extra-opencode-16at 3,000: #0 to Don't hold the database lock for long while reading history #20 now Bump sha2 from 0.10.9 to 0.11.0 in the rust group across 1 directory #1 to Don't hold the database lock for long while reading history #20 (1 system note)extra-opencode-22at 1,200: #0 to Say when the engine is stuck or sends what the app can't read #14 now Bump sha2 from 0.10.9 to 0.11.0 in the rust group across 1 directory #1 to Say when the engine is stuck or sends what the app can't read #14 (1 tool call)extra-opencode-28at 1,200: #0 to Stop rechecking in the app what the engine guarantees #63 now Restyle Settings and show Turnscope's logo in the menu bar #2 to Stop rechecking in the app what the engine guarantees #63 (1 system note, 1 tool call)extra-opencode-28at 3,000: #0 to A rewound Codex thread's transcript includes the turns it rewound past #24 now Restyle Settings and show Turnscope's logo in the menu bar #2 to A rewound Codex thread's transcript includes the turns it rewound past #24 (1 system note, 1 tool call)synthetic-0at 3,000: Bump the rust group with 2 updates #51 to #107 now Check a page's count where the command line and MCP take it #54 to #107 (3 tool calls after its summary)synthetic-5at 3,000: #0 to Check a page's count where the command line and MCP take it #54 now Bump sha2 from 0.10.9 to 0.11.0 in the rust group across 1 directory #1 to Check a page's count where the command line and MCP take it #54 (1 system note)synthetic-6at 3,000: A rewound Codex thread's transcript includes the turns it rewound past #24 to Read Codex rewinds up to where they went back, and title paginated forks #30 now A handoff leaves out a file a Codex script patched when its tests then failed #26 to Read Codex rewinds up to where they went back, and title paginated forks #30 (2 tool calls after its summary)synthetic-7at 3,000: #0 to Tell a key's limit is back while another key's is used up #76 now Read Claude Code usage missing its cache counts, and forks it missed #7 to Tell a key's limit is back while another key's is used up #76 (2 system notes, 5 tool calls)synthetic-8at 3,000: #0 to Simplify the Codex, OpenCode and Grok Build readers #38 now Bump sha2 from 0.10.9 to 0.11.0 in the rust group across 1 directory #1 to Simplify the Codex, OpenCode and Grok Build readers #38 (1 tool call)synthetic-10at 1,200: #0 to Fix four ways reading a provider's limits went wrong #11 now Name the account by its title in the headline and notifications #3 to Fix four ways reading a provider's limits went wrong #11 (3 tool calls)synthetic-11at 3,000: #0 to #121 now Quote session text when reading a session back #5 to #121 (5 tool calls)synthetic-12at 3,000: Remove small workarounds in main, mcp, time and the CLI tests #84 to #115 now Mark the caller's own session in sessions for every agent, not only Claude Code #85 to #115 (1 tool call after its summary)synthetic-13at 3,000: #0 to Decide whether readings share a reset in one place #60 now Restyle Settings and show Turnscope's logo in the menu bar #2 to Decide whether readings share a reset in one place #60 (2 tool calls)synthetic-14at 1,200: #0 to Read Codex rewinds up to where they went back, and title paginated forks #30 now Name the account by its title in the headline and notifications #3 to Read Codex rewinds up to where they went back, and title paginated forks #30 (3 tool calls)synthetic-14at 3,000: #0 to Fix four ways reading a provider's limits went wrong #11 now Name the account by its title in the headline and notifications #3 to Fix four ways reading a provider's limits went wrong #11 (3 tool calls)synthetic-16at 3,000: #0 to #96 now Bump sha2 from 0.10.9 to 0.11.0 in the rust group across 1 directory #1 to #96 (1 tool call)synthetic-20at 1,200: #0 to Bump the rust group with 2 updates #51 now Bump sha2 from 0.10.9 to 0.11.0 in the rust group across 1 directory #1 to Bump the rust group with 2 updates #51 (1 tool call)synthetic-20at 3,000: #0 to A rewound Codex thread's transcript includes the turns it rewound past #24 now Bump sha2 from 0.10.9 to 0.11.0 in the rust group across 1 directory #1 to A rewound Codex thread's transcript includes the turns it rewound past #24 (1 tool call)synthetic-21at 3,000: Fix four ways reading a provider's limits went wrong #11 to Simplify the CLI, MCP server, serve, status and usage #43 now Quote session text within a line of a handoff #13 to Simplify the CLI, MCP server, serve, status and usage #43 (2 tool calls after its summary)synthetic-25at 3,000: #0 to Show a hidden account that status --account names #86 now Restyle Settings and show Turnscope's logo in the menu bar #2 to Show a hidden account that status --account names #86 (2 tool calls)synthetic-33at 3,000: Simplify the CLI tests, the Swift tests and the screenshot script #40 to Escape what a search quotes from a session #41 now Escape what a search quotes from a session #41 alone (1 tool call after its summary)synthetic-34at 3,000: #0 to #133 now Bump sha2 from 0.10.9 to 0.11.0 in the rust group across 1 directory #1 to #133 (1 tool call)synthetic-35at 3,000: #0 to #146 now Read a moved or replaced file without counting it twice #8 to #146 (2 system notes, 6 tool calls)synthetic-37at 3,000: #0 to Fix what used a model's limit, hours on a rolling window, and time ranges #9 now Sign releases on a runner that never builds #4 to Fix what used a model's limit, hours on a rolling window, and time ranges #9 (4 tool calls)synthetic-38at 3,000: #0 to #99 now Restyle Settings and show Turnscope's logo in the menu bar #2 to #99 (2 tool calls)Not checked: real sessions; this machine has no real handoff cases.
Risk
stoppednow starts its range by its closure's rule, infit, not bykind != System. That's the same entry: its closure skips only system notes, and none has a tool call or is quoted as a request.Review focus
src/sessions/handoff.rsfit: the range's new start. The edits instoryandstoppedonly read it.