Repository navigation
fix(agent): preserve newest turn in chronological conversation lists - #224
Merged
NandhaKishorM merged 1 commit intoSep 23, 2026
Merged
NandhaKishorM merged 1 commit into
NandhaKishorM merged 1 commit into
Conversation
Owner
|
Thank you. Dropping the newest turn of a long conversation is the one truncation that changes the decision, and a list state is always chronological, so left truncation there is right. Strings and dicts keep their current behaviour. Merging. |
baninaveen
pushed a commit
to baninaveen/laya
that referenced
this pull request
Sep 24, 2026
3 of 4 tasks
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
Long chronological conversation state is serialized newest-last. When it exceeds the available state budget,
build_sequencedefaults to right truncation (st[:room]), so the newest turn can be silently dropped whileAgent.system_onestill returns a normal decision.This patch preserves the most recent conversational intent for the public list-shaped state contract.
Change
Agent.system_onetruncate_left=Truefor conversation turn listsbuild_sequenceAPI and default unchangedWhy this shape
Agent.system_onedocuments list state as a conversation turn list, so the newest turn is at the tail. Preserving the tail is the smallest change that protects recent conversational intent without changing non-conversation callers.Validation
This is orthogonal to #181, which covers truncation metadata reporting. The older #2 explored broader
truncate_leftplumbing; this PR keeps the change focused on the public conversation-list behavior.