Skip to content

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

feat(session): track whether connected integrations are authoritative

Steven Enamakel2db808166e2d
diff --git a/crates/openhuman-core/src/agent/session_host/builder/builder_build.rs b/crates/openhuman-core/src/agent/session_host/builder/builder_build.rs
index e3c4b1b381..8bc1c68da9 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/builder_build.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/builder_build.rs
@@ -421,6 +421,7 @@ impl SessionHostBuilder {
run_queue: None,
connected_integrations: Vec::new(),
connected_integrations_initialized: false,
+ connected_integrations_authoritative: false,
runtime_config: None,
hosted_base,
definition: None,
diff --git a/crates/openhuman-core/src/agent/session_host/prelude_integrations.rs b/crates/openhuman-core/src/agent/session_host/prelude_integrations.rs
index a745206f6d..b80a0e5dfa 100644
--- a/crates/openhuman-core/src/agent/session_host/prelude_integrations.rs
+++ b/crates/openhuman-core/src/agent/session_host/prelude_integrations.rs
@@ -69,7 +69,7 @@ impl OpenHumanTurnPrelude {
let Some(config) = config else {
return;
};
- let Some(connected) = load_connected_integrations(&config).await else {
+ let Some((connected, authoritative)) = load_connected_integrations(&config).await else {
// Backend unreachable and nothing cached: stay un-hydrated so the
// next turn retries rather than pinning an empty surface.
log::warn!(
@@ -94,6 +94,7 @@ impl OpenHumanTurnPrelude {
.unwrap_or_else(std::sync::PoisonError::into_inner);
mutable.connected_integrations = connected;
mutable.connected_integrations_initialized = true;
+ mutable.connected_integrations_authoritative = authoritative;
mutable.announced_integrations = mutable
.connected_integrations
.iter()
@@ -108,10 +109,10 @@ impl OpenHumanTurnPrelude {
// An expired cache is refetched rather than skipped, so a
// long-lived session keeps tracking connects/revokes.
let current = match crate::integrations::composio::cached_active_integrations(config) {
- Some(current) => Some(current),
+ Some(current) => Some((current, true)),
None => load_connected_integrations(config).await,
};
- if let Some(current) = current {
+ if let Some((current, authoritative)) = current {
let mut mutable = self
.mutable
.lock()
@@ -126,6 +127,7 @@ impl OpenHumanTurnPrelude {
}
}
mutable.connected_integrations = current;
+ mutable.connected_integrations_authoritative = authoritative;
}
}
let connected_mcp = crate::mcp::registry::connections::connected_overview()
@@ -184,10 +186,10 @@ impl OpenHumanTurnPrelude {
/// there is neither a live answer nor any snapshot to fall back to.
async fn load_connected_integrations(
config: &crate::config::Config,
-) -> Option<Vec<crate::agent::prompts::ConnectedIntegration>> {
+) -> Option<(Vec<crate::agent::prompts::ConnectedIntegration>, bool)> {
use crate::integrations::composio::FetchConnectedIntegrationsStatus;
match crate::integrations::composio::fetch_connected_integrations_status(config).await {
- FetchConnectedIntegrationsStatus::Authoritative(connected) => Some(connected),
+ FetchConnectedIntegrationsStatus::Authoritative(connected) => Some((connected, true)),
FetchConnectedIntegrationsStatus::Unavailable => {
let stale =
crate::integrations::composio::cached_active_integrations_including_expired(config);
@@ -195,7 +197,7 @@ async fn load_connected_integrations(
"[session] integrations fetch unavailable; using stale snapshot={}",
stale.as_ref().map_or(0, Vec::len)
);
- stale
+ stale.map(|connected| (connected, false))
}
}
}
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session.rs b/crates/openhuman-core/src/agent/session_host/runtime_session.rs
index 0340f18b36..0199e3bb29 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session.rs
@@ -146,6 +146,7 @@ struct OpenHumanTurnPreludeMutable {
pending_skill_retraction: Vec<String>,
connected_integrations: Vec<crate::agent::prompts::ConnectedIntegration>,
connected_integrations_initialized: bool,
+ connected_integrations_authoritative: bool,
/// Integration action declarations this thread was already sent,
/// restored by the tinyagents session on resume. Rebuilt into deferred
/// executors whenever the live integrations list does not supply them
@@ -428,7 +429,7 @@ impl OpenHumanTurnPrelude {
.unwrap_or_else(std::sync::PoisonError::into_inner);
(
mutable.connected_integrations.clone(),
- mutable.connected_integrations_initialized,
+ mutable.connected_integrations_authoritative,
)
};
let mut surface = self
@@ -1491,6 +1492,7 @@ impl OpenHumanSessionHost {
pending_skill_retraction: self.pending_skill_retraction.clone(),
connected_integrations: self.connected_integrations.clone(),
connected_integrations_initialized: self.connected_integrations_initialized,
+ connected_integrations_authoritative: self.connected_integrations_initialized,
recorded_integration_actions: Vec::new(),
workflows: self.workflows.clone(),
composio_events: None,