Skip to content

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

fix(openhuman-embed): treat dispatch admission as expected user state

Steven Enamakel215876405ec2
diff --git a/crates/openhuman-embed/src/error.rs b/crates/openhuman-embed/src/error.rs
index fe634a79eb..599c453636 100644
--- a/crates/openhuman-embed/src/error.rs
+++ b/crates/openhuman-embed/src/error.rs
@@ -235,6 +235,7 @@ impl CoreError {
matches!(
self,
CoreError::BudgetExceeded { .. }
+ | CoreError::DispatchAdmission { .. }
| CoreError::Domain {
expected_user_state: true,
..
diff --git a/crates/openhuman-embed/src/turn_tests.rs b/crates/openhuman-embed/src/turn_tests.rs
index 388b85a58d..21f496eb07 100644
--- a/crates/openhuman-embed/src/turn_tests.rs
+++ b/crates/openhuman-embed/src/turn_tests.rs
@@ -89,6 +89,14 @@ fn typed_dispatch_refusal_precedes_structured_error_mapping_and_keeps_usage() {
match mapped {
CoreError::DispatchAdmission { source, usage, .. } => {
+ assert!(
+ CoreError::DispatchAdmission {
+ method: AGENT_CHAT,
+ source,
+ usage: None,
+ }
+ .is_expected_user_state()
+ );
assert_eq!(source, refusal);
let usage = usage.expect("the completed invalid response remains accounted");
assert_eq!(usage.input_tokens, 13);
diff --git a/crates/openhuman-embed/tests/README.md b/crates/openhuman-embed/tests/README.md
index a4bf553800..ecd30f52aa 100644
--- a/crates/openhuman-embed/tests/README.md
+++ b/crates/openhuman-embed/tests/README.md
@@ -45,6 +45,7 @@ record types preserve populated persisted JSON, including metadata and lineage.
| [`tool_required_routing.rs`](tool_required_routing.rs) | Native host tool metadata for GPT, Kimi and MiniMax model IDs; premature JSON refusal; required successful execution before final schema; gateway options survive. |
| [`completion_cancellation.rs`](completion_cancellation.rs) | Cancellation acknowledged after the provider future stops, pre-cancelled calls make no request, and deadlines are typed. |
| [`structured_validation.rs`](structured_validation.rs) | Full schema constraints, invalid/external schema refusal before dispatch, typed failures and bounded repair usage. |
+| [`dispatch_admission_turn.rs`](dispatch_admission_turn.rs) | A host refusal on structured repair stays typed, retains the paid response usage, stops before configured fallback, and emits no phantom physical-dispatch event. |
| [`turn_observers.rs`](turn_observers.rs) | Terminal error privacy, explicit input capture, and exactly one terminal callback on dispatch failure. |
| [`observed_turns.rs`](observed_turns.rs) | Actual model and host-tool observations survive the core runtime task hop; payloads require consent; actual model, finish reason and reasoning usage. |
| [`public_api.rs`](public_api.rs) | Compile-time check that the host-facing types and signatures stay exported. |