Skip to content

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

style: reformat security gate and resume tests

Steven Enamakel2b883bb5b996
diff --git a/crates/openhuman-core/src/agent/session_host/orphaned_head_resume_tests.rs b/crates/openhuman-core/src/agent/session_host/orphaned_head_resume_tests.rs
index a3ac510827..0ca6645259 100644
--- a/crates/openhuman-core/src/agent/session_host/orphaned_head_resume_tests.rs
+++ b/crates/openhuman-core/src/agent/session_host/orphaned_head_resume_tests.rs
@@ -221,9 +221,8 @@ async fn credential_redaction_survives_resume() {
.expect("session build")
};
let secret: String = [
- 's', 'k', '-', 'l', 'i', 'v', 'e', '-', '0', '1', '2', '3', '4', '5', '6', '7',
- '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
- 'o', 'p',
+ 's', 'k', '-', 'l', 'i', 'v', 'e', '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',
]
.into_iter()
.collect();
@@ -235,7 +234,11 @@ async fn credential_redaction_survives_resume() {
assert_eq!(host.turn(&original).await.unwrap(), "first reply");
drop(host);
- let first_request = model.requests().into_iter().next().expect("first model call");
+ let first_request = model
+ .requests()
+ .into_iter()
+ .next()
+ .expect("first model call");
let first_user = first_request
.messages
.iter()
@@ -252,7 +255,10 @@ async fn credential_redaction_survives_resume() {
let mut resumed = new_host();
resumed.set_thread_id(Some("thread-credential-redaction"));
assert!(resumed.resume_bound_session().await.unwrap());
- assert_eq!(resumed.turn("continue safely").await.unwrap(), "second reply");
+ assert_eq!(
+ resumed.turn("continue safely").await.unwrap(),
+ "second reply"
+ );
let requests = model.requests();
let resumed_request = requests.last().expect("resumed model call");
let resumed_users: Vec<String> = resumed_request
@@ -262,5 +268,7 @@ async fn credential_redaction_survives_resume() {
.map(Message::text)
.collect();
assert!(resumed_users.iter().any(|message| message == &redacted));
- assert!(resumed_users.iter().all(|message| !message.contains(&secret)));
+ assert!(resumed_users
+ .iter()
+ .all(|message| !message.contains(&secret)));
}
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/security_gate_impl.rs b/crates/openhuman-core/src/agent/tinyagents/host/security_gate_impl.rs
index c41e355071..c6a63c9530 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/security_gate_impl.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/security_gate_impl.rs
@@ -135,10 +135,7 @@ impl OpenHumanSecurityGate {
}
ContentBlock::Json(value) | ContentBlock::ProviderExtension(value) => {
let rendered = value.to_string();
- match self
- .screen_input(&rendered, ContentOrigin::User)
- .await?
- {
+ match self.screen_input(&rendered, ContentOrigin::User).await? {
ScreenOutcome::Pass => {}
ScreenOutcome::Redacted(redacted) => {
*value = serde_json::from_str(&redacted)
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/security_gate_screen_and_policy_tests.rs b/crates/openhuman-core/src/agent/tinyagents/host/security_gate_screen_and_policy_tests.rs
index 4c0b6f20a1..ba1fd053ce 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/security_gate_screen_and_policy_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/security_gate_screen_and_policy_tests.rs
@@ -192,17 +192,13 @@ async fn allow_and_deny_channel_verdicts_are_unchanged() {
async fn screen_input_redacts_credentials_without_changing_screening_policy() {
let gate = gate(AutonomyLevel::Full);
let secret: String = [
- 's', 'k', '-', 'l', 'i', 'v', 'e', '-', '0', '1', '2', '3', '4', '5', '6', '7',
- '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
- 'o', 'p',
+ 's', 'k', '-', 'l', 'i', 'v', 'e', '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',
]
.into_iter()
.collect();
let text = format!("credential={secret}");
- let outcome = gate
- .screen_input(&text, ContentOrigin::User)
- .await
- .unwrap();
+ let outcome = gate.screen_input(&text, ContentOrigin::User).await.unwrap();
let ScreenOutcome::Redacted(redacted) = outcome else {
panic!("credential input should be redacted, got {outcome:?}");
};