Skip to content

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

test(web3): assert prepared quotes survive rejected callers

Steven Enamakeldf55e2566467
diff --git a/crates/openhuman-core/src/web3/seams_tests.rs b/crates/openhuman-core/src/web3/seams_tests.rs
index 9776f46392..a20c9434fe 100644
--- a/crates/openhuman-core/src/web3/seams_tests.rs
+++ b/crates/openhuman-core/src/web3/seams_tests.rs
@@ -2,8 +2,7 @@ use super::*;
use crate::security::approval::ApprovalChatContext;
use crate::web3::wallet::test_support::{setup_wallet_in, UnreachableRpcGuard, TEST_LOCK};
use crate::web3::wallet::{
- execute_prepared, prepare_transfer, prepared_quotes_for_test, ExecutePreparedParams,
- PrepareTransferParams,
+ execute_prepared, prepare_transfer, ExecutePreparedParams, PrepareTransferParams,
};
use tempfile::TempDir;
@@ -181,6 +180,7 @@ async fn a_prepared_quote_is_bound_to_the_chat_thread_that_prepared_it() {
let _guard = TEST_LOCK.lock().await;
let temp = TempDir::new().unwrap();
let _workspace_guard = setup_wallet_in(&temp).await.unwrap();
+ let _endpoints = UnreachableRpcGuard::set();
let prepared = APPROVAL_CHAT_CONTEXT
.scope(
@@ -216,10 +216,6 @@ async fn a_prepared_quote_is_bound_to_the_chat_thread_that_prepared_it() {
// So does a caller with no chat context at all.
let from_background = execute_prepared(execute(true)).await.unwrap_err();
assert_eq!(from_background, not_found);
- // Neither attempt consumed it.
- assert!(prepared_quotes_for_test()
- .iter()
- .any(|q| q.quote_id == quote_id));
// And confirmation is still required before anything is attempted.
let unconfirmed = APPROVAL_CHAT_CONTEXT
.scope(chat_ctx("A"), execute_prepared(execute(false)))
@@ -229,4 +225,15 @@ async fn a_prepared_quote_is_bound_to_the_chat_thread_that_prepared_it() {
unconfirmed.contains("confirmed: true"),
"got: {unconfirmed}"
);
+ // The module owns the quote store. A confirmed attempt by its owner must
+ // still reach the provider after both rejected callers, and a failed
+ // provider call must leave the quote available for another attempt.
+ for _ in 0..2 {
+ let unavailable = APPROVAL_CHAT_CONTEXT
+ .scope(chat_ctx("A"), execute_prepared(execute(true)))
+ .await
+ .unwrap_err();
+ assert!(unavailable.contains("127.0.0.1"), "got: {unavailable}");
+ assert!(!unavailable.contains("not found"), "got: {unavailable}");
+ }
}