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/channels/runtime/startup/start_channels.rs,crates/ope

Steven Enamakelddb5ace822a8
diff --git a/crates/openhuman-core/src/channels/runtime/startup/start_channels.rs b/crates/openhuman-core/src/channels/runtime/startup/start_channels.rs
index c047f4c71c..f74792f221 100644
--- a/crates/openhuman-core/src/channels/runtime/startup/start_channels.rs
+++ b/crates/openhuman-core/src/channels/runtime/startup/start_channels.rs
@@ -128,7 +128,6 @@ async fn start_channels_inner(mut config: Config, session: CancellationToken) ->
crate::skills::schedule_flow_authoring_prewarm(&dispatch, &config, None);
let parts = build_channel_turn_parts(&dispatch, &config, &security, PromptToolDescs::Fixed)?;
let model = parts.model.clone();
- let workspace = config.workspace_dir.clone();
let skills = parts.skills.clone();
// Install the triggered-workflow subscriber now that workflows are
diff --git a/crates/openhuman-core/src/skills/bundled/flow_authoring.rs b/crates/openhuman-core/src/skills/bundled/flow_authoring.rs
index 31aa46d000..e6bf03e4b0 100644
--- a/crates/openhuman-core/src/skills/bundled/flow_authoring.rs
+++ b/crates/openhuman-core/src/skills/bundled/flow_authoring.rs
@@ -60,28 +60,37 @@ pub(crate) fn schedule_prewarm(
config: &Config,
domains: Option<DomainSet>,
) {
+ let owned_ctx = ctx.clone();
+ let owned_config = config.clone();
+ schedule_prewarm_operation(ctx, config, domains, async move {
+ prewarm(&owned_ctx, &owned_config, domains).await;
+ });
+}
+
+fn schedule_prewarm_operation(
+ ctx: &DispatchCtx,
+ config: &Config,
+ domains: Option<DomainSet>,
+ operation: impl std::future::Future<Output = ()> + Send + 'static,
+) -> bool {
let gate = DiscoveryGate::from_config(ctx, config, domains);
if !gate.flow_authoring_enabled() {
- return;
+ return false;
}
let workspace = config.workspace_dir.clone();
let key = snapshot_key(&workspace, &gate);
if generation_if_current(&workspace, &gate).is_some() {
- return;
+ return false;
}
let state = crate::modules::ops::state_of(crate::modules::tinyflows::MODULE_ID);
if state == crate::modules::types::ModuleState::Failed
|| (state == crate::modules::types::ModuleState::Ready
&& !crate::modules::runtime::is_module_serving(crate::modules::tinyflows::MODULE_ID))
{
- return;
+ return false;
}
- let owned_ctx = ctx.clone();
- let owned_config = config.clone();
- spawn_background(key, async move {
- prewarm(&owned_ctx, &owned_config, domains).await;
- });
+ spawn_background(key, operation)
}
fn spawn_background(
diff --git a/crates/openhuman-core/src/skills/bundled/flow_authoring_tests.rs b/crates/openhuman-core/src/skills/bundled/flow_authoring_tests.rs
index 15235ad135..2f1671782c 100644
--- a/crates/openhuman-core/src/skills/bundled/flow_authoring_tests.rs
+++ b/crates/openhuman-core/src/skills/bundled/flow_authoring_tests.rs
@@ -27,21 +27,31 @@ fn resources(reference: &str) -> Vec<ResourceFile> {
#[tokio::test]
async fn optional_warmup_returns_while_the_loader_is_blocked_and_deduplicates() {
let workspace = tempfile::tempdir().expect("workspace");
- let key = snapshot_key(workspace.path(), &gate_for(workspace.path()));
+ let mut config = Config::default();
+ config.workspace_dir = workspace.path().to_path_buf();
+ crate::modules::tinyflows::copilot_proxy(&config)
+ .await
+ .expect("linked TinyFlows fixture is admitted and serving");
+ let ctx = DispatchCtx::host_default();
let (started_tx, started_rx) = tokio::sync::oneshot::channel();
let (release_tx, release_rx) = tokio::sync::oneshot::channel::<()>();
let (finished_tx, finished_rx) = tokio::sync::oneshot::channel();
- assert!(spawn_background(key.clone(), async move {
- let _ = started_tx.send(());
- let _ = release_rx.await;
- let _ = finished_tx.send(());
- }));
+ assert!(schedule_prewarm_operation(
+ &ctx,
+ &config,
+ Some(DomainSet::full()),
+ async move {
+ let _ = started_tx.send(());
+ let _ = release_rx.await;
+ let _ = finished_tx.send(());
+ },
+ ));
// The scheduled operation is now blocked on `release_rx`. Reaching this
// point proves the caller that scheduled it did not wait for the loader.
started_rx.await.expect("background task started");
assert!(
- !spawn_background(key, async {}),
+ !schedule_prewarm_operation(&ctx, &config, Some(DomainSet::full()), async {}),
"a second warmup for the same explicit scope is coalesced"
);
release_tx.send(()).expect("release background task");