Done! The change now ensures cleanup scripts will commit their changes even when they fail. (#931)

**What changed:**
- Added `success` flag: Process completed with exit code 0 (normal success path)
- Added `cleanup_done` flag: Cleanup script finished in any state except Running
- Commits are attempted if either condition is true

**Result:** When a cleanup script fails, any file changes it made will still be committed to git, instead of being lost.
This commit is contained in:
Louis Knight-Webb
2025-10-04 14:24:25 +01:00
committed by GitHub
parent c45e40717e
commit 8a9f398aaf

View File

@@ -432,11 +432,20 @@ impl LocalContainerService {
tracing::warn!("Failed to update executor session summary: {}", e);
}
if matches!(
let success = matches!(
ctx.execution_process.status,
ExecutionProcessStatus::Completed
) && exit_code == Some(0)
{
) && exit_code == Some(0);
let cleanup_done = matches!(
ctx.execution_process.run_reason,
ExecutionProcessRunReason::CleanupScript
) && !matches!(
ctx.execution_process.status,
ExecutionProcessStatus::Running
);
if success || cleanup_done {
// Commit changes (if any) and get feedback about whether changes were made
let changes_committed = match container.try_commit_changes(&ctx).await {
Ok(committed) => committed,