Skip to content

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

test(web-chat): keep one host smoke check for a key echoed in provider detail

M3gA-Mindb1a82e2571a7
diff --git a/crates/openhuman-core/src/web_chat/web_tests_error_copy_fixture_tests.rs b/crates/openhuman-core/src/web_chat/web_tests_error_copy_fixture_tests.rs
index a16d0b58e4..7b83086110 100644
--- a/crates/openhuman-core/src/web_chat/web_tests_error_copy_fixture_tests.rs
+++ b/crates/openhuman-core/src/web_chat/web_tests_error_copy_fixture_tests.rs
@@ -505,29 +505,27 @@ fn chat_error_event_serializes_copy_key_and_params_to_literal_json() {
#[test]
fn a_key_echoed_in_provider_detail_never_reaches_the_copy() {
- // A rejected request's provider detail is quoted into the user-facing
- // message and sent as a copy param; a provider may echo the key in it.
- for key in [
- "sk-proj-AbCdEf0123456789AbCdEf0123456789",
- "sk-ant-api03-AbCdEf0123456789AbCdEf0123456789",
- ] {
- let got = classify_inference_error(&format!(
- r#"someprovider API error (422 Unprocessable Entity): {{"error":{{"message":"bad parameter for key {key}"}}}}"#
- ));
- assert!(
- got.message.contains("bad parameter"),
- "the provider detail must still be quoted: {}",
- got.message
- );
- assert!(
- !got.message.contains("AbCdEf0123456789"),
- "key leaked into the message: {}",
- got.message
- );
- let params = got.copy_params.map(|p| p.to_string()).unwrap_or_default();
- assert!(
- !params.contains("AbCdEf0123456789"),
- "key leaked into the copy params: {params}"
- );
- }
+ // Host smoke test: a rejected request's provider detail is quoted into the
+ // user-facing message and sent as a copy param, and both must carry the
+ // sanitized detail. Key-shape coverage lives with the sanitizer in
+ // TinyInference. The key is synthetic, built at runtime.
+ let key = format!("sk-proj-{}", "AbCdEf0123456789".repeat(2));
+ let got = classify_inference_error(&format!(
+ r#"someprovider API error (422 Unprocessable Entity): {{"error":{{"message":"bad parameter for key {key}"}}}}"#
+ ));
+ assert!(
+ got.message.contains("bad parameter"),
+ "the provider detail must still be quoted: {}",
+ got.message
+ );
+ assert!(
+ !got.message.contains("AbCdEf0123456789"),
+ "key leaked into the message: {}",
+ got.message
+ );
+ let params = got.copy_params.map(|p| p.to_string()).unwrap_or_default();
+ assert!(
+ !params.contains("AbCdEf0123456789"),
+ "key leaked into the copy params: {params}"
+ );
}