Skip to content

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

refactor(agent): simplify turn origin lookup

Steven Enamakela660fdf9f262
diff --git a/crates/openhuman-core/src/agent/turn_origin.rs b/crates/openhuman-core/src/agent/turn_origin.rs
index 52928cec30..f6a76d5bd2 100644
--- a/crates/openhuman-core/src/agent/turn_origin.rs
+++ b/crates/openhuman-core/src/agent/turn_origin.rs
@@ -221,8 +221,8 @@ async fn scope_origin<F: std::future::Future>(origin: AgentTurnOrigin, fut: F) -
/// (legacy callers that haven't been migrated yet — the gate maps this to
/// [`AgentTurnOrigin::Unknown`] / fail-closed).
pub fn current() -> Option<AgentTurnOrigin> {
- if crate::core::runtime::CoreContext::scoped().is_some()
- && let Some(origin) = crate::core::runtime::CoreContext::current_turn_origin()
+ if let Some(origin) = crate::core::runtime::CoreContext::scoped()
+ .and_then(|_| crate::core::runtime::CoreContext::current_turn_origin())
{
return Some(origin);
}
diff --git a/scripts/ci/agent-runtime-boundary-baseline.json b/scripts/ci/agent-runtime-boundary-baseline.json
index f72490f61c..772e1c2cb6 100644
--- a/scripts/ci/agent-runtime-boundary-baseline.json
+++ b/scripts/ci/agent-runtime-boundary-baseline.json
@@ -426,27 +426,6 @@
"text": "let (outcome, request_id) = crate::agent::turn_origin::with_origin(",
"occurrence": 1
},
- {
- "rule": "openhuman-task-local",
- "path": "crates/openhuman-core/src/channels/providers/relay/mod.rs",
- "line": 40,
- "text": "pub(crate) fn current_thread_id() -> Option<String> {",
- "occurrence": 1
- },
- {
- "rule": "openhuman-task-local",
- "path": "crates/openhuman-core/src/channels/runtime/dispatch/host_agent/turn.rs",
- "line": 71,
- "text": "let relay_thread = crate::channels::providers::relay::current_thread_id();",
- "occurrence": 1
- },
- {
- "rule": "openhuman-task-local",
- "path": "crates/openhuman-core/src/channels/runtime/dispatch/host_agent/turn.rs",
- "line": 91,
- "text": ".scope(crate::agent::turn_origin::with_origin(",
- "occurrence": 1
- },
{
"rule": "openhuman-task-local",
"path": "crates/openhuman-core/src/cron/origin.rs",