Skip to content

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

refactor(skills): pass workspace to log reading functions

Steven Enamakel7da367b38dc1
diff --git a/crates/openhuman-core/src/skills/run_workflow.rs b/crates/openhuman-core/src/skills/run_workflow.rs
index 69c63a78c4..c012678493 100644
--- a/crates/openhuman-core/src/skills/run_workflow.rs
+++ b/crates/openhuman-core/src/skills/run_workflow.rs
@@ -403,7 +403,9 @@ impl Tool for RunWorkflowTool {
wait_seconds,
"[run_workflow] spawned; awaiting result inline"
);
+ let workspace = resolve_workspace_dir().await;
let outcome = await_run_outcome(
+ &workspace,
&started.log_path,
std::time::Duration::from_secs(wait_seconds),
)
@@ -509,8 +511,12 @@ impl Tool for AwaitWorkflowTool {
Err(e) => return Ok(ToolResult::error(format!("await_workflow: {e}"))),
};
- let outcome =
- await_run_outcome(&log_path, std::time::Duration::from_secs(wait_seconds)).await;
+ let outcome = await_run_outcome(
+ &workspace,
+ &log_path,
+ std::time::Duration::from_secs(wait_seconds),
+ )
+ .await;
Ok(outcome_to_result(
&run_id,
&visible_run.workflow_id,
diff --git a/crates/openhuman-core/src/skills/runtime/schemas.rs b/crates/openhuman-core/src/skills/runtime/schemas.rs
index 39f40ccdeb..ea7866a13a 100644
--- a/crates/openhuman-core/src/skills/runtime/schemas.rs
+++ b/crates/openhuman-core/src/skills/runtime/schemas.rs
@@ -331,7 +331,7 @@ fn handle_read_run_log(_ctx: DispatchCtx, params: Map<String, Value>) -> Control
})?;
let offset = payload.offset.unwrap_or(0);
let max_bytes = payload.max_bytes.unwrap_or(64 * 1024).min(256 * 1024) as usize;
- let slice = run_log::read_run_log_slice(&path, offset, max_bytes)
+ let slice = run_log::read_run_log_slice(&workspace, &path, offset, max_bytes)
.map_err(|e| format!("skill_runtime_read_run_log: read failed: {e}"))?;
to_json(Outcome::new(slice, Vec::new()))
})
diff --git a/crates/openhuman-core/src/skills/schemas/handlers.rs b/crates/openhuman-core/src/skills/schemas/handlers.rs
index 521238f0a0..c274a3cb17 100644
--- a/crates/openhuman-core/src/skills/schemas/handlers.rs
+++ b/crates/openhuman-core/src/skills/schemas/handlers.rs
@@ -132,7 +132,7 @@ pub(super) fn handle_skills_read_run_log(
// RPC response sane; the FE re-issues with the returned offset
// to page through larger logs.
let max_bytes = payload.max_bytes.unwrap_or(64 * 1024).min(256 * 1024) as usize;
- match run_log::read_run_log_slice(&path, offset, max_bytes) {
+ match run_log::read_run_log_slice(&workspace, &path, offset, max_bytes) {
Ok(slice) => to_json(Outcome::new(slice, Vec::new())),
Err(e) => Err(format!("skills_read_run_log: read failed: {e}")),
}
diff --git a/crates/openhuman-core/src/skills/tools/read.rs b/crates/openhuman-core/src/skills/tools/read.rs
index d838d4458f..0d604e27f1 100644
--- a/crates/openhuman-core/src/skills/tools/read.rs
+++ b/crates/openhuman-core/src/skills/tools/read.rs
@@ -317,7 +317,7 @@ impl Tool for WorkflowReadRunLogTool {
.find(|run| run.run_id == run_id)
.ok_or_else(|| anyhow::anyhow!("read_workflow_run_log: run `{run_id}` not found"))?;
let path = PathBuf::from(run.log_path);
- let slice = read_run_log_slice(&path, offset, max_bytes)
+ let slice = read_run_log_slice(&self.workspace_dir, &path, offset, max_bytes)
.map_err(|e| anyhow::anyhow!("read_workflow_run_log: {e}"))?;
Ok(ToolResult::success(serde_json::to_string(&slice)?))
}