The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
test(session_host): cover resumed threads with retired tools
Steven Enamakel82b08eb809bf
diff --git a/crates/openhuman-core/src/agent/session_host/transcript_compat_tests.rs b/crates/openhuman-core/src/agent/session_host/transcript_compat_tests.rsindex 723a9e9411..1de61efd07 100644--- a/crates/openhuman-core/src/agent/session_host/transcript_compat_tests.rs+++ b/crates/openhuman-core/src/agent/session_host/transcript_compat_tests.rs@@ -594,3 +594,67 @@ fn regenerate_session_compat() {}run_async(capture_all());}++/// Archived declarations survive replay, but retired executors never return.+#[test]+fn resumed_thread_with_retired_podcast_tool_remains_usable() {+ run_async(async {+ const RETIRED: &str = "audio_generate_podcast";+ struct ArchivedAudioTool;+ #[async_trait::async_trait]+ impl tinytools::Tool for ArchivedAudioTool {+ fn name(&self) -> &str { RETIRED }+ fn description(&self) -> &str { "Archived audio generation" }+ fn parameters_schema(&self) -> Value { json!({"type": "object"}) }+ async fn execute(&self, _: Value) -> anyhow::Result<tinytools::ToolResult> {+ Ok(tinytools::ToolResult::success("historical audio artifact"))+ }+ }+ let root = tempfile::tempdir().expect("tempdir");+ let workspace = root.path().join("workspace");+ let first_model = model(vec![+ response(Vec::new(), vec![call("old-call", RETIRED, json!({}))]),+ ModelResponse::assistant("saved audio reply"),+ ], true);+ let chat_model: Arc<dyn ChatModel<()>> = first_model;+ let mut first = crate::agent::SessionHostBuilder::new()+ .chat_model(chat_model)+ .tools(vec![Box::new(ArchivedAudioTool)])+ .workspace_dir(workspace.clone())+ .action_dir(root.path().to_path_buf())+ .tool_dispatcher(Box::new(tinytools_agent::dialect::NativeDialect))+ .build().expect("archive host");+ first.set_thread_id(Some("retired-audio-thread"));+ first.turn("save this old conversation").await.expect("archive turn");+ drop(first);++ let next = model(vec![+ response(Vec::new(), vec![call("retired-call", RETIRED, json!({}))]),+ ModelResponse::assistant("continued without the retired tool"),+ ], true);+ let mut resumed = build_host(root.path(), next.clone(), true, "retired-audio-thread");+ assert!(resumed.resume_bound_session().await.expect("resume archive"));+ let runtime = resumed.runtime_session.as_ref().expect("resumed runtime");+ assert!(runtime.recorded_tools().expect("recorded tools").specs()+ .iter().any(|spec| spec.name == RETIRED));+ resumed.turn("continue this conversation").await.expect("usable resumed turn");+ let requests = serde_json::to_string(&next.requests()).expect("requests");+ assert!(requests.contains("historical audio artifact"), "historical tool results replay");+ assert!(requests.contains("retired-call"), "missing tool call is returned to the model");++ let config = crate::config::Config {+ workspace_dir: workspace,+ action_dir: root.path().to_path_buf(),+ config_path: root.path().join("config.toml"),+ ..Default::default()+ };+ let security = Arc::new(crate::security::SecurityPolicy::default());+ let live = crate::tools::all_tools(+ Arc::new(config.clone()), &security, crate::security::AuditLogger::disabled(),+ &config.browser, &config.http_request, root.path(),+ &std::collections::HashMap::new(), &config,+ );+ assert!(!live.iter().any(|tool| tool.name() == RETIRED),+ "retired tool must not be restored to the live registry");+ });+}