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(inference): drain every event before checking a BYO 401's expiry
M3gA-Mind29ad221e8692
diff --git a/crates/openhuman-core/src/inference/provider/http_error_tests.rs b/crates/openhuman-core/src/inference/provider/http_error_tests.rsindex 7e2b83d918..d787258983 100644--- a/crates/openhuman-core/src/inference/provider/http_error_tests.rs+++ b/crates/openhuman-core/src/inference/provider/http_error_tests.rs@@ -126,19 +126,24 @@ async fn byo_401_publishes_api_key_rejected_not_session_expired() {).await;// The bus is process-wide: only a SessionExpired raised by this call (its- // body is in the reason) counts, not one from a concurrent test.- let mut session_expired = false;- let rejected = drain_until(&mut rx, |e| match e {- DomainEvent::SessionExpired { reason, .. }- if reason.contains("Invalid or missing API key") || reason.contains(provider) =>- {- session_expired = true;- None+ // body is in the reason) counts, not one from a concurrent test. Drain+ // every queued event so an expiry published after the rejection is seen.+ let (mut session_expired, mut rejected) = (false, false);+ drain_until(&mut rx, |e| -> Option<()> {+ match e {+ DomainEvent::SessionExpired { reason, .. }+ if reason.contains("Invalid or missing API key") || reason.contains(provider) =>+ {+ session_expired = true+ }+ DomainEvent::ProviderApiKeyRejected { provider: p, .. } if p == provider => {+ rejected = true+ }+ _ => {}}- DomainEvent::ProviderApiKeyRejected { provider: p, .. } if p == provider => Some(()),- _ => None,+ None});- assert!(rejected.is_some(), "BYO key rejection must be surfaced");+ assert!(rejected, "BYO key rejection must be surfaced");assert!(!session_expired,"a BYO key's 401 must not expire the OpenHuman session"