Skip to content

[FEATURE] Summarize after message 0 when the cut lands on the last message #5736

Closed

Description

@jimbrub

SDK Language

Both / Not language-specific

Problem Statement

#5470 keeps message 0 verbatim and moves a recency pass's cut off the last message, so a text summary never joins the live turn. When the moved cut leaves nothing to summarize after message 0, the pass is skipped, even in cases where main summarizes without touching the last message:

[task] [a: 20k answer] [u: 20k], preserve_recent=1
main:   [task] [a: [Summarized: 1 message …]] [u: 20k]   (last message untouched)
#5470:  applied=False (cut 2 -> 1, only message 0 is left)

In the reviewer's fuzz on #5470, this accounts for 85 of 3,000 histories that main summarizes and #5470 skips. Only configs with preserve_recent ≤ 1 (or 2 with a trailing tool pair) hit it; the built-in configs (preserve_recent=4 and 0.7) do not.

Proposed Solution

Keep the move. When the moved cut leaves nothing to summarize after message 0, plan again with the unmoved cut and add the last message to _locked_roles / lockedRoles, so the summary can stand alone or join the message before the gap but never the last message.

In the reviewer's prototype (a monkeypatch on #5470):

Alternatives ruled out on #5470: dropping the move (305 passes then modify the live last message), and always locking the last message instead of moving the cut (loses 262 passes the move allows).

Acceptance

Related: #5410, #5464. Context: #5470 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area-contextSession or context relatedarea-modelRelated to models or model providersenhancementNew feature or request

Fields

Language

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions