Fix suspension checkpoint fallback in nested and parallel execution

executeParallel ignored SuspendedError when checkpoint was nil,
treating it as a normal tool error. Nested suspension propagation
also dropped the in-memory checkpoint when persistence failed,
making runs non-resumable.

Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
This commit is contained in:
Aurélien Sibiril
2026-04-13 23:13:06 +02:00
parent 83dba57add
commit fb88318c54

View File

@@ -562,7 +562,7 @@ func coreLoop(ctx context.Context, startAgent *Agent, inputMessages []llm.Messag
s.logger.ErrorCtx(ctx, "cannot save checkpoint", log.Error(saveErr))
}
}
return s.finishRun(ctx, nil, &SuspendedError{RunID: s.opts.runID})
return s.finishRun(ctx, nil, &SuspendedError{RunID: s.opts.runID, Checkpoint: outerCP})
}
if nae, ok := errors.AsType[*needsApprovalError](err); ok {
@@ -967,7 +967,7 @@ func executeParallel(
continue
}
se, ok := errors.AsType[*SuspendedError](entry.err)
if ok && se.Checkpoint != nil {
if ok {
innerCheckpoints := make(map[string]*Checkpoint)
var completed []CompletedCall