The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(channels): let integration tests build DispatchHarnessOptions again, without widening a production type
M3gA-Mind333782581086
diff --git a/src/openhuman/channels/runtime/test_support.rs b/src/openhuman/channels/runtime/test_support.rsindex e157748ed3..7a49fad283 100644--- a/src/openhuman/channels/runtime/test_support.rs+++ b/src/openhuman/channels/runtime/test_support.rs@@ -44,11 +44,60 @@ pub struct DispatchHarnessOptions {pub seed_history_len: usize,pub memory_entries: Vec<TestMemoryEntry>,/// Workspace the runtime context reports; `None` falls back to the OS temp dir.- pub(crate) workspace_dir: Option<PathBuf>,- /// The prompt every dispatch is seeded with; `None` pins a fixed literal.+ ///+ /// `pub`, like every other field here, and it has to be: integration tests+ /// under `tests/` are a separate crate, and a struct-update expression+ /// (`..DispatchHarnessOptions::default()`) requires **every** field to be+ /// visible — including the ones the caller never names. Added as+ /// `pub(crate)` in `a45b1c1af`, which broke three of them with E0451.+ pub workspace_dir: Option<PathBuf>,+ /// The prompt every dispatch is seeded with; the default pins a fixed literal./// Pass one `ChannelSystemPrompt::refreshing` clone to several dispatches/// to observe a re-render across them.- pub(crate) system_prompt: Option<ChannelSystemPrompt>,+ ///+ /// Wrapped in [`HarnessSystemPrompt`] rather than exposing+ /// `Option<ChannelSystemPrompt>` — see that type for why.+ pub system_prompt: HarnessSystemPrompt,+}++/// Opaque carrier for the harness's system prompt.+///+/// [`DispatchHarnessOptions`] is `pub` and integration tests build it with+/// `..DispatchHarnessOptions::default()`, so every field must be visible from+/// another crate. The prompt itself must **not** become visible with it:+/// `ChannelSystemPrompt` is `pub(crate)`, its `Refreshing` variant wraps a+/// `Mutex`-backed render cache (`RefreshingInner`), and widening it would+/// cascade to `RefreshingInner` and `ChannelPromptInputs` — production types+/// with real invariants — purely to satisfy a test harness. A `pub` field of a+/// `pub(crate)` type is also exactly what the `private_interfaces` lint exists+/// to catch, and `-D warnings` makes that a hard error.+///+/// A `pub` newtype with a **private** field settles both: the field is visible,+/// the type inside it is not. An out-of-crate caller can therefore only ever+/// get the default (no prompt), which is all those tests want; in-crate tests+/// set one with [`HarnessSystemPrompt::new`].+#[derive(Clone, Default)]+pub struct HarnessSystemPrompt(Option<ChannelSystemPrompt>);++impl HarnessSystemPrompt {+ /// Seed the harness with `prompt`. Crate-internal, because the prompt is.+ pub(crate) fn new(prompt: ChannelSystemPrompt) -> Self {+ Self(Some(prompt))+ }++ /// The prompt, if one was set.+ pub(crate) fn into_inner(self) -> Option<ChannelSystemPrompt> {+ self.0+ }+}++impl std::fmt::Debug for HarnessSystemPrompt {+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {+ match &self.0 {+ Some(prompt) => f.debug_tuple("HarnessSystemPrompt").field(prompt).finish(),+ None => f.write_str("HarnessSystemPrompt(default)"),+ }+ }}impl Default for DispatchHarnessOptions {@@ -67,7 +116,7 @@ impl Default for DispatchHarnessOptions {seed_history_len: 0,memory_entries: Vec::new(),workspace_dir: None,- system_prompt: None,+ system_prompt: HarnessSystemPrompt::default(),}}}@@ -499,6 +548,7 @@ pub async fn run_dispatch_harness(options: DispatchHarnessOptions) -> DispatchHalet harness_system_prompt = options.system_prompt.clone()+ .into_inner().unwrap_or_else(|| ChannelSystemPrompt::fixed("system prompt"));let harness_workspace_dir = options.workspace_dirdiff --git a/src/openhuman/channels/tests/personality.rs b/src/openhuman/channels/tests/personality.rsindex 637be65d81..c9a3505182 100644--- a/src/openhuman/channels/tests/personality.rs+++ b/src/openhuman/channels/tests/personality.rs@@ -8,7 +8,9 @@//! twice through `run_dispatch_harness` with one shared prompt and edits//! `SOUL.md` in between — the reproduction in the issue, as a test.-use super::super::runtime::test_support::{run_dispatch_harness, DispatchHarnessOptions};+use super::super::runtime::test_support::{+ run_dispatch_harness, DispatchHarnessOptions, HarnessSystemPrompt,+};use super::common::make_workspace;use crate::openhuman::agent::profiles::home::profile_home;use crate::openhuman::agent::profiles::store::built_in_default_profile;@@ -80,7 +82,7 @@ async fn channel_reply_follows_soul_edit_without_restart() {let first = run_dispatch_harness(DispatchHarnessOptions {workspace_dir: Some(ws.path().to_path_buf()),- system_prompt: Some(prompt.clone()),+ system_prompt: HarnessSystemPrompt::new(prompt.clone()),content: "hi".to_string(),..Default::default()})@@ -94,7 +96,7 @@ async fn channel_reply_follows_soul_edit_without_restart() {let second = run_dispatch_harness(DispatchHarnessOptions {workspace_dir: Some(ws.path().to_path_buf()),- system_prompt: Some(prompt.clone()),+ system_prompt: HarnessSystemPrompt::new(prompt.clone()),content: "hi again".to_string(),..Default::default()})@@ -116,7 +118,7 @@ async fn fixed_prompt_seeds_every_turn_unchanged() {let ws = make_workspace();let observed = run_dispatch_harness(DispatchHarnessOptions {workspace_dir: Some(ws.path().to_path_buf()),- system_prompt: Some(ChannelSystemPrompt::fixed("pinned prompt")),+ system_prompt: HarnessSystemPrompt::new(ChannelSystemPrompt::fixed("pinned prompt")),..Default::default()}).await;