Skip to content

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

fix: require effective library routes

Steven Enamakel9c6bfde9ff9c
diff --git a/src/embed/harness/builder.rs b/src/embed/harness/builder.rs
index d6dc7f4714..5cd46fd29f 100644
--- a/src/embed/harness/builder.rs
+++ b/src/embed/harness/builder.rs
@@ -239,7 +239,6 @@ impl HarnessBuilder {
async fn build_inner(self) -> Result<Harness, HarnessError> {
let inherit = self.workspace.is_operator_owned();
- let host_kind = effective_host_kind(self.host_kind, inherit, &self.provider);
if self.skills_dir.is_some() && inherit {
return Err(HarnessError::Invalid(
@@ -312,6 +311,17 @@ impl HarnessBuilder {
}
}
+ // An endpoint without a model is deliberately ignored by the route
+ // applicator. Host policy must follow that effective behavior rather
+ // than the syntactic presence of endpoint credentials, or an ignored
+ // route could exempt an inherited installed provider from login.
+ let routed_provider_effective = self.provider.is_routed()
+ && config
+ .as_ref()
+ .and_then(|config| config.default_model.as_deref())
+ .is_some_and(|model| !model.trim().is_empty());
+ let host_kind = effective_host_kind(self.host_kind, inherit, routed_provider_effective);
+
#[cfg(feature = "skills")]
if let Some(dir) = self.skills_dir.as_deref() {
super::skills::install(dir, &resolved.workspace_dir)?;
@@ -382,9 +392,9 @@ impl HarnessBuilder {
fn effective_host_kind(
requested: HostKind,
inherit_workspace: bool,
- provider: &Provider,
+ routed_provider_effective: bool,
) -> HostKind {
- if requested == HostKind::Library && inherit_workspace && !provider.is_routed() {
+ if requested == HostKind::Library && inherit_workspace && !routed_provider_effective {
HostKind::Cli
} else {
requested
diff --git a/src/embed/harness/builder_tests.rs b/src/embed/harness/builder_tests.rs
index e926972842..f856d7c641 100644
--- a/src/embed/harness/builder_tests.rs
+++ b/src/embed/harness/builder_tests.rs
@@ -28,19 +28,15 @@ fn a_harness_identifies_as_a_library_host_by_default() {
#[test]
fn inherited_workspace_and_provider_keep_installed_session_policy() {
assert_eq!(
- effective_host_kind(HostKind::Library, true, &Provider::inherit()),
+ effective_host_kind(HostKind::Library, true, false),
HostKind::Cli
);
assert_eq!(
- effective_host_kind(
- HostKind::Library,
- true,
- &Provider::openai_compatible("https://api.example/v1", "sk")
- ),
+ effective_host_kind(HostKind::Library, true, true),
HostKind::Library
);
assert_eq!(
- effective_host_kind(HostKind::Library, false, &Provider::inherit()),
+ effective_host_kind(HostKind::Library, false, false),
HostKind::Library
);
}
diff --git a/src/openhuman/memory/conversations/store/store_locks.rs b/src/openhuman/memory/conversations/store/store_locks.rs
index a7965dd640..d0fdbcef1e 100644
--- a/src/openhuman/memory/conversations/store/store_locks.rs
+++ b/src/openhuman/memory/conversations/store/store_locks.rs
@@ -77,6 +77,15 @@ pub(super) fn for_root(root: &Path) -> Arc<StoreLocks> {
/// Canonicalizing the nearest existing ancestor handles symlinks and `..`;
/// the missing suffix is then appended without touching the filesystem.
pub(super) fn normalized_root(root: &Path) -> PathBuf {
+ let absolute;
+ let root = if root.is_absolute() {
+ root
+ } else {
+ absolute = std::env::current_dir()
+ .map(|cwd| cwd.join(root))
+ .unwrap_or_else(|_| root.to_path_buf());
+ &absolute
+ };
if let Ok(canonical) = root.canonicalize() {
return canonical;
}
diff --git a/src/openhuman/memory/conversations/store/store_tests_late.rs b/src/openhuman/memory/conversations/store/store_tests_late.rs
index 53adff3d26..a156f2511c 100644
--- a/src/openhuman/memory/conversations/store/store_tests_late.rs
+++ b/src/openhuman/memory/conversations/store/store_tests_late.rs
@@ -208,6 +208,21 @@ fn equivalent_workspace_paths_share_the_same_lock_registry_entry() {
assert_eq!(direct.root_dir(), dotted.root_dir());
}
+#[test]
+fn nonexistent_relative_and_absolute_workspaces_share_store_identity() {
+ let relative = PathBuf::from(format!("target/store-alias-{}", uuid::Uuid::new_v4()));
+ let absolute = std::env::current_dir().unwrap().join(&relative);
+
+ let relative_store = ConversationStore::new(relative);
+ let absolute_store = ConversationStore::new(absolute);
+
+ assert_eq!(
+ relative_store.lock_identity_for_test(),
+ absolute_store.lock_identity_for_test()
+ );
+ assert_eq!(relative_store.root_dir(), absolute_store.root_dir());
+}
+
#[cfg(unix)]
#[test]
fn symlinked_workspace_paths_share_the_same_lock_registry_entry() {