Skip to content

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

test: cover wrap-up budget, oauth state, triage json, and mnemonic word count

Steven Enamakeldf5681a88461
diff --git a/crates/openhuman-core/src/agent/tinyagents/verify_before_finish_tests.rs b/crates/openhuman-core/src/agent/tinyagents/verify_before_finish_tests.rs
index 2bc5dcda6d..78bb1dc9ca 100644
--- a/crates/openhuman-core/src/agent/tinyagents/verify_before_finish_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/verify_before_finish_tests.rs
@@ -268,6 +268,22 @@ async fn subagent_turn_is_not_checked() {
const BUDGET_ROUNDS: usize = 7;
const BUDGET_CALLS: usize = 12;
+#[tokio::test]
+async fn a_linked_wrap_up_budget_notice_silences_the_check() {
+ let rounds = BUDGET_ROUNDS;
+ let (checks, text) = drive_with(
+ rounds,
+ "lookup",
+ false,
+ Some("orchestrator"),
+ WrapUp::Linked,
+ BUDGET_CALLS,
+ )
+ .await;
+ assert_eq!(checks, 0, "a budget notice said finish; no re-verify turn");
+ assert_eq!(text, "draft");
+}
+
#[tokio::test]
async fn an_unlinked_wrap_up_does_not_silence_the_check() {
let (checks, _) = drive_with(
diff --git a/crates/openhuman-core/src/security/credentials/openai_oauth/flow_tests_lifecycle_tests.rs b/crates/openhuman-core/src/security/credentials/openai_oauth/flow_tests_lifecycle_tests.rs
index c1d7e7a64b..678f9b2a0d 100644
--- a/crates/openhuman-core/src/security/credentials/openai_oauth/flow_tests_lifecycle_tests.rs
+++ b/crates/openhuman-core/src/security/credentials/openai_oauth/flow_tests_lifecycle_tests.rs
@@ -58,6 +58,10 @@ fn parse_callback_input_accepts_raw_query_string() {
fn parse_callback_input_rejects_blank_invalid_and_missing_state() {
let blank = parse_callback_input(" ").unwrap_err();
assert!(blank.contains("required"));
+
+ let missing_state =
+ parse_callback_input("http://127.0.0.1:1455/auth/callback?code=abc").unwrap_err();
+ assert!(missing_state.contains("state"));
}
#[test]
diff --git a/crates/openhuman-core/src/triage/decision_tests.rs b/crates/openhuman-core/src/triage/decision_tests.rs
index 24f0f16291..e1964afe63 100644
--- a/crates/openhuman-core/src/triage/decision_tests.rs
+++ b/crates/openhuman-core/src/triage/decision_tests.rs
@@ -17,6 +17,13 @@ fn rejects_react_without_prompt() {
assert!(matches!(err, ParseError::MissingTarget { action: "react" }));
}
+#[test]
+fn rejects_non_parseable_json() {
+ let reply = "{\"action\": not_a_string}";
+ let err = parse_triage_decision(reply).unwrap_err();
+ assert!(matches!(err, ParseError::InvalidJson(_)));
+}
+
#[test]
fn owner_relaxed_json_recovery_preserves_action_normalization() {
let reply = "{action: \"DROP\", reason: \"recovered\",}";
diff --git a/crates/openhuman-core/src/web3/wallet/ops_tests.rs b/crates/openhuman-core/src/web3/wallet/ops_tests.rs
index ab96fbdf76..78ea6219ed 100644
--- a/crates/openhuman-core/src/web3/wallet/ops_tests.rs
+++ b/crates/openhuman-core/src/web3/wallet/ops_tests.rs
@@ -46,6 +46,15 @@ fn validate_setup_rejects_duplicate_chain() {
.contains("exactly one 'evm'"));
}
+#[test]
+fn validate_setup_rejects_invalid_word_count() {
+ let mut params = sample_params();
+ params.mnemonic_word_count = 13;
+ assert!(validate_setup(&params)
+ .expect_err("invalid word count should fail")
+ .contains("unsupported mnemonic word count"));
+}
+
#[tokio::test]
async fn generate_recovery_phrase_rejects_unsupported_word_count_before_the_module() {
let error = generate_recovery_phrase(&DispatchCtx::process_default(), 13)