Skip to content

Fix handoff stories counting notes and tool calls as left out for room - #89

Merged
joeychilson merged 1 commit into
mainfrom
story-left-out-for-room
Oct 19, 2026
Merged

joeychilson merged 1 commit into
mainfrom
story-left-out-for-room

Conversation

@joeychilson

@joeychilson joeychilson commented Oct 19, 2026 •

Copy link
Copy Markdown
Owner

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

  • The story's "left out for room" range starts at the first entry it would show.
  • fit returns 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 on main:

Its messages, reasoning and subagents' reports, oldest first; its other tool calls are left out. Entries #0 to #2 are left out for room.

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.

Not checked: real sessions; this machine has no real handoff cases.

Risk

stopped now starts its range by its closure's rule, in fit, not by kind != 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.rs fit: the range's new start. The edits in story and stopped only read it.

@joeychilson
joeychilson marked this pull request as draft October 19, 2026 22:33
@joeychilson joeychilson changed the title Say just which entries a handoff's story had no room for Fix handoff stories counting notes and tool calls as left out for room Oct 19, 2026
@joeychilson
joeychilson marked this pull request as ready for review October 19, 2026 22:38
@joeychilson
joeychilson merged commit 20c4d31 into main Oct 19, 2026
3 checks passed
@joeychilson
joeychilson deleted the story-left-out-for-room branch October 19, 2026 23:20
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.

1 participant