The change an interrupted turn end already recorded for the turn that is still in flight. A hook killed after the record but before the session is saved leaves the turn's change in the session view and no outcome entry. The change is its own durable record: its hashed session envelope names this session and turn, it is the newest change of the session view, and the view has moved since the turn s
(
repo: &atomic_repository::Repository,
session: &crate::turn::session::AgentSession,
turn: u32,
boundary_end: &TurnBoundary,
)
| 1263 | /// change imported from Git, and a turn number reused after the turn was |
| 1264 | /// abandoned all return `None`. |
| 1265 | fn change_recorded_for_open_turn( |
| 1266 | repo: &atomic_repository::Repository, |
| 1267 | session: &crate::turn::session::AgentSession, |
| 1268 | turn: u32, |
| 1269 | boundary_end: &TurnBoundary, |
| 1270 | ) -> Option<atomic_core::types::Hash> { |
| 1271 | let boundary_start = session.boundary_start.as_ref()?; |
| 1272 | if boundary_start.view != session.view_name || boundary_end.view != session.view_name { |
| 1273 | return None; |
| 1274 | } |
| 1275 | match (&boundary_start.view_state, &boundary_end.view_state) { |
| 1276 | (Some(before), Some(after)) if before != after => {} |
| 1277 | _ => return None, |
| 1278 | } |
| 1279 | let newest = repo |
| 1280 | .log(atomic_repository::HistoryOptions::new().view(session.view_name.as_str())) |
| 1281 | .ok()? |
| 1282 | .pop()?; |
| 1283 | let change = repo.load_change(&newest.hash).ok()?; |
| 1284 | let envelope = |
| 1285 | atomic_core::change::envelope::SessionEnvelope::decode(&change.hashed.metadata).ok()?; |
| 1286 | (envelope.session_id == session.session_id && envelope.turn_number == turn) |
| 1287 | .then_some(newest.hash) |
| 1288 | } |
| 1289 | |
| 1290 | /// The outcome of a turn whose change an interrupted turn end already |
| 1291 | /// recorded, when the turn ended on its own exact managed commit. |
no test coverage detected