agentos icon indicating copy to clipboard operation
agentos copied to clipboard

A host that stops reading at a node's node_end loses the checkpoint after the node

Open jddunn opened this issue 3 weeks ago • 1 comments

What happened

Under checkpointPolicy: 'every_node' (or a node set to checkpoint: 'after' or 'both'), GraphRuntime saves the checkpoint after a node only after it has yielded the node's node_end and edge_transition events, in both stream() and the resumed path (continueFromCheckpoint(), which streamResume() and resume() run). See the sequential path of stream() in src/orchestration/runtime/GraphRuntime.ts.

Failing input

A linear graph send (a toolNode, effectClass: 'external') then publish, under every_node. The host reads stream() (or streamResume()) and stops at node_end:send, or at edge_transition:send->publish, with break. The generator closes at that yield, so the checkpoint after send is never saved, and a resume by the run id runs send again: the external call repeats.

A parallel batch does not have this gap: its last checkpoint is saved before any of the batch's events are yielded (docs/orchestration/CHECKPOINTING.md, "Resume Semantics").

Expected

The checkpoint after a node is saved before the node's node_end is yielded, with the events kept in their present order (node_end, edge_transition, then checkpoint_saved), as the checkpoint of a node that interrupts or fails already is. A node that asks for an expansion keeps its checkpoint before the expansion, since its edges are decided on the graph the expansion leaves.

Where it was found

Review of framerslab/agentos#798, which gives the resumed path the same before, after and every_node saves as stream() and keeps stream()'s order.

Related

jddunn avatar Nov 11 '26 17:11 jddunn

Fixed in #893, merged to master as 441dab7. The sequential runtime saves the checkpoint before a host can stop at node_end or edge_transition. The four regression cases cover fresh and resumed streams and passed in run 45125361461.

jddunn avatar Nov 23 '26 06:11 jddunn