Skip to content

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

test(storage): use future lease expiry and tool-role envelope in fixtures

Steven Enamakel7b5462e6640b
diff --git a/crates/openhuman-core/src/storage/import/sessions_tests.rs b/crates/openhuman-core/src/storage/import/sessions_tests.rs
index 0fcbd2637c..da333bb637 100644
--- a/crates/openhuman-core/src/storage/import/sessions_tests.rs
+++ b/crates/openhuman-core/src/storage/import/sessions_tests.rs
@@ -59,7 +59,7 @@ fn host_jsonl_reader_preserves_meta_usage_typed_rows_and_tool_state() {
"{\"_meta\":{\"agent\":\"Orchestrator\",\"agent_id\":\"orchestrator\",\"dispatcher\":\"native\",\"created\":\"2026-01-01T00:00:00Z\",\"updated\":\"2026-01-02T00:00:00Z\",\"turn_count\":2,\"input_tokens\":7,\"output_tokens\":3,\"cached_input_tokens\":1,\"charged_amount_usd\":0.25,\"thread_id\":\"thread\"}}\n",
"{\"kind\":\"tools\",\"tools\":[{\"name\":\"lookup\"}]}\n",
"{\"role\":\"assistant\",\"content\":\"answer\",\"provider\":\"local\",\"model\":\"m1\",\"usage\":{\"input\":7,\"output\":3,\"cached_input\":1,\"cost_usd\":0.25},\"ts\":\"2026-01-02T00:00:00Z\",\"request_id\":\"r1\",\"iteration\":2}\n",
- "{\"role\":\"user\",\"content\":\"old envelope\",\"tool_call_id\":\"call-1\"}\n"
+ "{\"role\":\"tool\",\"content\":\"{\\\"tool_call_id\\\":\\\"call-1\\\",\\\"content\\\":\\\"old envelope\\\"}\"}\n"
),
)
.unwrap();
diff --git a/crates/openhuman-core/src/storage/scope_move_tests.rs b/crates/openhuman-core/src/storage/scope_move_tests.rs
index ded75d4866..361eff857d 100644
--- a/crates/openhuman-core/src/storage/scope_move_tests.rs
+++ b/crates/openhuman-core/src/storage/scope_move_tests.rs
@@ -132,6 +132,7 @@ async fn a_v1_scope_moves_its_documents_streams_and_blobs() {
async fn canonical_cluster_scope_import_converts_profiles_and_leases_in_place() {
let fixture = crate::storage::test_support::sqlite_backend().unwrap();
let backend = Arc::clone(&fixture.backend);
+ let future_expiry_ms = chrono::Utc::now().timestamp_millis() + 10_000;
let inventory = crate::storage::import::scope_move::LegacyScopeInventory {
scopes: vec!["cluster".into()],
documents: vec![
@@ -157,7 +158,7 @@ async fn canonical_cluster_scope_import_converts_profiles_and_leases_in_place()
body: json!({
"owner": "worker-a",
"epoch": 8,
- "expires_at_ms": 9_000,
+ "expires_at_ms": future_expiry_ms,
"endpoint": "https://worker.example",
"released": false
}),
@@ -165,7 +166,7 @@ async fn canonical_cluster_scope_import_converts_profiles_and_leases_in_place()
schema: 2,
created_ms: 20,
updated_ms: 21,
- expires_ms: Some(10_000),
+ expires_ms: Some(future_expiry_ms),
},
},
],
@@ -203,11 +204,11 @@ async fn canonical_cluster_scope_import_converts_profiles_and_leases_in_place()
.unwrap();
assert_eq!(
lease.doc,
- json!({"holder":"worker-a", "epoch":8, "expires_ms":9000, "endpoint":"https://worker.example"})
+ json!({"holder":"worker-a", "epoch":8, "expires_ms":future_expiry_ms, "endpoint":"https://worker.example"})
);
assert_eq!(lease.meta.schema, 2);
assert_eq!(lease.meta.created_ms, 20);
- assert_eq!(lease.meta.expires_ms, Some(10_000));
+ assert_eq!(lease.meta.expires_ms, Some(future_expiry_ms));
let operator = backend.for_scope(&crate::storage::Scope::local()).unwrap();
assert!(operator