pub struct CheckpointData {
pub session_id: SessionId,
pub user_input: String,
pub step: CheckpointStep,
pub turn_count: u32,
pub version: u32,
pub backend: ActionFormat,
pub migrated_from: Option<MigrationSource>,
pub run_state: Option<RunState>,
}Fields§
§session_id: SessionId§user_input: String§step: CheckpointStep§turn_count: u32§version: u32Payload version (CHECKPOINT_VERSION on native writes; 0 for the
pre-versioning corpus, which had no such field). Never backfilled.
backend: ActionFormatBackend affinity pin (OV-5+11): the action protocol this payload speaks. Absent on the wire means the pre-labeling tool-call corpus — the step shape itself is the evidence.
migrated_from: Option<MigrationSource>Source mark set when the payload was converted on read (T5 migration layer). Absent for natively written data.
run_state: Option<RunState>The counting evidence (D5+OV-11): co-written with the step in the one
journal line, so the recorded batch and the counts can never disagree
across a crash window. Native writes ALWAYS carry it (new stores
Some); on the wire it is optional so the pre-T7 corpus (and converted
legacy payloads) stay readable with the field genuinely absent —
restores of those fall back to the old-format paths, never guessed
(不猜不回填).
Implementations§
Source§impl CheckpointData
impl CheckpointData
Sourcepub fn new(
session_id: SessionId,
user_input: impl Into<String>,
step: CheckpointStep,
turn_count: u32,
backend: ActionFormat,
run_state: RunState,
) -> Self
pub fn new( session_id: SessionId, user_input: impl Into<String>, step: CheckpointStep, turn_count: u32, backend: ActionFormat, run_state: RunState, ) -> Self
Native checkpoint of CHECKPOINT_VERSION, pinned to backend, with
the counting state co-written (D5+OV-11 事务同写).
Sourcepub fn verify_for_resume(&self, expected: ActionFormat) -> Result<(), String>
pub fn verify_for_resume(&self, expected: ActionFormat) -> Result<(), String>
The T5 persistence contract, checked before resume: the checkpoint must speak the resuming backend’s protocol, and every action payload must carry a matching format label. Refusals spell out the mismatch.
Sourcepub fn verify_for_resume_any(
&self,
accepted: &[ActionFormat],
) -> Result<(), String>
pub fn verify_for_resume_any( &self, accepted: &[ActionFormat], ) -> Result<(), String>
The same contract over the set of formats one runtime can resume (T10c): a session may interleave built-in tool-call turns with a mounted backend’s turns, so the pin check accepts every format the runtime is assembled with — and refuses a pin naming a backend it does not carry (“mount it to resume this session”), never a silent replay through the wrong protocol.
Trait Implementations§
Source§impl Clone for CheckpointData
impl Clone for CheckpointData
Source§impl Debug for CheckpointData
impl Debug for CheckpointData
Source§impl<'de> Deserialize<'de> for CheckpointData
CheckpointData is read through the T5 migration layer: native shapes
first, then the pre-M3 shapes (converted, marked). Deserialize is manual so
the version/backend/source-mark contract lives in one place — Serialize
stays derived and always writes the native shape.
impl<'de> Deserialize<'de> for CheckpointData
CheckpointData is read through the T5 migration layer: native shapes
first, then the pre-M3 shapes (converted, marked). Deserialize is manual so
the version/backend/source-mark contract lives in one place — Serialize
stays derived and always writes the native shape.