Skip to content

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

refactor(skills): adjust async call syntax for run log operations

Steven Enamakelfb5f7e0082ea
diff --git a/crates/openhuman-core/src/skills/run_log_tests.rs b/crates/openhuman-core/src/skills/run_log_tests.rs
index f14a316671..85fddb63d4 100644
--- a/crates/openhuman-core/src/skills/run_log_tests.rs
+++ b/crates/openhuman-core/src/skills/run_log_tests.rs
@@ -72,7 +72,9 @@ async fn drain_to_log_returns_the_turns_stop() {
);
let log = read_run_log_slice(dir.path(), &path, 0, 4096).unwrap();
assert!(log.content.contains("stopped: iteration_cap"), "{log:?}");
- write_footer(dir.path(), &path, "STOPPED", 1, "stopped").await.unwrap();
+ write_footer(dir.path(), &path, "STOPPED", 1, "stopped")
+ .await
+ .unwrap();
}
#[tokio::test]
@@ -92,13 +94,18 @@ async fn host_written_log_parses_like_legacy_layout() {
)
.await
.unwrap();
- write_footer(tmp.path(), &path, "DONE", 42, "ok").await.unwrap();
+ write_footer(tmp.path(), &path, "DONE", 42, "ok")
+ .await
+ .unwrap();
let runs = scan_runs(tmp.path(), Some("triage-inbox"), 10);
assert_eq!(runs.len(), 1);
assert_eq!(runs[0].run_id, "run-abcdef123456");
assert_eq!(runs[0].status, "DONE");
assert_eq!(runs[0].duration_ms, Some(42));
- assert_eq!(read_terminal_outcome(tmp.path(), &path).unwrap().status, "DONE");
+ assert_eq!(
+ read_terminal_outcome(tmp.path(), &path).unwrap().status,
+ "DONE"
+ );
// The stream retains the same parsed run metadata as the old log format.
}
diff --git a/crates/openhuman-core/src/skills/runtime/run_machinery.rs b/crates/openhuman-core/src/skills/runtime/run_machinery.rs
index 0b355ad35d..81f5073a99 100644
--- a/crates/openhuman-core/src/skills/runtime/run_machinery.rs
+++ b/crates/openhuman-core/src/skills/runtime/run_machinery.rs
@@ -164,16 +164,15 @@ pub async fn spawn_workflow_run_background(
let inherited_origin = inherited_origin.clone();
let ctx = ctx.clone();
tokio::spawn(async move {
- if let Err(e) =
- run_log::write_header(
- &workspace,
- &log_path,
- &workflow_id,
- &run_id,
- &inputs,
- &task_prompt,
- )
- .await
+ if let Err(e) = run_log::write_header(
+ &workspace,
+ &log_path,
+ &workflow_id,
+ &run_id,
+ &inputs,
+ &task_prompt,
+ )
+ .await
{
tracing::warn!(run_id = %run_id, error = %e, "[skills] workflow_run: header write failed");
}
@@ -270,15 +269,14 @@ pub async fn spawn_workflow_run_background(
run_log::unregister_run_cancel(&run_id);
match result {
None => {
- let _ =
- run_log::write_footer(
- &workspace,
- &log_path,
- "CANCELLED",
- ms,
- "Run stopped by user.",
- )
- .await;
+ let _ = run_log::write_footer(
+ &workspace,
+ &log_path,
+ "CANCELLED",
+ ms,
+ "Run stopped by user.",
+ )
+ .await;
tracing::info!(run_id = %run_id, "[workflows] workflow_run: cancelled");
}
Some(Ok(out)) if stop.is_some() => {
@@ -305,19 +303,29 @@ pub async fn spawn_workflow_run_background(
repeated line (truncated to 160 chars):\n {preview}\n\n\
full final output follows below for forensic review:\n\n{out}",
);
- let _ = run_log::write_footer(&workspace, &log_path, "DEGENERATE", ms, &body).await;
+ let _ =
+ run_log::write_footer(&workspace, &log_path, "DEGENERATE", ms, &body)
+ .await;
tracing::warn!(
run_id = %run_id,
repeats = count,
"[skills] workflow_run: degenerate final response rejected"
);
} else {
- let _ = run_log::write_footer(&workspace, &log_path, "DONE", ms, &out).await;
+ let _ =
+ run_log::write_footer(&workspace, &log_path, "DONE", ms, &out).await;
tracing::info!(run_id = %run_id, "[skills] workflow_run: completed");
}
}
Some(Err(e)) => {
- let _ = run_log::write_footer(&workspace, &log_path, "FAILED", ms, &format!("{e:#}")).await;
+ let _ = run_log::write_footer(
+ &workspace,
+ &log_path,
+ "FAILED",
+ ms,
+ &format!("{e:#}"),
+ )
+ .await;
tracing::warn!(run_id = %run_id, error = ?e, "[skills] workflow_run: failed");
}
}