Skip to content

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

refactor(runtime): simplify workspace directory handling in test harness

Steven Enamakeld36672799b80
diff --git a/crates/openhuman-core/src/channels/runtime/test_support.rs b/crates/openhuman-core/src/channels/runtime/test_support.rs
index 93e3f7725c..25532b8e55 100644
--- a/crates/openhuman-core/src/channels/runtime/test_support.rs
+++ b/crates/openhuman-core/src/channels/runtime/test_support.rs
@@ -35,7 +35,7 @@ pub struct DispatchHarnessOptions {
pub handler_error: Option<String>,
pub handler_delay_ms: u64,
pub timeout_secs: u64,
- /// Workspace the runtime context reports; `None` uses an isolated temporary workspace.
+ /// Workspace the runtime context reports; `None` falls back to the OS temp dir.
///
/// `pub`, like every other field here, and it has to be: integration tests
/// under `tests/` are a separate crate, and a struct-update expression
@@ -343,13 +343,10 @@ pub async fn run_dispatch_harness(options: DispatchHarnessOptions) -> DispatchHa
.clone()
.into_inner()
.unwrap_or_else(|| ChannelSystemPrompt::fixed("system prompt"));
- let (harness_workspace_dir, _workspace_guard) = match options.workspace_dir.clone() {
- Some(workspace) => (workspace, None),
- None => {
- let workspace = tempfile::tempdir().expect("temporary dispatch harness workspace");
- (workspace.path().to_path_buf(), Some(workspace))
- }
- };
+ let harness_workspace_dir = options
+ .workspace_dir
+ .clone()
+ .unwrap_or_else(std::env::temp_dir);
let ctx = Arc::new(ChannelRuntimeContext {
relay_thread: None,
channels_by_name: Arc::new(channels_by_name),