Skip to content

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

refactor(subagent-host): route task id and result checks through shared policy

Steven Enamakel6634d9873299
diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/pause_checkpoint.rs b/crates/openhuman-core/src/agent/subagent_host/ops/pause_checkpoint.rs
index 6a9c93f9b1..9930a834b4 100644
--- a/crates/openhuman-core/src/agent/subagent_host/ops/pause_checkpoint.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/ops/pause_checkpoint.rs
@@ -14,11 +14,7 @@
/// an allow-list cannot be walked around by an encoding this check did not
/// anticipate.
pub(crate) fn is_safe_task_id(task_id: &str) -> bool {
- !task_id.is_empty()
- && task_id.len() <= 128
- && task_id
- .chars()
- .all(|c| c.is_ascii_alphanumeric() || matches!(c, '-' | '_'))
+ tinyagents_orchestration::subagent::is_safe_task_id(task_id)
}
#[cfg(test)]
diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs
index 8a6e9501ab..7989a0dbe1 100644
--- a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs
@@ -374,11 +374,11 @@ pub(crate) async fn run_subagent_direct(
// Use TinyAgents' shared character-safe result cap so subagent output
// follows the same truncation contract as other orchestration paths.
if let Some(cap) = definition.max_result_chars {
- outcome.output = tinyagents_orchestration::subagent::truncate_head_tail(
- &outcome.output,
- cap,
- )
- .0;
+ outcome.output = tinyagents_orchestration::subagent::ResultPolicy::new()
+ .with_max_chars(cap)
+ .apply(&task_id, &outcome.output, None)
+ .await
+ .text;
}
tracing::info!(