You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(langgraph): computeFold falls back to the last human boundary so mid-turn folding works (#66)
The forward-only cut scan meant a long tool loop (protected tail all
ai/tool) could never fold: the trigger fired every cycle and computeFold
returned null every cycle, exactly when relief was needed. When no human
exists at/after the naive cut, the cut now falls back to the LAST
HumanMessage before it — keeps more than keepRecent (always safe), and the
retained history still opens on a human (nothing orphaned).
`computeFold` can now fold mid-turn: when the protected tail is all ai/tool messages (a long tool loop) and no HumanMessage exists at/after the naive cut, the cut falls back to the LAST HumanMessage before it — keeping more than `keepRecent` (always safe) with the retained history still opening on a human. Previously the forward-only scan returned null every cycle exactly when relief was needed, so a token trigger fired forever while the whole tool loop rode at peak context.
0 commit comments