Skip to content

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

refactor: remove dead code from fork_context, worktree, and python process

Steven Enamakel19f61290dbfe
diff --git a/crates/openhuman-core/src/agent/harness/fork_context.rs b/crates/openhuman-core/src/agent/harness/fork_context.rs
index f38e00ae66..897c991510 100644
--- a/crates/openhuman-core/src/agent/harness/fork_context.rs
+++ b/crates/openhuman-core/src/agent/harness/fork_context.rs
@@ -174,11 +174,6 @@ tokio::task_local! {
/// direct tool calls); `spawn_subagent` rejects in that case.
pub static PARENT_CONTEXT: ParentExecutionContext;
- /// Context-preparation sources that already ran for this parent turn,
- /// so downstream code can tell the harness has already prepared context
- /// and avoid gathering it a second time.
- ///
- pub static AGENT_CONTEXT_PREPARED_SOURCES: Arc<Vec<AgentContextPreparedSource>>;
}
/// Returns a clone of the current parent execution context, if one is set.
diff --git a/crates/openhuman-core/src/agent/orchestration/worktree.rs b/crates/openhuman-core/src/agent/orchestration/worktree.rs
index 48d677740d..4102dfbc32 100644
--- a/crates/openhuman-core/src/agent/orchestration/worktree.rs
+++ b/crates/openhuman-core/src/agent/orchestration/worktree.rs
@@ -178,17 +178,6 @@ impl WorkspaceIsolation for OpenHumanWorktreeIsolation {
}
}
-/// Rejection from [`enforce_workspace_path`].
-///
-/// Separate from `GitWorktreeError` (which is TinyAgents' git-plumbing error)
-/// because this gate is about OpenHuman's descriptor policy, not about git.
-#[derive(Debug, thiserror::Error)]
-pub enum WorkspacePathError {
- /// The path escaped every root the descriptor allows.
- #[error("path is outside the allowed workspace roots: {0}")]
- OutsideWorkspace(PathBuf),
-}
-
#[cfg(test)]
#[path = "worktree_tests.rs"]
mod tests;
diff --git a/crates/openhuman-core/src/runtime/python/process.rs b/crates/openhuman-core/src/runtime/python/process.rs
index 69e1c3e5ba..f7c2a47a5a 100644
--- a/crates/openhuman-core/src/runtime/python/process.rs
+++ b/crates/openhuman-core/src/runtime/python/process.rs
@@ -37,50 +37,6 @@ impl PythonLaunchSpec {
}
}
-pub fn spawn_stdio_process(
- resolved: &ResolvedPython,
- spec: &PythonLaunchSpec,
-) -> Result<tokio::process::Child> {
- let mut cmd = tokio::process::Command::new(&resolved.python_bin);
- if spec.unbuffered {
- cmd.arg("-u");
- }
- cmd.arg(&spec.script_path);
- cmd.args(&spec.args);
- if let Some(cwd) = spec.cwd.as_ref() {
- cmd.current_dir(cwd);
- }
- for (key, value) in &spec.env {
- cmd.env(key, value);
- }
- cmd.stdin(Stdio::piped())
- .stdout(Stdio::piped())
- .stderr(Stdio::piped())
- .kill_on_drop(true);
- // Suppress the Windows conhost flash. This process is (re)spawned on every
- // launch to run the runtime python server, so without CREATE_NO_WINDOW a
- // CMD window blinks up each time the app starts (GH-4814).
- tinyinference_local::process::apply_no_window(&mut cmd);
-
- let child = cmd.spawn().with_context(|| {
- format!(
- "failed to spawn python process `{}` for script {}",
- resolved.python_bin.display(),
- spec.script_path.display()
- )
- })?;
-
- tracing::info!(
- python_bin = %resolved.python_bin.display(),
- script = %spec.script_path.display(),
- arg_count = spec.args.len(),
- cwd = spec.cwd.as_ref().map(|p| p.display().to_string()),
- "[runtime_python::process] spawned stdio python child"
- );
-
- Ok(child)
-}
-
#[cfg(test)]
#[path = "process_tests.rs"]
mod tests;
diff --git a/crates/openhuman-core/src/runtime/python/process_tests.rs b/crates/openhuman-core/src/runtime/python/process_tests.rs
index 1e3749b5fc..00d340a7f4 100644
--- a/crates/openhuman-core/src/runtime/python/process_tests.rs
+++ b/crates/openhuman-core/src/runtime/python/process_tests.rs
@@ -4,23 +4,3 @@ use crate::runtime::python::bootstrap::PythonSource;
// `apply_no_window` is a no-op off Windows, but exercising the spawn path
// end-to-end keeps the GH-4814 CREATE_NO_WINDOW hook covered. `/bin/cat
// <file>` prints the file and exits, so it stands in for the python child.
-#[cfg(unix)]
-#[tokio::test]
-async fn spawn_stdio_process_launches_child() {
- let dir = tempfile::tempdir().expect("tempdir");
- let script = dir.path().join("payload.txt");
- std::fs::write(&script, b"ok").expect("write payload");
-
- let resolved = ResolvedPython {
- bin_dir: PathBuf::from("/bin"),
- python_bin: PathBuf::from("/bin/cat"),
- version: "test".to_string(),
- source: PythonSource::System,
- };
- let mut spec = PythonLaunchSpec::new(script);
- spec.unbuffered = false; // `-u` is python-only; plain `cat <file>` here
-
- let mut child = spawn_stdio_process(&resolved, &spec).expect("spawn cat");
- let status = child.wait().await.expect("wait cat");
- assert!(status.success());
-}