Skip to content

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

style(threads): reorder imports and re-exports

Steven Enamakelf6def3c690e8
diff --git a/crates/openhuman-core/src/threads/ops.rs b/crates/openhuman-core/src/threads/ops.rs
index 10e1474c6c..d051f38e25 100644
--- a/crates/openhuman-core/src/threads/ops.rs
+++ b/crates/openhuman-core/src/threads/ops.rs
@@ -27,13 +27,13 @@ pub use live_state::{
};
pub use purge::threads_purge;
pub use title_generation::thread_generate_title;
-pub use working_dir::thread_update_working_dir;
-pub(crate) use working_dir::thread_working_dir;
pub use transcript::{transcript_get, TranscriptGetRequest};
pub use turn_state_ops::{
turn_state_clear, turn_state_get, turn_state_get_turn, turn_state_history, turn_state_list,
};
pub use usage::{token_usage, SubagentUsageDto, ThreadTokenUsageRequest, ThreadTokenUsageResponse};
+pub use working_dir::thread_update_working_dir;
+pub(crate) use working_dir::thread_working_dir;
// Test-only re-exports so `use super::*;` in the split-out test modules below
// keeps resolving the shared helpers that now live in `support`.
diff --git a/crates/openhuman-core/src/threads/ops/working_dir_tests.rs b/crates/openhuman-core/src/threads/ops/working_dir_tests.rs
new file mode 100644
index 0000000000..640f38faef
--- /dev/null
+++ b/crates/openhuman-core/src/threads/ops/working_dir_tests.rs
@@ -0,0 +1,35 @@
+use super::*;
+
+#[test]
+fn empty_request_uses_the_global_folder() {
+ assert_eq!(validate_working_dir(None).unwrap(), None);
+ assert_eq!(validate_working_dir(Some(" ")).unwrap(), None);
+}
+
+#[test]
+fn existing_absolute_directory_is_canonicalized() {
+ let temp = tempfile::tempdir().unwrap();
+ let nested = temp.path().join("project");
+ std::fs::create_dir(&nested).unwrap();
+ let raw = format!("{}/./", nested.display());
+ let validated = validate_working_dir(Some(&raw)).unwrap().unwrap();
+ assert_eq!(PathBuf::from(validated), nested.canonicalize().unwrap());
+}
+
+#[test]
+fn relative_missing_file_and_forbidden_paths_are_rejected() {
+ assert!(validate_working_dir(Some("relative/dir")).is_err());
+
+ let temp = tempfile::tempdir().unwrap();
+ assert!(
+ validate_working_dir(Some(&temp.path().join("missing").display().to_string())).is_err()
+ );
+
+ let file = temp.path().join("file.txt");
+ std::fs::write(&file, "x").unwrap();
+ assert!(validate_working_dir(Some(&file.display().to_string())).is_err());
+
+ let ssh = temp.path().join(".ssh");
+ std::fs::create_dir(&ssh).unwrap();
+ assert!(validate_working_dir(Some(&ssh.display().to_string())).is_err());
+}
diff --git a/crates/openhuman-core/src/threads/schemas/registry.rs b/crates/openhuman-core/src/threads/schemas/registry.rs
index 3d183bb4a5..8e504a4082 100644
--- a/crates/openhuman-core/src/threads/schemas/registry.rs
+++ b/crates/openhuman-core/src/threads/schemas/registry.rs
@@ -10,8 +10,7 @@ use super::handlers::{
handle_regenerate, handle_todos_get, handle_token_usage, handle_transcript_get,
handle_turn_state_clear, handle_turn_state_get, handle_turn_state_get_turn,
handle_turn_state_history, handle_turn_state_list, handle_update_labels, handle_update_title,
- handle_update_working_dir,
- handle_upsert,
+ handle_update_working_dir, handle_upsert,
};
use super::schema_defs::schemas;
diff --git a/crates/openhuman-core/src/threads/store/mod.rs b/crates/openhuman-core/src/threads/store/mod.rs
index ffa8e72682..34cf18b092 100644
--- a/crates/openhuman-core/src/threads/store/mod.rs
+++ b/crates/openhuman-core/src/threads/store/mod.rs
@@ -35,7 +35,8 @@ pub use bus::register_conversation_persistence_subscriber;
pub use store::{
append_message, delete_messages_from, delete_thread, ensure_thread, get_messages,
is_deterministic_message_id, list_threads, purge_threads, reply_run_id, run_reply_message_id,
- update_message, update_thread_labels, update_thread_title, update_thread_working_dir, ConversationPurgeStats,
- ConversationStore, ConversationThread, CreateConversationThread, CrossThreadHit,
- ThreadMessage as ConversationMessage, ThreadMessagePatch as ConversationMessagePatch,
+ update_message, update_thread_labels, update_thread_title, update_thread_working_dir,
+ ConversationPurgeStats, ConversationStore, ConversationThread, CreateConversationThread,
+ CrossThreadHit, ThreadMessage as ConversationMessage,
+ ThreadMessagePatch as ConversationMessagePatch,
};