Skip to content

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

chore: apply rustfmt formatting to compact thread code

Steven Enamakelb38c9962bfec
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session/compact.rs b/crates/openhuman-core/src/agent/session_host/runtime_session/compact.rs
index 7aadef8630..0dc142e44d 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session/compact.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session/compact.rs
@@ -69,12 +69,17 @@ impl OpenHumanSessionHost {
/// When the session is bound to no thread (or is a sub-agent's), when its
/// stores cannot be admitted or read, when the summarizer models cannot be
/// built, or when the new generation cannot be written.
- pub async fn compact_bound_history(&mut self, options: CompactOptions) -> Result<CompactOutcome> {
+ pub async fn compact_bound_history(
+ &mut self,
+ options: CompactOptions,
+ ) -> Result<CompactOutcome> {
let Some(thread_id) = self.thread_id.clone() else {
return Err(anyhow!("compact_thread needs a session bound to a thread"));
};
if self.session_parent_prefix.is_some() {
- return Err(anyhow!("compact_thread does not compact a sub-agent session"));
+ return Err(anyhow!(
+ "compact_thread does not compact a sub-agent session"
+ ));
}
// The turn's own identity: the runtime resolves the same request with
// the same resolver before every turn (`identity_resolver` in ensure).
@@ -107,7 +112,10 @@ impl OpenHumanSessionHost {
let history = codec
.decode_history(&transcript)
.map_err(|error| anyhow!(error.to_string()))?;
- if history.iter().all(|message| matches!(message, Message::System(_))) {
+ if history
+ .iter()
+ .all(|message| matches!(message, Message::System(_)))
+ {
tracing::info!(thread_id = %thread_id, outcome = "empty", "[compact_thread] no conversation");
return Ok(CompactOutcome::Empty);
}
diff --git a/crates/openhuman-embed/src/lib.rs b/crates/openhuman-embed/src/lib.rs
index 973141cf12..57de90b94b 100644
--- a/crates/openhuman-embed/src/lib.rs
+++ b/crates/openhuman-embed/src/lib.rs
@@ -176,8 +176,8 @@ pub use openhuman_core::voice::VOICE_COMPILED_IN;
pub use agent::ToolAttachmentError;
pub use agent::{
Agent, AgentDefinitionSpec, AgentError, AgentLayout, AgentSpec, ApprovalDecision, Approvals,
- ApprovalsError, CompactOptions, CompactOutcome, DefinitionBase, MemoryBinding, MemoryBlockSpec, PendingApproval,
- SandboxModeSpec, ToolScopeSpec,
+ ApprovalsError, CompactOptions, CompactOutcome, DefinitionBase, MemoryBinding, MemoryBlockSpec,
+ PendingApproval, SandboxModeSpec, ToolScopeSpec,
};
pub use auth::{Auth, AuthState, Session};
#[cfg(feature = "channels")]
diff --git a/crates/openhuman-embed/tests/compact_thread.rs b/crates/openhuman-embed/tests/compact_thread.rs
index e04670128b..658c097629 100644
--- a/crates/openhuman-embed/tests/compact_thread.rs
+++ b/crates/openhuman-embed/tests/compact_thread.rs
@@ -264,7 +264,10 @@ fn compact_thread_seals_the_head_and_the_next_turn_resends_the_summary() {
.collect()
};
let prompt = system_prompt(&after_messages);
- assert!(!prompt.is_empty(), "the request opens with the system prompt");
+ assert!(
+ !prompt.is_empty(),
+ "the request opens with the system prompt"
+ );
assert_eq!(
prompt,
system_prompt(&before_messages),
@@ -276,7 +279,10 @@ fn compact_thread_seals_the_head_and_the_next_turn_resends_the_summary() {
"the tool declarations are byte-identical"
);
let summary = &after_messages[prompt.len()];
- assert_eq!(summary["role"], "user", "the summary follows the system prompt");
+ assert_eq!(
+ summary["role"], "user",
+ "the summary follows the system prompt"
+ );
assert!(text(summary).contains("SUMMARY-MARKER"));
assert!(
after.body.to_string().len() < before.body.to_string().len(),