Skip to content

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

chore: files changed crates/openhuman-core/src/artifacts/production.rs,crates/openhuman-core/src/art

Steven Enamakeldfb1929691c4
diff --git a/crates/openhuman-core/src/artifacts/production.rs b/crates/openhuman-core/src/artifacts/production.rs
index fc0f72376f..8ee0d3039b 100644
--- a/crates/openhuman-core/src/artifacts/production.rs
+++ b/crates/openhuman-core/src/artifacts/production.rs
@@ -100,6 +100,34 @@ impl Production {
tool_call_id: Option<&str>,
revise: Option<&str>,
chat: Option<&ApprovalChatContext>,
+ ) -> Result<Self, String> {
+ let scoped = crate::storage::sessions::artifact_scoped_for_in(workspace_dir, ctx);
+ Self::start_with_scoped_storage(
+ ctx,
+ workspace_dir,
+ files,
+ kind,
+ title,
+ extension,
+ tool_call_id,
+ revise,
+ chat,
+ scoped,
+ )
+ .await
+ }
+
+ async fn start_with_scoped_storage(
+ ctx: &crate::core::runtime::DispatchCtx,
+ workspace_dir: &Path,
+ files: FileRoots,
+ kind: ArtifactKind,
+ title: &str,
+ extension: &str,
+ tool_call_id: Option<&str>,
+ revise: Option<&str>,
+ chat: Option<&ApprovalChatContext>,
+ scoped: Option<crate::storage::ScopedStorage>,
) -> Result<Self, String> {
let legacy_kind = if kind == ArtifactKind::Image {
LegacyArtifactKind::Image
@@ -119,12 +147,13 @@ impl Production {
)
.await?;
- let (artifacts, file_store) = super::tiny_store::artifacts_service_with_file_store(
+ let (artifacts, file_store) = super::tiny_store::build_artifacts_service_with_scope(
workspace_dir,
files.clone(),
None,
chat,
- ctx,
+ scoped,
+ None,
);
let mut production = Self {
artifacts,
diff --git a/crates/openhuman-core/src/artifacts/production_tests.rs b/crates/openhuman-core/src/artifacts/production_tests.rs
index ac0e69df93..84ff0a0d6c 100644
--- a/crates/openhuman-core/src/artifacts/production_tests.rs
+++ b/crates/openhuman-core/src/artifacts/production_tests.rs
@@ -91,7 +91,6 @@ async fn a_new_artifact_shares_one_id_and_one_file_between_card_and_record() {
// The version holds its own copy; the files folder shows the newest.
let file = record.latest().unwrap().file.clone().unwrap();
assert_eq!(file.key, format!("artifacts/files/{id}/v1.pptx"));
- let ctx = crate::core::runtime::DispatchCtx::process_default();
let file_store = production.file_store.as_ref().unwrap();
assert_eq!(file_store.read(&file.key).await.unwrap(), b"deck-v1");
assert_eq!(
@@ -101,6 +100,35 @@ async fn a_new_artifact_shares_one_id_and_one_file_between_card_and_record() {
);
}
+#[tokio::test]
+async fn missing_storage_binding_rejects_production_before_reserving_a_card_or_file() {
+ let (workspace, files) = temp_dirs();
+ let ctx = crate::core::runtime::DispatchCtx::process_default();
+ let started = Production::start_with_scoped_storage(
+ &ctx,
+ &workspace,
+ FileRoots::new(&files),
+ ArtifactKind::File,
+ "Quarterly Deck",
+ "pptx",
+ Some("call-missing-storage"),
+ None,
+ None,
+ None,
+ )
+ .await;
+
+ assert!(
+ started.is_err(),
+ "production requires tenant-scoped storage"
+ );
+ assert!(files_in(&files).is_empty(), "no output file was reserved");
+ let (cards, _) = super::super::store::list_artifacts(&workspace, 0, 20, None)
+ .await
+ .unwrap();
+ assert!(cards.is_empty(), "no legacy card was created");
+}
+
#[tokio::test]
async fn a_revision_reuses_the_id_and_file_and_keeps_the_history() {
let (workspace, files) = temp_dirs();