Skip to content

fix(agent): keep the whole conversation and budget old tool results - #63

Merged
Rl0007 merged 3 commits into
mainfrom
fix/agent-history-window
Oct 6, 2026
Merged

Rl0007 merged 3 commits into
mainfrom
fix/agent-history-window

Conversation

@Rl0007

@Rl0007 Rl0007 commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor
  1. After one long turn with many tool calls, the assistant forgot everything said before it and denied it had been asked.
  2. The history now keeps every user and assistant message. Only old tool results are cut, also within a turn: past about 40k tokens of results, the oldest are replaced with a short note, and the new read_history tool brings them back.

You can visit the assistant in any import to see it.

Fixes #25

Verification
  • Tests: every message kept past the old 40-message limit, oldest results cleared over the budget, the cutoff moving only in 10k-token steps, clearing between rounds of one turn (fails without the loop change), and read_history returning a cleared result and staying inside its session.
  • Full suite on wikify.localhost: 521 run, 0 fail, 11 skip.
  • Live on wikify.localhost with the real model and the budget lowered to 8k chars, 4 turns: the oldest result was cleared; asked to quote it without re-reading, the model called read_history and quoted the sentence correctly; asked for the first request, it answered correctly.
  • Real local session with 87 tool results (215k chars): 37 cleared, all 22 user messages kept, no orphaned tool result, about 46k tokens in total.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

@Rl0007
Rl0007 force-pushed the fix/agent-history-window branch from 46a9d48 to b1c89a5 Compare October 6, 2026 07:18

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

@Rl0007 Rl0007 changed the title fix(agent): keep earlier turns in history after a tool-heavy turn fix(agent): keep the whole conversation and budget old tool results Oct 6, 2026

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

@Rl0007
Rl0007 merged commit 1dd0802 into main Oct 6, 2026
3 checks passed
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.

After one long tool-heavy turn, the assistant forgets the conversation

1 participant