Skip to content

0.2.5

Choose a tag to compare

@BYK BYK released this 25 Feb 07:15
· 110 commits to main since this release
0.2.5
1813145

Fix

Infinite tool-call loop from evicting mid-turn agentic steps

In agentic mode, each tool-call step is a separate assistant message sharing the same parentID as the current user message. As steps accumulated, the cumulative token cost could exceed the gradient's rawBudget, causing tryFit to set a cutoff that dropped earlier steps from the current turn. The model saw only the most recent step(s) + the original user request, had no memory of prior work, and re-issued the same tool call — infinite loop.

Fix: tryFit now identifies the current turn (last user message + all following assistant messages) and treats it as an atomic protected unit:

  1. Reserves budget for the entire current turn upfront
  2. Returns null (escalates to next layer) if the current turn alone exceeds rawBudget
  3. Fills remaining budget with older messages — these are the only ones that can be evicted
  4. Marks current-turn messages as strip-protected for tool-output stripping

tryFitStable inherits the fix via its tryFit fallback.