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
refactor(subagent_host): extract incomplete run status helper
Steven Enamakela8fabd19ac99
diff --git a/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs b/crates/openhuman-core/src/agent/subagent_host/lifecycle.rsindex 93c0047aa8..461053aaf2 100644--- a/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs+++ b/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs@@ -996,13 +996,9 @@ fn outcome_to_host(options: None,checkpoint: None,},- SubagentOutcomeKind::Incomplete(incomplete) => SubagentRunStatus::Incomplete {- failure_cause: outcome- .extensions- .get(outcome::CLASSIFIED_STOP_CAUSE_EXTENSION)- .and_then(|value| outcome::decode_classified_stop_cause(value, &incomplete.reason)),- reason: incomplete.reason,- },+ SubagentOutcomeKind::Incomplete(incomplete) => {+ outcome::incomplete_run_status(incomplete.reason, &outcome.extensions)+ }SubagentOutcomeKind::Cancelled => SubagentRunStatus::Cancelled,};host.status = status;diff --git a/crates/openhuman-core/src/agent/subagent_host/lifecycle_outcome.rs b/crates/openhuman-core/src/agent/subagent_host/lifecycle_outcome.rsindex 3fb47e1757..83820ecf5a 100644--- a/crates/openhuman-core/src/agent/subagent_host/lifecycle_outcome.rs+++ b/crates/openhuman-core/src/agent/subagent_host/lifecycle_outcome.rs@@ -28,6 +28,32 @@ pub(super) fn decode_classified_stop_cause(})}+pub(super) fn incomplete_run_status(+ reason: String,+ extensions: &std::collections::BTreeMap<String, serde_json::Value>,+) -> SubagentRunStatus {+ let failure_cause = extensions+ .get(CLASSIFIED_STOP_CAUSE_EXTENSION)+ .and_then(|value| decode_classified_stop_cause(value, &reason));+ SubagentRunStatus::Incomplete {+ reason,+ failure_cause,+ }+}++pub(super) fn incomplete_run_status(+ reason: String,+ extensions: &std::collections::BTreeMap<String, serde_json::Value>,+) -> SubagentRunStatus {+ let failure_cause = extensions+ .get(CLASSIFIED_STOP_CAUSE_EXTENSION)+ .and_then(|value| decode_classified_stop_cause(value, &reason));+ SubagentRunStatus::Incomplete {+ reason,+ failure_cause,+ }+}+pub(super) fn host_outcome_to_neutral(outcome: SubagentRunOutcome,definition: &crate::agent::harness::host_definition::AgentDefinition,diff --git a/crates/openhuman-core/src/agent/subagent_host/lifecycle_outcome_tests.rs b/crates/openhuman-core/src/agent/subagent_host/lifecycle_outcome_tests.rsindex e6ed7ed7ba..180ab21e68 100644--- a/crates/openhuman-core/src/agent/subagent_host/lifecycle_outcome_tests.rs+++ b/crates/openhuman-core/src/agent/subagent_host/lifecycle_outcome_tests.rs@@ -29,3 +29,84 @@ fn classified_stop_extension_round_trips_without_the_private_summary() {assert_eq!(restored.operation, "web_answer_tool");assert_eq!(restored.summary, "persisted reason");}++#[test]+fn host_incomplete_status_round_trips_through_neutral_persistence() {+ let cause = tinyagents_harness::no_progress::ClassifiedStopCause {+ class: "uncertain_side_effect".into(),+ operation: "web_answer_tool".into(),+ summary: "private URL https://example.com/private?q=secret".into(),+ };+ let host = SubagentRunOutcome {+ task_id: "task".into(),+ agent_id: "researcher".into(),+ output: "partial".into(),+ iterations: 2,+ elapsed: std::time::Duration::from_millis(10),+ mode: SubagentMode::Typed,+ status: SubagentRunStatus::Incomplete {+ reason: cause.summary.clone(),+ failure_cause: Some(cause),+ },+ final_history: Vec::new(),+ usage: SubagentUsage::default(),+ artifact_paths: Vec::new(),+ persistence_disposition:+ tinyagents_orchestration::subagent::SubagentPersistenceDisposition::TerminalInserted,+ };+ let definition = crate::agent::harness::host_definition::AgentDefinition {+ id: "researcher".into(),+ when_to_use: "research".into(),+ display_name: None,+ system_prompt: tinyagents_definition::PromptSource::Inline("prompt".into()),+ model: tinyagents_definition::ModelSpec::Inherit,+ temperature: 0.0,+ tools: tinyagents_definition::ToolScope::Named(Vec::new()),+ disallowed_tools: Vec::new(),+ skill_filter: None,+ extra_tools: Vec::new(),+ deferred_tools: Vec::new(),+ tool_rules: None,+ max_iterations: 2,+ iteration_policy: Default::default(),+ max_result_chars: None,+ max_turn_output_tokens: None,+ timeout_secs: None,+ sandbox_mode: tinyagents_definition::SandboxMode::None,+ background: false,+ subagents: Vec::new(),+ delegate_name: None,+ agent_tier: tinyagents_definition::AgentTier::Worker,+ source: tinyagents_definition::DefinitionSource::Builtin,+ extensions: crate::agent::harness::host_definition::AgentExt {+ omit_identity: true,+ omit_memory_context: true,+ omit_safety_preamble: true,+ tokenjuice_compression: tinyjuice_bus::types::AgentTokenjuiceCompression::Auto,+ searches_connected_mcp: false,+ ..Default::default()+ },+ role: None,+ };+ let neutral = host_outcome_to_neutral(host, &definition, &SubagentRunOptions::default());+ let serialized = serde_json::to_string(&neutral).expect("neutral outcome serializes");+ assert!(!serialized.contains("example.com"));+ let reloaded: SubagentOutcome =+ serde_json::from_str(&serialized).expect("neutral outcome reloads");+ let SubagentOutcomeKind::Incomplete(incomplete) = reloaded.status else {+ panic!("incomplete status survives neutral persistence");+ };+ let restored = incomplete_run_status(incomplete.reason, &reloaded.extensions);+ let SubagentRunStatus::Incomplete {+ reason,+ failure_cause: Some(cause),+ } = restored+ else {+ panic!("typed stop cause survives neutral persistence");+ };++ assert_eq!(reason, "private URL https://example.com/private?q=secret");+ assert_eq!(cause.class, "uncertain_side_effect");+ assert_eq!(cause.operation, "web_answer_tool");+ assert_eq!(cause.summary, reason);+}