Clear stale agent actions on turn exit
This commit is contained in:
parent
c5a8f18884
commit
2599ccb4ac
|
|
@ -117,6 +117,11 @@ func (ag *Agent) executeTurn(ctx context.Context, input string) string {
|
|||
actCtx, actCancel := context.WithCancelCause(ctx)
|
||||
handle := &actionHandle{cancel: actCancel}
|
||||
ag.currentAction.Store(handle)
|
||||
defer func() {
|
||||
if ag.currentAction.CompareAndSwap(handle, nil) {
|
||||
actCancel(context.Canceled)
|
||||
}
|
||||
}()
|
||||
ag.SetState("thinking")
|
||||
|
||||
ag.log.Debug("turn: start input=%s session=%s", auditTruncate(input), ag.sessionID)
|
||||
|
|
|
|||
Loading…
Reference in New Issue