Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(embed/harness): use `keep()` to preserve temp directory for retried cleanup\n\nThe harness drop implementation now calls `keep()` on the temporary directory before attempting the retried removal loop, ensuring the directory is not deleted prematurely by the tempdir drop and preserving the documented guarantee that the workspace is removed with its harness.\n\nAuto-committed-on: dragonfly\n

Steven Enamakel1e4e59c8d3a3
diff --git a/src/embed/harness/mod.rs b/src/embed/harness/mod.rs
index 6bc8d53b4b..8096a0ef56 100644
--- a/src/embed/harness/mod.rs
+++ b/src/embed/harness/mod.rs
@@ -193,7 +193,9 @@ impl Drop for Harness {
// breaking the documented "removed with its harness" guarantee. A
// bounded retry lets those writes settle before we give up.
if let Some(temp) = self._workspace._temp.take() {
- let root = temp.into_path();
+ // `keep()` hands back the path without removing the directory so
+ // we can do the retried removal ourselves.
+ let root = temp.keep();
for _ in 0..20 {
if std::fs::remove_dir_all(&root).is_ok() {
break;