Skip to content

fix(history_text): preserve recent entries when truncating transcript#12

Open
kvpratama wants to merge 1 commit intorasbt:mainfrom
kvpratama:fix/history-text-trim-oldest-first
Open

fix(history_text): preserve recent entries when truncating transcript#12
kvpratama wants to merge 1 commit intorasbt:mainfrom
kvpratama:fix/history-text-trim-oldest-first

Conversation

@kvpratama
Copy link
Copy Markdown

@kvpratama kvpratama commented Apr 22, 2026

clip() kept the head of the assembled transcript, but history is built oldest-first, so truncation silently dropped the most recent entries exactly the ones the recency-weighting logic (900 vs 180 char limits) was designed to protect.

Add tail_clip(), which mirrors clip() but keeps the tail, and use it in history_text(). A truncation notice at the top of the string lets the model know older context was dropped.

Also add a regression test for the history_text() truncation behaviour.

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