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
{{ message }}
Repository navigation
[Feature]: Official seam for mid-turn AgentState checkpointing (crash recovery finer than call-end) #3620
Today AgentState is checkpointed at turn boundaries (call-end). If the host process is killed mid-turn (SIGKILL, container eviction), durable recovery only reaches the last completed model call — every tool execution and iteration since then is lost, even though tool results were already produced and emitted as events.
This is the gap every coding-agent harness hits: long agentic turns (many tool calls, minutes of work) are exactly the turns most likely to be interrupted, and exactly the ones where losing progress is most expensive.
What exists vs. what is missing
saveIfVersion / slotVersions / conflictPolicy (2.0.4) provide the CAS primitives for safe concurrent state writes.
But there is no official middleware/hook that checkpoints mid-turn progress — e.g., after each tool-result boundary — without racing the harness's own call-end save. A host-side middleware that writes AgentState mid-turn conflicts with the harness's phase write and risks losing the race under CAS.
In-session event journals help transport replay, but they are not a durable recovery surface for "resume from last tool result" semantics.
Requested seam
An official mid-turn checkpoint point — for example:
A documented onToolResultEnd (or iteration-boundary) checkpoint hook that is serialized with the harness's own state save, using the 2.0.4 CAS primitives; or
A CrashCheckpoint-style middleware in core/harness (not just in a CLI example) that phases in-flight tool results into durable state between model calls.
The goal: after SIGKILL, a fresh runtime recovers to the most recent completed tool result, not just the previous call-end boundary.
Note
We currently mitigate host-side by checkpointing the durable transcript at tool-result boundaries (batch + interval cadence) — recovery reads back "completed up to last tool result". That workaround is tracked for removal once an official mid-turn checkpoint seam exists, since AgentState remains the authoritative recovery surface.
Activity