Skip to content

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

refactor(spawn-subagent): avoid leaking resolved model string

Steven Enamakel9596c3fa155c
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_host_impl.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_host_impl.rs
index 4e8437b181..1c5c9d5534 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_host_impl.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_host_impl.rs
@@ -93,12 +93,8 @@ impl SpawnSubagentTool {
let workspace_descriptor = tool_context
.and_then(|ctx| ctx.workspace().cloned())
.or_else(|| run_context.workspace.clone());
- let target_model = model_override.as_deref().unwrap_or_else(|| {
- definition
- .model
- .resolve(parent.model_name.as_str())
- .leak()
- });
+ let resolved_model = definition.model.resolve(parent.model_name.as_str());
+ let target_model = model_override.as_deref().unwrap_or(&resolved_model);
if crate::attachments::should_forward_parent_images(&prompt)
&& !run_context.attachment_placeholders.is_empty()
&& (definition.id == "vision_agent"