Skip to content

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

fix(runtime_session): handle missing session state on resume

Steven Enamakeld825c41f6549
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session.rs b/crates/openhuman-core/src/agent/session_host/runtime_session.rs
index 9e5af0fc0c..e095d4865e 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session.rs
@@ -658,13 +658,34 @@ impl OpenHumanTurnPrelude {
run_context.stop_hooks.push(Arc::new(hook));
}
}
+ // Build the roster from this turn's *effective* visible tool set
+ // (snapshotted under the tool-surface lock, then released) rather
+ // than the parent definition's static scope alone: a hide or named
+ // restriction can narrow what this turn can actually call below the
+ // definition's baseline, and the roster must not advertise a fleet
+ // control the turn cannot invoke.
+ let turn_fleet = {
+ let visible = self
+ .tool_surface
+ .lock()
+ .unwrap_or_else(std::sync::PoisonError::into_inner)
+ .visible_tool_names
+ .clone();
+ if visible.is_empty() {
+ crate::agent::orchestration::fleet_tools::FleetToolSet::for_parent(
+ &self.agent_definition_id,
+ )
+ } else {
+ crate::agent::orchestration::fleet_tools::FleetToolSet::from_visible_tool_names(
+ &visible,
+ )
+ }
+ };
if let Some(block) =
crate::agent::orchestration::running_subagents::active_subagents_context_block(
&self.event_session_id,
&self.workspace_dir,
- &crate::agent::orchestration::fleet_tools::FleetToolSet::for_parent(
- &self.agent_definition_id,
- ),
+ &turn_fleet,
)
{
context.push_str(&block);