Skip to content

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

refactor(channels): simplify durable_channel_history_len signature

Steven Enamakel5de56f6b596c
diff --git a/crates/openhuman-core/src/channels/routes.rs b/crates/openhuman-core/src/channels/routes.rs
index 5d50a941cb..7b1c973f20 100644
--- a/crates/openhuman-core/src/channels/routes.rs
+++ b/crates/openhuman-core/src/channels/routes.rs
@@ -169,14 +169,9 @@ where
return false;
}
let current = get_route_selection(ctx, sender_key);
- let history_len = durable_channel_history_len(
- ctx,
- &current,
- &msg.channel,
- sender_key,
- durable_session_key.as_deref(),
- )
- .await;
+ let history_len =
+ durable_channel_history_len(ctx, &current, &msg.channel, durable_session_key.as_deref())
+ .await;
let client = super::context::module_client(ctx).await;
let operation = async {
let lease = crate::modules::channel_runtime::ChannelRuntimeLease::open(
@@ -291,7 +286,6 @@ async fn durable_channel_history_len(
ctx: &ChannelRuntimeContext,
route: &ChannelRouteSelection,
channel: &str,
- history_key: &str,
session_key: Option<&str>,
) -> usize {
let Some(session_key) = session_key else {
diff --git a/crates/openhuman-core/src/channels/routes_remote_reset_tests.rs b/crates/openhuman-core/src/channels/routes_remote_reset_tests.rs
index dfd98cc103..3d44ec9f66 100644
--- a/crates/openhuman-core/src/channels/routes_remote_reset_tests.rs
+++ b/crates/openhuman-core/src/channels/routes_remote_reset_tests.rs
@@ -144,14 +144,8 @@ async fn remote_clear_resets_only_the_captured_tenant_session() {
let bob_session = seed_session(&bob_core, workspace, &bob_key);
let route = crate::channels::routes::get_route_selection(&alice_runtime, "remote-reset");
assert_eq!(
- super::durable_channel_history_len(
- &alice_runtime,
- &route,
- "telegram",
- "legacy-key-is-not-authority",
- Some(&alice_key),
- )
- .await,
+ super::durable_channel_history_len(&alice_runtime, &route, "telegram", Some(&alice_key),)
+ .await,
2,
"remote status history comes from the durable session",
);
@@ -159,7 +153,7 @@ async fn remote_clear_resets_only_the_captured_tenant_session() {
let scope = remote_session_scope();
let reset = crate::channels::host::remote_control::RemoteResetContext {
scope: scope.clone(),
- durable_session_key: alice_key,
+ durable_session_key: alice_key.clone(),
message: tinychannels_bus::ChannelMessage {
channel: "telegram".into(),
reply_target: "room-1".into(),
@@ -208,14 +202,8 @@ async fn remote_clear_resets_only_the_captured_tenant_session() {
assert!(matches!(cleared, RemoteHostResult::Completed));
assert!(session_messages(&alice_core, workspace, &alice_session).is_empty());
assert_eq!(
- super::durable_channel_history_len(
- &alice_runtime,
- &route,
- "telegram",
- "legacy-key-is-not-authority",
- Some(&alice_key),
- )
- .await,
+ super::durable_channel_history_len(&alice_runtime, &route, "telegram", Some(&alice_key),)
+ .await,
0,
"a reset clears the durable status count",
);