Skip to content

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

refactor(channels): simplify locator call in durable_channel_history_len

Steven Enamakela93220a89125
diff --git a/crates/openhuman-core/src/channels/routes.rs b/crates/openhuman-core/src/channels/routes.rs
index 7f9bfd14c8..5d50a941cb 100644
--- a/crates/openhuman-core/src/channels/routes.rs
+++ b/crates/openhuman-core/src/channels/routes.rs
@@ -317,11 +317,8 @@ async fn durable_channel_history_len(
let Some(core) = dispatch.resolved() else {
return 0;
};
- let locator = crate::agent::session_store::transcripts_or_files_in(
- &core,
- &agent_id,
- &ctx.workspace_dir,
- );
+ let locator =
+ crate::agent::session_store::transcripts_or_files_in(&core, &agent_id, &ctx.workspace_dir);
let session = tinyagents_session::transcript::SessionRef::scoped(session_key, &agent_id);
let head = locator.head_generation(&session);
let Some(read) = locator.read_session_transcript(&head) 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 eda804b12c..dfd98cc103 100644
--- a/crates/openhuman-core/src/channels/routes_remote_reset_tests.rs
+++ b/crates/openhuman-core/src/channels/routes_remote_reset_tests.rs
@@ -142,6 +142,19 @@ async fn remote_clear_resets_only_the_captured_tenant_session() {
assert_ne!(alice_key, bob_key);
let alice_session = seed_session(&alice_core, workspace, &alice_key);
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,
+ 2,
+ "remote status history comes from the durable session",
+ );
let scope = remote_session_scope();
let reset = crate::channels::host::remote_control::RemoteResetContext {
@@ -194,6 +207,18 @@ async fn remote_clear_resets_only_the_captured_tenant_session() {
.expect("captured tenant reset succeeds");
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,
+ 0,
+ "a reset clears the durable status count",
+ );
assert_eq!(
session_messages(&bob_core, workspace, &bob_session),
["prior tenant turn", "prior tenant reply"]