(
root: &Path,
files: &FileManifest,
options: &TurnRecordOptions<'_>,
)
| 161 | } |
| 162 | |
| 163 | pub(super) fn validate( |
| 164 | root: &Path, |
| 165 | files: &FileManifest, |
| 166 | options: &TurnRecordOptions<'_>, |
| 167 | ) -> AgentResult<()> { |
| 168 | for (path, expected) in files { |
| 169 | let actual = fingerprint(root, path).map_err(|reason| AgentError::RecordFailed { |
| 170 | session_id: options.session.session_id.clone(), |
| 171 | turn_number: options.turn_number, |
| 172 | reason, |
| 173 | })?; |
| 174 | if &actual != expected { |
| 175 | return Err(AgentError::RecordFailed { session_id: options.session.session_id.clone(), turn_number: options.turn_number, reason: format!("scoped file changed after this session's tool finished: {path}; refusing ambiguous ownership") }); |
| 176 | } |
| 177 | } |
| 178 | Ok(()) |
| 179 | } |
| 180 | |
| 181 | /// A duplicate Stop can be acknowledged only if its scoped files have no |
| 182 | /// unrecorded changes. Never use unrelated working-tree edits as evidence of |
no test coverage detected