Skip to content

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

test(agent): add artifact store tests

Steven Enamakel1d794fea8179
diff --git a/crates/openhuman-core/src/agent/artifacts/store_tests.rs b/crates/openhuman-core/src/agent/artifacts/store_tests.rs
index 679e3ab1d4..48aa5e3711 100644
--- a/crates/openhuman-core/src/agent/artifacts/store_tests.rs
+++ b/crates/openhuman-core/src/agent/artifacts/store_tests.rs
@@ -346,7 +346,7 @@ async fn create_artifact_publishes_artifact_pending_event() {
/// C5; this is the follow-up wiring.
#[tokio::test]
async fn artifact_events_fill_request_id_from_chat_context() {
- use crate::security::approval::{ApprovalChatContext, APPROVAL_CHAT_CONTEXT};
+ use crate::security::approval::ApprovalChatContext;
crate::core::bus::init().await.expect("bus init");
let collector = PendingCollector::new();
@@ -359,24 +359,19 @@ async fn artifact_events_fill_request_id_from_chat_context() {
request_id: Some("request-artifact-request-id".to_string()),
};
- let (meta, _path) = APPROVAL_CHAT_CONTEXT
- .scope(ctx, async {
- let (meta, _path) = create_artifact(
- tmp.path(),
- &tmp.path().join("Files"),
- ArtifactKind::Document,
- "Report",
- "pdf",
- None,
- )
- .await
- .expect("create_artifact succeeds");
- finalize_artifact(tmp.path(), &meta.id, 42, None)
- .await
- .expect("finalize_artifact succeeds");
- (meta, ())
- })
- .await;
+ let (meta, _path) = create_artifact(
+ tmp.path(),
+ &tmp.path().join("Files"),
+ ArtifactKind::Document,
+ "Report",
+ "pdf",
+ Some(&ctx),
+ )
+ .await
+ .expect("create_artifact succeeds");
+ finalize_artifact(tmp.path(), &meta.id, 42, Some(&ctx))
+ .await
+ .expect("finalize_artifact succeeds");
let deadline = std::time::Instant::now() + std::time::Duration::from_secs(2);
let (mut saw_pending, mut saw_ready) = (false, false);
@@ -427,7 +422,7 @@ async fn artifact_events_fill_request_id_from_chat_context() {
/// `ArtifactFailed.request_id` from the bound chat context.
#[tokio::test]
async fn fail_artifact_fills_request_id_from_chat_context() {
- use crate::security::approval::{ApprovalChatContext, APPROVAL_CHAT_CONTEXT};
+ use crate::security::approval::ApprovalChatContext;
crate::core::bus::init().await.expect("bus init");
let collector = PendingCollector::new();
@@ -440,24 +435,19 @@ async fn fail_artifact_fills_request_id_from_chat_context() {
request_id: Some("request-artifact-fail-request-id".to_string()),
};
- let meta = APPROVAL_CHAT_CONTEXT
- .scope(ctx, async {
- let (meta, _path) = create_artifact(
- tmp.path(),
- &tmp.path().join("Files"),
- ArtifactKind::Document,
- "Report",
- "pdf",
- None,
- )
- .await
- .expect("create_artifact succeeds");
- fail_artifact(tmp.path(), tmp.path(), &meta.id, "boom", None)
- .await
- .expect("fail_artifact succeeds");
- meta
- })
- .await;
+ let (meta, _path) = create_artifact(
+ tmp.path(),
+ &tmp.path().join("Files"),
+ ArtifactKind::Document,
+ "Report",
+ "pdf",
+ Some(&ctx),
+ )
+ .await
+ .expect("create_artifact succeeds");
+ fail_artifact(tmp.path(), tmp.path(), &meta.id, "boom", Some(&ctx))
+ .await
+ .expect("fail_artifact succeeds");
let deadline = std::time::Instant::now() + std::time::Duration::from_secs(2);
loop {