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
feat(web_chat): expose system turn runner and poison-check helper
Steven Enamakelc8ff94a0647a
diff --git a/crates/openhuman-core/src/web_chat/mod.rs b/crates/openhuman-core/src/web_chat/mod.rsindex 838c5fe802..ea9f2d1a8a 100644--- a/crates/openhuman-core/src/web_chat/mod.rs+++ b/crates/openhuman-core/src/web_chat/mod.rs@@ -67,7 +67,7 @@ pub use ops::parallel_in_flight_entries_for_test;pub use ops::{cancel_chat, cancel_chat_scoped, cancel_should_target, channel_web_cancel, channel_web_chat,channel_web_queue_clear, channel_web_queue_status, in_flight_entries_for_test,- invalidate_thread_sessions, start_chat,+ invalidate_thread_sessions, run_system_turn_on_thread, start_chat, SYSTEM_CLIENT_ID,};pub use types::ChatRequestMetadata;diff --git a/crates/openhuman-core/src/web_chat/ops.rs b/crates/openhuman-core/src/web_chat/ops.rsindex 9ba894ce0e..70ff1b3cdc 100644--- a/crates/openhuman-core/src/web_chat/ops.rs+++ b/crates/openhuman-core/src/web_chat/ops.rs@@ -8,6 +8,7 @@ mod channel_ops;mod parallel_turn;mod start_chat;mod state;+mod system_turn;#[cfg(any(test, debug_assertions))]mod test_hooks;mod turn_guards;@@ -23,6 +24,7 @@ pub use channel_ops::{};pub use start_chat::start_chat;+pub use system_turn::{run_system_turn_on_thread, SYSTEM_CLIENT_ID};#[cfg(test)]pub use state::drain_queued_turns_for_test;diff --git a/crates/openhuman-core/src/web_chat/ops/system_turn.rs b/crates/openhuman-core/src/web_chat/ops/system_turn.rsindex 8b519f9197..c7d71a8176 100644--- a/crates/openhuman-core/src/web_chat/ops/system_turn.rs+++ b/crates/openhuman-core/src/web_chat/ops/system_turn.rs@@ -20,6 +20,7 @@ use tinyagents_harness::run_queue::RunQueue;use crate::agent::turn_origin::{with_origin, AgentTurnOrigin};use crate::config::rpc as config_rpc;+use super::super::run_task::turn_error_poisons_session;use super::super::session::{checkin_session_agent_if_vacant, checkout_session_agent, CheckedOutSession,};@@ -86,7 +87,7 @@ pub async fn run_system_turn_on_thread(// Same de-poison rule as a user turn: a provider request rejection means// this agent's history replays the rejection forever, so let it drop and// the next turn cold-boots from the durable transcript.- if super::super::run_task::turn_result_poisoned_session(&result) {+ if matches!(&result, Err(err) if turn_error_poisons_session(err)) {log::warn!("[web-channel] dropping session agent after provider_request_rejected on a system \turn thread={} run_id={}",diff --git a/crates/openhuman-core/src/web_chat/run_task.rs b/crates/openhuman-core/src/web_chat/run_task.rsindex d3ea348476..963cf8f160 100644--- a/crates/openhuman-core/src/web_chat/run_task.rs+++ b/crates/openhuman-core/src/web_chat/run_task.rs@@ -305,13 +305,15 @@ pub(crate) async fn run_chat_task(/// its warm session (no needless reseed), exactly like successes and transient/// failures (rate-limit, timeout, 5xx, session-expiry).fn turn_result_poisoned_session(result: &Result<WebChatTaskResult, String>) -> bool {- matches!(- result,- Err(err) if {- let classified = classify_inference_error(err);- classified.error_type == "provider_request_rejected" && classified.retryable- }- )+ matches!(result, Err(err) if turn_error_poisons_session(err))+}++/// The error-string half of [`turn_result_poisoned_session`], shared with the+/// host-authored turn path (`ops/system_turn.rs`) whose result carries no+/// `WebChatTaskResult`.+pub(super) fn turn_error_poisons_session(err: &str) -> bool {+ let classified = classify_inference_error(err);+ classified.error_type == "provider_request_rejected" && classified.retryable}#[cfg(test)]