agent: inject postTurn context into session history

Non-blocked postTurn hook output is now appended to session history so
the model sees it at the start of the next turn without triggering
autonomous continuation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Levi Neely 2026-04-25 23:53:00 +02:00
parent 51922b78fc
commit aa890502cd
1 changed files with 3 additions and 0 deletions

View File

@ -825,6 +825,9 @@ func (s *agent) executeTurn(ctx context.Context, input string, handler EventHand
if stopResult.Warning != "" {
handler(infoEvent(stopResult.Warning))
}
if !stopResult.Blocked && stopResult.Context != "" && s.session != nil {
s.session.appendUserMessage(stopResult.Context)
}
s.saveSession()