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

Function open_turn_recorded_managed_commit

atomic-agent/src/record/mod.rs:1463–1485  ·  view source on GitHub ↗

Whether the in-flight turn of `session` already recorded its change and ended on `commit_oid`: a turn end interrupted after the record but before the session was saved. The evidence is the recorded change itself plus the commit-time capture, which must authenticate the commit.

(
    repo_root: &Path,
    session: &crate::turn::session::AgentSession,
    commit_oid: &str,
)

Source from the content-addressed store, hash-verified

1461/// the session was saved. The evidence is the recorded change itself plus
1462/// the commit-time capture, which must authenticate the commit.
1463fn open_turn_recorded_managed_commit(
1464 repo_root: &Path,
1465 session: &crate::turn::session::AgentSession,
1466 commit_oid: &str,
1467) -> bool {
1468 if !session.is_turn_active() || session.boundary_start.is_none() {
1469 return false;
1470 }
1471 let Ok(repo) = atomic_repository::Repository::open_readonly(repo_root) else {
1472 return false;
1473 };
1474 let Some(open) = captured_commit_of_open_turn(&repo, repo_root, session) else {
1475 return false;
1476 };
1477 open.commit_oid == commit_oid
1478 && change_recorded_for_open_turn(
1479 &repo,
1480 session,
1481 session.turn_count.saturating_add(1),
1482 &open.boundary_end,
1483 )
1484 .is_some()
1485}
1486
1487/// Whether one persisted turn outcome is a recorded content turn that ended
1488/// on `commit_oid` with a capture that still verifies for it.

Callers 1

Calls 4

is_turn_activeMethod · 0.80
is_noneMethod · 0.80

Tested by

no test coverage detected