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

Function resume_recorded_managed_commit

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

The outcome of a turn whose change an interrupted turn end already recorded, when the turn ended on its own exact managed commit. The working copy is clean because the content is already in the session view, so this turn end only finishes the bookkeeping the interrupted one did not reach. Without it the turn would be classified as a commit whose content never landed in Atomic, and the session wou

(
    repo: &atomic_repository::Repository,
    repo_root: &Path,
    options: &TurnRecordOptions<'_>,
    boundary_end: &TurnBoundary,
)

Source from the content-addressed store, hash-verified

1296/// content never landed in Atomic, and the session would go incomplete over
1297/// a change it recorded itself.
1298fn resume_recorded_managed_commit(
1299 repo: &atomic_repository::Repository,
1300 repo_root: &Path,
1301 options: &TurnRecordOptions<'_>,
1302 boundary_end: &TurnBoundary,
1303) -> Option<TurnRecordOutcome> {
1304 let start_git = options.session.boundary_start.as_ref()?.git.as_ref()?;
1305 let end_git = boundary_end.git.as_ref()?;
1306 if start_git.head_symref.is_some() || end_git.head_symref.is_some() {
1307 return None;
1308 }
1309 let parent = start_git.head_oid.as_deref()?;
1310 let hash =
1311 change_recorded_for_open_turn(repo, options.session, options.turn_number, boundary_end)?;
1312 let transition =
1313 classify_dirty_turn_git_transition(repo, repo_root, options, Some(boundary_end))?;
1314 let commit = transition.exact_commit_oid.as_deref()?;
1315 let recorded_files: Vec<String> = commit_changed_paths(repo_root, parent, commit)?
1316 .into_iter()
1317 .map(|entry| entry.path)
1318 .collect();
1319 let message = repo.load_change(&hash).ok()?.hashed.header.message.clone();
1320 log::info!(
1321 "Turn {} of session {} was already recorded as {} by an interrupted turn end; \
1322 finishing it on managed commit {}",
1323 options.turn_number,
1324 options.session.session_id,
1325 hash.to_base32(),
1326 commit
1327 );
1328 Some(TurnRecordOutcome {
1329 hash,
1330 turn_number: options.turn_number,
1331 file_count: recorded_files.len(),
1332 message,
1333 recorded_files,
1334 unhashed_data: None,
1335 git_transition: Some(transition),
1336 })
1337}
1338
1339/// The result of a turn whose working copy is clean: the turn an
1340/// interrupted turn end already recorded, or its classification.

Callers 1

clean_turn_resultFunction · 0.85

Calls 10

commit_changed_pathsFunction · 0.85
as_refMethod · 0.80
collectMethod · 0.45
into_iterMethod · 0.45
cloneMethod · 0.45
okMethod · 0.45
load_changeMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected