handoff: pass full session history to summarizer#1033
Merged
Conversation
Co-authored-by: npub1jh9wn95s0472h86ahapupaf7m6kx4v9sx2n0atj2hltcfer8k06s5n3pyf <95cae996907d7cab9f5dbf43c0f53edeac6ab0b032a6feae4abfd784e467b3f5@sprout-oss.stage.blox.sqprod.co> Signed-off-by: npub1jh9wn95s0472h86ahapupaf7m6kx4v9sx2n0atj2hltcfer8k06s5n3pyf <95cae996907d7cab9f5dbf43c0f53edeac6ab0b032a6feae4abfd784e467b3f5@sprout-oss.stage.blox.sqprod.co>
tlongwell-block
commented
Jun 13, 2026
tlongwell-block
left a comment
Collaborator
Author
There was a problem hiding this comment.
Reviewed end-to-end on the worktree at HEAD. The final loop shape (iterate newest-first, push, reverse) is a meaningful improvement over the earlier draft I saw and correctly handles the oldest-drop-under-pressure case. The handoff_prompt_budget_bytes semantics (subtract fixed_prompt_bytes from the derived input budget, saturate to 0) is cleaner than a .max(fixed) floor.
Verified locally on pr1033:
cargo test -p buzz-agent handoff— 5 passed- Oversized-latest-item fallback: clamps to budget, then every older item correctly overflows → drop. No off-by-one.
- Saturate-to-zero budget edge case (
handoff_prompt_budget_saturates_when_fixed_prompt_exceeds_window) is covered.
Non-blocking notes:
- Oversized-latest path doesn't surface that the latest item was itself clamped (only that older items were omitted). The summarizer could in theory cite cut text. Not a regression from prior behavior. Future polish: a "[latest item truncated]" marker.
- This is the budget/history fix only. The originally-discussed system prompt +
# Previous Stateextractor are deferred. Please open a follow-up issue so that work doesn't get lost.
Approving.
tellaho
pushed a commit
that referenced
this pull request
Jun 14, 2026
…tate * origin/main: (21 commits) fix(release): use signed NSIS installer for updates (#1036) handoff: pass full session history to summarizer (#1033) feat(emoji): latest-set-wins union for custom emoji across desktop, mobile, and CLI (#989) Fix relay NIP-11 software URL (#1030) fix(desktop): make Windows release compile cleanly (#1029) Add production Docker Compose bundle (#985) feat(profile): show active turn badges on agent profile panel and popover (#1026) chore(release): release version 0.3.20 (#1027) fix(release): resolve Windows sidecar path and Linux AppImage updater format (#1024) chore(release): release version 0.3.19 (#1014) fix(release): ignore prerelease tags in changelog generation (#1021) fix: repair main build after cross-PR merge skew (#1020) feat(agents): show per-turn duration and prune dead turns within ~25s of host crash (#1017) fix(release): replace hermit with native tool setup on Windows job (#1018) feat(acp): surface error-class outcomes to the activity feed only, never the channel (#1010) fix(desktop): migrate Sprout workspace storage (#1016) feat(auth): force token refresh on rejected token (401/403), never the browser (#1015) fix(release): mark prerelease versions so they do not become latest (#1013) feat(acp): implement systemPrompt with protocol version gating (#981) fix(release): update repository name check from block/sprout to block/buzz (#1012) ... Co-authored-by: Taylor Ho <taylorkmho@gmail.com> Signed-off-by: Taylor Ho <taylorkmho@gmail.com> # Conflicts: # desktop/src/features/profile/ui/UserProfilePanel.tsx
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.
Summary
BUZZ_AGENT_MAX_CONTEXT_TOKENS - HANDOFF_MAX_OUTPUT_TOKENS.Scope
This PR is intentionally budget/history-only. It does not include the handoff summarizer prompt rewrite or
# Previous Stateextractor work; that is tracked separately in #1034.Follow-up: #1034
Testing
cargo test -p buzz-agent --test regressions handoff -- --nocapturecargo test -p buzz-agent handoff -- --nocaptureBUZZ_AGENT_MAX_CONTEXT_TOKENS=25000, key referenced only by~/keys/anthropic.key: handoff occurred and the post-handoff answer recoveredEARLY_MARKER_full_history_handoff_live_test_7f43.rust-clippyfailed because local rustc 1.89.0 is below current dependency MSRV (irohrequires 1.91,sqlxrequires 1.94). Pushed with--no-verifyafter targeted tests passed.Live Haiku handoff sample
Captured through a local Anthropic proxy that recorded only the handoff request/response. The handoff prompt was 16,828 bytes, contained
# Original Task, contained# Session History, contained the early marker, and included an older-items omission marker. The post-handoff answer recovered the marker.