MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / record_turn_outcome

Method record_turn_outcome

atomic-agent/src/turn/session.rs:499–516  ·  view source on GitHub ↗

Persist one classified turn outcome. Review R7 (executed probe): the bounded history is a display cache, and bounding it must never evict the only unattested evidence. Only a leading run of entries whose evidence is fully attested (or that carries nothing unattestable) is drained; unattested git-only outcomes are append-only until a session attestation covers them. Sessions that never attest ther

(&mut self, entry: TurnOutcomeEntry)

Source from the content-addressed store, hash-verified

497 /// never attest therefore grow this ledger instead of silently dropping
498 /// their evidence — the honest failure mode.
499 pub fn record_turn_outcome(&mut self, entry: TurnOutcomeEntry) {
500 self.turn_outcomes.push(entry);
501 let excess = self
502 .turn_outcomes
503 .len()
504 .saturating_sub(MAX_SESSION_TURN_OUTCOMES);
505 if excess > 0 {
506 let evictable = self
507 .turn_outcomes
508 .iter()
509 .take(excess)
510 .take_while(|entry| entry.evictable(&self.attested_operations))
511 .count();
512 if evictable > 0 {
513 self.turn_outcomes.drain(0..evictable);
514 }
515 }
516 }
517
518 /// The recorded classification for one turn, when still retained.
519 pub fn outcome_for_turn(&self, turn: u32) -> Option<&TurnOutcomeEntry> {

Calls 5

evictableMethod · 0.80
pushMethod · 0.45
lenMethod · 0.45
countMethod · 0.45
iterMethod · 0.45

Tested by 1