org.llm4s.agent.graph.Commit
See theCommit companion object
One atomic write to a thread, fenced by the writing run's claim. The checkpointer applies all of it or none of it:
tokenmust be the FencingToken of the thread's current claim (GraphError.StaleClaim otherwise, checked first): a writer that lost its claim records nothing.checkpoint, if present, becomes the thread's latest, provided itsparentis the current latest - the thread version the writer expects (GraphError.CheckpointConflict) - and its id is not already in the thread's history (GraphError.InvalidCommit); the previous latest stays in the history, and the pending writes recorded against it are dropped.pendingWritesare recorded against the (resulting) latest checkpoint, and must name it - the version they expect (GraphError.InvalidCommit).eventsare appended to the thread's durable log, each given the next sequence number.retractTurn, which needs acheckpoint(GraphError.InvalidCommit otherwise), first removes from the history every checkpoint after the thread's latest settled one - the newest whose status isCompletedorFailed, or all of them if there is none - so that nothing of a turn a guardrail blocked stays readable. The runtime sets it on theFailedcheckpoint that closes a run a node blocked (NodeResult.Block).effectsare upserted by key into the thread's effect records (Checkpointer.effect), each remembered with its task's id and lineage. Before they are, a commit with acheckpointreleases every record for which releasesEffect holds, so replay evidence lives exactly as long as its task can run again (design §4.24). The runtime writes each record of a ReplayGuard as a commit of its own, with no checkpoint, pending write or event.fence, if present as(other, otherToken), fences the commit by another thread's claim too: it applies only ifotherTokenisother's current claim, checked in the same atomic step astokenand the write (one transaction, or under one lock), and otherwise isGraphError.StaleClaim(other, otherToken, otherCurrent)with nothing written -tokenchecked first. The runtime fences every admission and settlement a parent drives on a child thread - its first commit, which writes its Checkpoint.origin, a reattachment's, a resume's and a settlement's - by the parent's claim (design 4.41), so a stale task of a parent taken over never registers or runs a child after a successor took the parent.metadata, if present, replaces the thread's ThreadMetadata (design 4.52), fenced like the rest of the commit;Noneleaves it as it is. A thread keeps its metadata across commits until another replaces it, and loses it only with the thread (Checkpointer.deleteThread).
Attributes
- Companion
- object
- Source
- Checkpoint.scala
- Graph
-
- Supertypes
Members list
In this article
