Skip to content

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

refactor(cost): move scope tests into a dedicated module

Steven Enamakel6833c1b1e31c
diff --git a/crates/openhuman-core/src/platform/cost/scope_tests.rs b/crates/openhuman-core/src/platform/cost/scope_tests.rs
index 5751972c45..f25854e351 100644
--- a/crates/openhuman-core/src/platform/cost/scope_tests.rs
+++ b/crates/openhuman-core/src/platform/cost/scope_tests.rs
@@ -20,8 +20,21 @@ fn each_origin_maps_to_its_thread_and_label() {
message_id: "m".into(),
};
assert_eq!(
- describe_origin(Some(&channel)).1.as_deref(),
- Some("channel:telegram")
+ describe_origin(Some(&channel)),
+ (None, Some("channel:telegram".into()))
+ );
+ // A channel conversation's history key is its thread.
+ let conversation = AgentTurnOrigin::ExternalChannel {
+ channel: "telegram".into(),
+ sender: None,
+ sender_name: None,
+ history_key: Some("telegram:42".into()),
+ reply_target: "r".into(),
+ message_id: "m".into(),
+ };
+ assert_eq!(
+ describe_origin(Some(&conversation)).0.as_deref(),
+ Some("telegram:42")
);
let cron = AgentTurnOrigin::TrustedAutomation {
job_id: "j".into(),