Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
8ddc6c0
perf(profile): add an embed-fleet density scenario (#7032)
oxoxDev Oct 8, 2026
04f07fe
test(profile): cover the embed-fleet agent ids and per-agent math (#7…
oxoxDev Oct 8, 2026
97e6ab2
feat(core): give derived agent contexts their own policy, catalogue a…
oxoxDev Oct 8, 2026
e2c4638
feat(agent): carry the agent context across spawned turn work (#7032)
oxoxDev Oct 8, 2026
c1b2ce4
test(core): cover agent-scoped slots, the context registry and scoped…
oxoxDev Oct 8, 2026
57396bd
feat(security): answer policy reads from the agent context first (#7032)
oxoxDev Oct 8, 2026
e1d0a5e
test(security): cover agent-first policy resolution (#7032)
oxoxDev Oct 8, 2026
5635270
feat(security): let an agent context turn the approval gate off (#7032)
oxoxDev Oct 8, 2026
103c1db
test(security): cover per-agent approval answers (#7032)
oxoxDev Oct 8, 2026
a1d45e6
feat(embed): give each agent its own policy, auto-approve list and ap…
oxoxDev Oct 8, 2026
0ad4de9
test(embed): cover the per-agent approval settings on Access (#7032)
oxoxDev Oct 8, 2026
f84e884
feat(security): record which agent parked each approval (#7032)
oxoxDev Oct 8, 2026
efd5baa
feat(security): scope approval.list_pending and approval.decide to an…
oxoxDev Oct 8, 2026
7ffdf57
test(security): cover agent-keyed approval routing, scoped decide and…
oxoxDev Oct 8, 2026
89cc4a1
feat(embed): add Agent::approvals, scoped to that agent's requests (#…
oxoxDev Oct 8, 2026
ed98604
test(embed): prove each agent answers policy from its own tier (#7032)
oxoxDev Oct 8, 2026
ac2023e
test(embed): prove approvals stay with the agent that parked them (#7…
oxoxDev Oct 8, 2026
f16b76d
feat(agent): resolve the sub-agent catalogue through the agent contex…
oxoxDev Oct 8, 2026
c2915e8
test(agent): cover catalogue resolution through the agent context (#7…
oxoxDev Oct 8, 2026
c9bccf0
feat(agent): let a definition, not the orchestrator id, opt into conn…
oxoxDev Oct 8, 2026
d1149cb
feat(embed): give an agent sub-agents of its own and reserve the buil…
oxoxDev Oct 8, 2026
d9fc3ea
test(embed): cover an agent's own sub-agent catalogue and id checks (…
oxoxDev Oct 8, 2026
c8fe489
feat(agent): load turn-time config from the agent context (#7032)
oxoxDev Oct 8, 2026
f3168b1
fix(config): apply a context's inference route on every context confi…
oxoxDev Oct 8, 2026
49850ca
fix(embed): carry an agent's provider route on its context so detache…
oxoxDev Oct 8, 2026
d4c97de
test(embed): prove sub-agents stay with the agent that declared them …
oxoxDev Oct 8, 2026
5909b29
feat(mcp): give each agent context its own MCP host under its scope d…
oxoxDev Oct 8, 2026
d73ea22
test(mcp): cover per-agent MCP hosts and the ambient agent lookup (#7…
oxoxDev Oct 8, 2026
ced6a63
fix(agent): resolve a session's delegation surface from its own defin…
oxoxDev Oct 8, 2026
dbec636
test(embed): prove MCP servers stay with the agent that installed the…
oxoxDev Oct 8, 2026
8f40b5b
refactor(web_chat): keep turn tables in the agent context's slots (#7…
oxoxDev Oct 8, 2026
dce4c0f
test(web_chat): cover per-agent turn tables (#7032)
oxoxDev Oct 8, 2026
9cab82b
refactor(memory): keep turn citations in the agent context's slot (#7…
oxoxDev Oct 8, 2026
7885d3f
test(memory): cover per-agent turn citations (#7032)
oxoxDev Oct 8, 2026
fb4a049
refactor(web_chat): keep budget signals in the agent context's slot (…
oxoxDev Oct 8, 2026
e19bbb3
test(web_chat): cover per-agent budget signals (#7032)
oxoxDev Oct 8, 2026
deefaea
refactor(agent): keep plan-mode handles in the agent context's slot (…
oxoxDev Oct 8, 2026
ce5fd08
test(agent): cover per-agent plan mode (#7032)
oxoxDev Oct 8, 2026
1c124bd
refactor(agent): keep per-thread reasoning effort in the agent contex…
oxoxDev Oct 8, 2026
4a5924a
test(agent): cover per-agent reasoning effort (#7032)
oxoxDev Oct 8, 2026
e3270e2
refactor(agent): keep the request journal map in the agent context's …
oxoxDev Oct 8, 2026
5d7eac5
test(agent): cover the per-agent request journal map (#7032)
oxoxDev Oct 8, 2026
ef1bfaa
refactor(agent): keep sub-agent in-flight dedupe in the agent context…
oxoxDev Oct 8, 2026
e65b176
test(agent): cover per-agent sub-agent in-flight dedupe (#7032)
oxoxDev Oct 8, 2026
2861477
refactor(agent): keep run_workflow guard state in the agent context's…
oxoxDev Oct 8, 2026
3844da9
test(agent): cover the per-agent run_workflow guard (#7032)
oxoxDev Oct 8, 2026
4c29328
fix(tools): key pooled browser sessions by the agent's scope and thre…
oxoxDev Oct 8, 2026
b8dbbe1
test(tools): cover per-agent browser session keys (#7032)
oxoxDev Oct 8, 2026
5667da5
feat(agent): keep an embedded agent's transcripts under its own direc…
oxoxDev Oct 8, 2026
668f897
test(agent): cover per-agent transcripts and the shared-file fallback…
oxoxDev Oct 8, 2026
0f34410
feat(embed): lay out each agent's transcripts under its own directory…
oxoxDev Oct 8, 2026
65ddad6
feat(skills): keep an embedded agent's user-scope skills under its ow…
oxoxDev Oct 8, 2026
3cb4064
test(skills): cover per-agent skill writes and discovery (#7032)
oxoxDev Oct 8, 2026
b834b53
feat(cron): give each embedded agent its own job store and run its jo…
oxoxDev Oct 8, 2026
a3f3c50
test(cron): cover per-agent job stores and dormant jobs (#7032)
oxoxDev Oct 8, 2026
b512b29
feat(memory): sync every live agent's memory sources under its own co…
oxoxDev Oct 8, 2026
aa54b75
feat(mcp): let a host evict an agent's MCP host (#7032)
oxoxDev Oct 8, 2026
c1e430d
fix(mcp): read an agent's connections without creating its MCP host (…
oxoxDev Oct 8, 2026
3035d0b
fix(security): skip denying an agent's approvals when no approval sto…
oxoxDev Oct 8, 2026
c7441d9
feat(embed): cap live agents and remove an agent from a running runti…
oxoxDev Oct 8, 2026
2aa057e
test(embed): cover turn admission and removal of an agent (#7032)
oxoxDev Oct 8, 2026
15151e0
fix(embed): deny a removed agent's approvals before ending its turns …
oxoxDev Oct 8, 2026
5adb2b3
test(embed): prove removal, the agent cap and approval cleanup (#7032)
oxoxDev Oct 8, 2026
5d5eb7a
test(embed): prove sessions, transcripts and created skills stay with…
oxoxDev Oct 8, 2026
093b94a
test(embed): pin the agent lifecycle and approvals surface in the pub…
oxoxDev Oct 8, 2026
611d127
docs(embed): document per-agent isolation, removal and what agents st…
oxoxDev Oct 8, 2026
7efbe88
docs(core): drop stale module references and describe per-agent turn …
oxoxDev Oct 8, 2026
27cd4a0
refactor(core): move an agent context's parts and the overlay into si…
oxoxDev Oct 8, 2026
d924279
refactor(agent): resolve the session definition in one helper and rea…
oxoxDev Oct 8, 2026
9efd48e
test(agent): keep the per-agent in-flight dedupe test with the lifecy…
oxoxDev Oct 8, 2026
1e84148
docs(core): tighten approval event and sub-agent runner docs and lowe…
oxoxDev Oct 8, 2026
81b2665
docs(performance): record embedded-fleet density before and after age…
oxoxDev Oct 8, 2026
f97bdba
test(cron): compare per-agent job ids against a borrowed slice (#7032)
oxoxDev Oct 8, 2026
6816713
Merge upstream/main into feat/7032-isolated-agents
oxoxDev Oct 9, 2026
0d8f559
fix(rpc): release background-completion stores through the host inter…
oxoxDev Oct 9, 2026
1d97b1a
docs(gitbook): describe the paged, guarded and scanned skill registry…
oxoxDev Oct 9, 2026
8b69575
Merge remote-tracking branch 'upstream/main' into feat/7032-isolated-…
oxoxDev Oct 9, 2026
3ce4af2
fix(web_chat): check live turns in the agent context's turn tables (#…
oxoxDev Oct 9, 2026
209985e
Merge remote-tracking branch 'upstream/main' into feat/7032-isolated-…
oxoxDev Oct 9, 2026
281ccee
Merge upstream/main into feat/7032-isolated-agents
senamakel Oct 9, 2026
a1581d0
chore(vendor): bump tinyagents submodule
senamakel Oct 9, 2026
79c3a5b
chore(vendor): restore main's tinyagents pin
senamakel Oct 9, 2026
e1cbc93
refactor(agent): replace registry current() with global() and drop se…
senamakel Oct 9, 2026
79b1ce5
Revert "refactor(agent): replace registry current() with global() and…
senamakel Oct 9, 2026
c371f16
chore(ci): add saas ambient baseline snapshot
senamakel Oct 9, 2026
6273cca
chore(ci): refresh the SaaS ambient baseline and the app lockfile aft…
senamakel Oct 9, 2026
882cf4d
chore(vendor): pin tinyagents at 33a86887 (tool rules)
senamakel Oct 9, 2026
c0e6a65
chore(deps): add tinytools to lockfile dependencies
senamakel Oct 9, 2026
6ce97c6
Merge upstream/main into feat/7032-isolated-agents
senamakel Oct 9, 2026
692fe56
chore(deps): sync the app lockfile with the embed dependency set
senamakel Oct 9, 2026
19aff4f
fix(config): build the context-aware config load on load_config_with_…
oxoxDev Oct 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions crates/openhuman-core/src/agent/bus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,10 @@ async fn handle_agent_run_turn(req: AgentTurnRequest) -> Result<AgentTurnRespons
// the bus without bootstrapping definitions).
let sandbox_mode = target_agent_id
.as_deref()
.and_then(|id| AgentDefinitionRegistry::global().and_then(|reg| reg.get(id)))
.map(|def| def.sandbox_mode)
.and_then(|id| {
AgentDefinitionRegistry::current()
.and_then(|reg| reg.get(id).map(|def| def.sandbox_mode))
})
.unwrap_or(SandboxMode::None);

// Scope the caller-supplied origin around the tool loop so
Expand Down
2 changes: 1 addition & 1 deletion crates/openhuman-core/src/agent/debug/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ pub async fn dump_all_agent_prompts(
AgentDefinitionRegistry::init_global(&config.workspace_dir)
.context("initialising AgentDefinitionRegistry for prompt dump")?;

let registry = AgentDefinitionRegistry::global()
let registry = AgentDefinitionRegistry::current()
.ok_or_else(|| anyhow!("AgentDefinitionRegistry missing after init"))?;

let ids: Vec<String> = registry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ pub(crate) fn test_main_def() -> AgentDefinition {
],
delegate_name: None,
agent_tier: AgentTier::Chat,
searches_connected_mcp: false,
source: DefinitionSource::Builtin,
graph: Default::default(),
}
Expand Down Expand Up @@ -122,6 +123,7 @@ pub(crate) fn test_inherit_echo_def() -> AgentDefinition {
subagents: vec![],
delegate_name: None,
agent_tier: crate::agent::harness::definition::AgentTier::Worker,
searches_connected_mcp: false,
source: DefinitionSource::Builtin,
graph: Default::default(),
}
Expand Down Expand Up @@ -160,6 +162,7 @@ pub(crate) fn test_inherit_parallel_worker_def() -> AgentDefinition {
subagents: vec![],
delegate_name: None,
agent_tier: crate::agent::harness::definition::AgentTier::Worker,
searches_connected_mcp: false,
source: DefinitionSource::Builtin,
graph: Default::default(),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,12 @@ pub struct AgentDefinition {
#[serde(default)]
pub agent_tier: AgentTier,

/// Whether this agent's turns can search and call the tools of every
/// connected MCP server (deferred, through `tool_search`). Set for the
/// user-facing orchestrator; specialists reach MCP only through it.
#[serde(default)]
pub searches_connected_mcp: bool,

// ── source bookkeeping ──────────────────────────────────────────────
/// Tracks where the definition was loaded from (Builtin vs. File).
#[serde(skip)]
Expand Down
25 changes: 25 additions & 0 deletions crates/openhuman-core/src/agent/harness/definition/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,29 @@ impl AgentDefinitionRegistry {
pub fn global_arc() -> Option<Arc<Self>> {
GLOBAL.get().cloned()
}

/// The catalogue sub-agent lookups resolve through: the ambient agent
/// context's own registry when it carries one, else the process registry.
pub fn current() -> Option<Arc<Self>> {
crate::core::runtime::CoreContext::current()
.and_then(|ctx| ctx.definitions())
.or_else(Self::global_arc)
}

/// A copy of this registry with `definitions` added, replacing any
/// definition with the same id.
pub fn with_definitions(&self, definitions: impl IntoIterator<Item = AgentDefinition>) -> Self {
let mut registry = Self::default();
for definition in self.list() {
registry.insert(definition.clone());
}
for definition in definitions {
registry.insert(definition);
}
registry
}
}

#[cfg(test)]
#[path = "registry_tests.rs"]
mod tests;
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
use super::*;
use crate::core::runtime::{ContextOverlay, CoreContext, DomainSet};

fn named(id: &str, when: &str) -> AgentDefinition {
let mut definition = AgentDefinitionRegistry::builtins_only()
.get("orchestrator")
.cloned()
.expect("built-in orchestrator");
definition.id = id.to_string();
definition.when_to_use = when.to_string();
definition
}

#[test]
fn with_definitions_adds_and_replaces_without_touching_the_source() {
let base = AgentDefinitionRegistry::builtins_only();
let before = base.len();
let own = base.with_definitions([
named("own-worker", "added"),
named("orchestrator", "replaced"),
]);
assert_eq!(own.len(), before + 1);
assert_eq!(own.get("own-worker").unwrap().when_to_use, "added");
assert_eq!(own.get("orchestrator").unwrap().when_to_use, "replaced");
assert!(base.get("own-worker").is_none());
assert_ne!(base.get("orchestrator").unwrap().when_to_use, "replaced");
}

#[tokio::test]
async fn current_follows_the_agent_context_and_falls_back_to_the_process() {
let own = Arc::new(
AgentDefinitionRegistry::builtins_only().with_definitions([named("ctx-only", "mine")]),
);
let parent = CoreContext::for_test(DomainSet::full(), Some(std::env::temp_dir()));
let agent = parent.derive_with(
ContextOverlay::new(
crate::config::Config::default(),
DomainSet::kernel(),
crate::tools::toolpacks::ToolGroups::none(),
)
.session_agent("catalogue-agent")
.definitions(Arc::clone(&own)),
);

let seen = CoreContext::scope(agent, async { AgentDefinitionRegistry::current() })
.await
.expect("the agent's registry");
assert!(Arc::ptr_eq(&seen, &own));

let outside = CoreContext::scope(parent, async { AgentDefinitionRegistry::current() }).await;
assert!(
outside.is_none_or(|registry| registry.get("ctx-only").is_none()),
"a context without its own catalogue resolves through the process"
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ fn make_def(id: &str) -> AgentDefinition {
subagents: vec![],
delegate_name: None,
agent_tier: crate::agent::harness::definition::AgentTier::Worker,
searches_connected_mcp: false,
source: DefinitionSource::Builtin,
graph: Default::default(),
}
Expand Down
2 changes: 1 addition & 1 deletion crates/openhuman-core/src/agent/library/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub async fn list_definition_metadata() -> Result<Vec<AgentDefinitionDisplay>, S
AgentDefinitionRegistry::init_global(&config.workspace_dir)
.map_err(|e| format!("failed to initialise AgentDefinitionRegistry: {e}"))?;
}
let registry = AgentDefinitionRegistry::global()
let registry = AgentDefinitionRegistry::current()
.ok_or_else(|| "AgentDefinitionRegistry not initialised".to_string())?;
let definitions = registry
.list()
Expand Down
1 change: 1 addition & 0 deletions crates/openhuman-core/src/agent/library/ops_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ fn definition() -> AgentDefinition {
],
delegate_name: None,
agent_tier: AgentTier::Worker,
searches_connected_mcp: false,
source: DefinitionSource::Builtin,
graph: Default::default(),
}
Expand Down
2 changes: 1 addition & 1 deletion crates/openhuman-core/src/agent/multimodal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ impl TextExtractor for DocumentsTextExtractor {
use crate::modules::documents;

match tokio::time::timeout(PDF_EXTRACTION_TIMEOUT, async {
let config = crate::config::Config::load_or_init()
let config = crate::config::ops::load_current_or_init()
.await
.map_err(|error| format!("config unavailable for pdf extraction: {error}"))?;
documents::extract_text(&config, bytes)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ pub async fn start_member_run(
// worker keeps the label the approval gate needs. Inherit-only: no origin
// in scope means the worker stays unlabelled and fails closed as before.
let inherited_origin = crate::agent::turn_origin::capture();
tokio::spawn(async move {
crate::core::runtime::spawn_scoped(async move {
crate::agent::turn_origin::with_inherited_origin(
inherited_origin,
run_member_loop(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,11 @@ fn handle_agent_work_control(params: Map<String, Value>) -> ControllerFuture {
/// Resolve an agent id to its registry display name, if the registry is up and
/// the agent is known. Returns `None` otherwise (e.g. custom/removed agents).
fn resolve_display_name(agent_id: &str) -> Option<String> {
AgentDefinitionRegistry::global()
.and_then(|registry| registry.get(agent_id))
.map(|definition| definition.display_name().to_string())
AgentDefinitionRegistry::current().and_then(|registry| {
registry
.get(agent_id)
.map(|definition| definition.display_name().to_string())
})
}

fn to_json<T: serde::Serialize>(value: T) -> Result<Value, String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl FleetToolSet {

/// Resolve the set for `agent_definition_id` from the global registry.
pub(crate) fn for_parent(agent_definition_id: &str) -> Self {
let Some(registry) = AgentDefinitionRegistry::global() else {
let Some(registry) = AgentDefinitionRegistry::current() else {
return Self::all();
};
let Some(definition) = registry.get(agent_definition_id) else {
Expand Down
7 changes: 3 additions & 4 deletions crates/openhuman-core/src/agent/orchestration/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,9 +338,8 @@ impl AgentOrchestrationSession {

let progress_sink = parent.on_progress.clone();
if let Some(progress) = progress_sink.clone() {
let resolved_display_name = AgentDefinitionRegistry::global()
.and_then(|reg| reg.get(&agent_id))
.map(|def| def.display_name().to_string());
let resolved_display_name = AgentDefinitionRegistry::current()
.and_then(|reg| reg.get(&agent_id).map(|def| def.display_name().to_string()));
let _ = progress
.send(AgentProgress::SubagentSpawned {
agent_id: agent_id.clone(),
Expand Down Expand Up @@ -664,7 +663,7 @@ fn resolve_definition(request: &SpawnAgentRequest) -> Result<AgentDefinition, Or
return Err(OrchestrationError::InvalidSpawnRequest);
}
let registry =
AgentDefinitionRegistry::global().ok_or(OrchestrationError::RegistryUnavailable)?;
AgentDefinitionRegistry::current().ok_or(OrchestrationError::RegistryUnavailable)?;
registry
.get(agent_id)
.cloned()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub(crate) async fn run_spawn_parallel_tasks_with_cancellation_and_workspace(
max_parallel,
"[spawn_parallel_agents] validated_parent_context"
);
let registry = match AgentDefinitionRegistry::global() {
let registry = match AgentDefinitionRegistry::current() {
Some(registry) => registry,
None => {
tracing::debug!("[spawn_parallel_agents] registry_unavailable");
Expand All @@ -62,7 +62,7 @@ pub(crate) async fn run_spawn_parallel_tasks_with_cancellation_and_workspace(
let progress_sink = parent.on_progress.clone();
let action_root =
resolve_spawn_parallel_action_root(parent_workspace_descriptor.as_ref()).await;
let definitions = snapshot_agent_definitions(registry);
let definitions = snapshot_agent_definitions(&registry);
if cancel.is_cancelled() {
return Ok(SpawnParallelGraphOutcome::Cancelled(
"spawn_parallel_agents cancelled at validate".to_string(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ impl ContinueSubagentTool {
}

// Look up the agent definition
let registry = match AgentDefinitionRegistry::global() {
let registry = match AgentDefinitionRegistry::current() {
Some(reg) => reg,
None => {
return Ok(ToolResult::error(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

use crate::agent::harness::definition::AgentDefinitionRegistry;
use crate::agent::orchestration::delegation::run_subagent_delegation_with_parent_context;
use crate::config::Config;
use async_trait::async_trait;
use serde_json::json;
use std::sync::Arc;
Expand Down Expand Up @@ -111,7 +110,7 @@ impl Tool for DelegateGraphTool {
}

fn parameters_schema(&self) -> serde_json::Value {
let agent_ids: Vec<String> = AgentDefinitionRegistry::global()
let agent_ids: Vec<String> = AgentDefinitionRegistry::current()
.map(|reg| reg.list().iter().map(|d| d.id.clone()).collect())
.unwrap_or_default();

Expand Down Expand Up @@ -212,7 +211,7 @@ impl DelegateGraphTool {
.map(|n| (n as usize).min(MAX_MAX_REVISIONS))
.unwrap_or(DEFAULT_MAX_REVISIONS);

let registry = match AgentDefinitionRegistry::global() {
let registry = match AgentDefinitionRegistry::current() {
Some(reg) => reg,
None => {
return Ok(ToolResult::error(
Expand All @@ -229,7 +228,7 @@ impl DelegateGraphTool {
}
};

let config = match Config::load_or_init().await {
let config = match crate::config::ops::load_current_or_init().await {
Ok(cfg) => Arc::new(cfg),
Err(e) => {
return Ok(ToolResult::error(format!(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl DelegationDispatch {
// `delegate_graph` is a concrete durable graph tool with its own
// typed dispatcher, and arbitrary `delegate_*` tools must not be
// mistaken for an agent target merely because of their spelling.
name if AgentDefinitionRegistry::global().is_some_and(|registry| {
name if AgentDefinitionRegistry::current().is_some_and(|registry| {
registry.list().into_iter().any(|definition| {
definition
.delegate_name
Expand Down Expand Up @@ -102,7 +102,7 @@ impl ToolDispatch<(), crate::agent::tinyagents::host::OpenHumanRunContext> for D
.await
}
DelegationDispatchKind::Archetype => {
let Some(agent_id) = AgentDefinitionRegistry::global().and_then(|registry| {
let Some(agent_id) = AgentDefinitionRegistry::current().and_then(|registry| {
registry.list().into_iter().find_map(|definition| {
let name = definition
.delegate_name
Expand Down Expand Up @@ -163,7 +163,7 @@ pub(crate) async fn dispatch_subagent_with_live_parent(
let parent_workspace_descriptor = tool_context
.and_then(|ctx| ctx.workspace().cloned())
.or_else(|| run_context.workspace.clone());
let registry = match AgentDefinitionRegistry::global() {
let registry = match AgentDefinitionRegistry::current() {
Some(reg) => reg,
None => {
return Ok(ToolResult::error(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ impl Tool for SpawnAsyncSubagentTool {
let agent_ids: Vec<String> = if scoped {
self.advertised_ids.clone()
} else {
AgentDefinitionRegistry::global()
AgentDefinitionRegistry::current()
.map(|reg| reg.list().iter().map(|d| d.id.clone()).collect())
.unwrap_or_default()
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl SpawnAsyncSubagentTool {
}
};

let registry = match AgentDefinitionRegistry::global() {
let registry = match AgentDefinitionRegistry::current() {
Some(registry) => registry,
None => {
return Ok(ToolResult::error(
Expand Down Expand Up @@ -141,7 +141,7 @@ impl SpawnAsyncSubagentTool {
workspace.root.clone()
})
.or_else(|| {
crate::security::live_policy::current().map(|policy| policy.action_dir.clone())
crate::security::live_policy::effective().map(|policy| policy.action_dir.clone())
});
let selector = SubagentSessionSelector {
parent_session: parent_session.clone(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ impl Tool for SpawnParallelAgentsTool {
}

fn parameters_schema(&self) -> serde_json::Value {
let agent_ids: Vec<String> = AgentDefinitionRegistry::global()
let agent_ids: Vec<String> = AgentDefinitionRegistry::current()
.map(|reg| reg.list().iter().map(|d| d.id.clone()).collect())
.unwrap_or_default();
let agent_id_schema = if agent_ids.is_empty() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ fn definition_with_tool_scope(
subagents: Vec::new(),
delegate_name: None,
agent_tier: AgentTier::Worker,
searches_connected_mcp: false,
source: DefinitionSource::Builtin,
graph: Default::default(),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fn spawn_subagent_parameters_schema() -> serde_json::Value {
// Build the agent_id enum dynamically from the global registry
// when it's been initialised. Falls back to a string-with-hint
// when the registry hasn't been set up yet (e.g. early tests).
let agent_ids: Vec<String> = AgentDefinitionRegistry::global()
let agent_ids: Vec<String> = AgentDefinitionRegistry::current()
.map(|reg| reg.list().iter().map(|d| d.id.clone()).collect())
.unwrap_or_default();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ impl SpawnSubagentTool {
if prompt.is_empty() {
return Ok(ToolResult::error("spawn_subagent: `prompt` is required"));
}
let registry = match AgentDefinitionRegistry::global() {
let registry = match AgentDefinitionRegistry::current() {
Some(reg) => reg,
None => {
return Ok(ToolResult::error(
Expand Down
Loading
Loading