Skip to content

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

docs(core): tighten approval event and sub-agent runner docs and lower the layout pins (#7032)

oxoxDev1e84148f3bcf
diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs
index 7f89843dc1..2593cc8d4c 100644
--- a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs
@@ -314,14 +314,8 @@ pub(crate) async fn run_subagent_direct(
return Err(SubagentRunError::HookDenied(reason));
}
- // Load the host config exactly once for this spawn and hand it to
- // everything below. See `LoadedConfig` — `load_or_init` re-reads
- // config.toml on every call, and the runtime below is slated to move
- // into TinyAgents, where there is no config file to load.
- //
- // Deliberately placed *after* `tier_gate_decision`: `load_or_init` can
- // initialize config on first run, and a spawn the tier gate rejects
- // should not have that side effect.
+ // Loaded once per spawn (see `LoadedConfig`), after the tier gate so a
+ // rejected spawn never initialises config on first run.
let loaded_config: LoadedConfig = Box::pin(crate::config::ops::load_current_or_init())
.await
.map(std::sync::Arc::new)
diff --git a/crates/openhuman-core/src/core/events.rs b/crates/openhuman-core/src/core/events.rs
index 36e4264407..edfe2e3608 100644
--- a/crates/openhuman-core/src/core/events.rs
+++ b/crates/openhuman-core/src/core/events.rs
@@ -531,15 +531,10 @@ pub enum DomainEvent {
},
// ── Approval ────────────────────────────────────────────────────────
- /// Agent attempted a tool call that produces an external side
- /// effect; awaiting user approval. Published by `ApprovalGate`
- /// before parking the tool-call future. Issue #1339.
- ///
- /// Note: this variant intentionally does not carry a `session_id`.
- /// Session provenance is internal to `ApprovalGate`; downstream
- /// surfaces (frontend approval card, audit log readers, web channel
- /// bridge) only need the request correlation id plus optional chat
- /// thread/client routing.
+ /// Agent attempted a tool call that produces an external side effect;
+ /// awaiting user approval. Published by `ApprovalGate` before parking the
+ /// tool-call future. Carries no `session_id`: consumers need only the
+ /// request id plus optional chat thread/client routing.
ApprovalRequested {
/// Unique id used to correlate the decision back to the
/// parked future.
@@ -570,8 +565,7 @@ pub enum DomainEvent {
/// expiry or the publish site hasn't been updated yet.
#[serde(default, skip_serializing_if = "Option::is_none")]
expires_at: Option<String>,
- /// The embedded agent whose turn parked this call. `None` for the
- /// process's own sessions.
+ /// The embedded agent whose turn parked this call, if any.
#[serde(default, skip_serializing_if = "Option::is_none")]
agent_id: Option<String>,
},
@@ -604,21 +598,16 @@ pub enum DomainEvent {
/// decision (approve or a deliberate deny).
#[serde(default, skip_serializing_if = "Option::is_none")]
resolution: Option<String>,
- /// The embedded agent the decided request belongs to, mirrored from
- /// `ApprovalRequested::agent_id`.
+ /// Mirrored from `ApprovalRequested::agent_id`.
#[serde(default, skip_serializing_if = "Option::is_none")]
agent_id: Option<String>,
},
- /// A `Workflow`-origin tool call parked in the `ApprovalGate` (issue
- /// flow-approval-surface, PR2/PR3). Unlike `ApprovalRequested`, this
- /// event carries no `thread_id`/`client_id` — a flow run has neither, so
- /// the generic chat-routed socket bridge
- /// (`web_chat::event_bus::ApprovalSurfaceSubscriber`)
- /// silently drops it (that gap was the original silent-deadlock bug).
- /// Published by `ApprovalGate::intercept_audited` alongside the existing
- /// `ApprovalRequested`, bridged by `openhuman_rpc::server::socketio` directly to a
- /// broadcast (not per-room) `flow_approval_request` Socket.IO event so
- /// the Workflows UI can surface and resolve the park without polling.
+ /// A `Workflow`-origin tool call parked in the `ApprovalGate`. It carries
+ /// no `thread_id`/`client_id` (a flow run has neither), so the chat-routed
+ /// `web_chat::event_bus::ApprovalSurfaceSubscriber` ignores it. Published
+ /// by `ApprovalGate::intercept_audited` alongside `ApprovalRequested` and
+ /// bridged by `openhuman_rpc::server::socketio` to a broadcast
+ /// `flow_approval_request` Socket.IO event for the Workflows UI.
FlowApprovalRequested {
/// Unique id used to correlate the decision back to the parked
/// future — pass to `approval_decide` unchanged.
diff --git a/crates/openhuman-core/src/core/events_tests.rs b/crates/openhuman-core/src/core/events_tests.rs
index aefefa9920..87845498e3 100644
--- a/crates/openhuman-core/src/core/events_tests.rs
+++ b/crates/openhuman-core/src/core/events_tests.rs
@@ -535,15 +535,8 @@ fn all_variants_have_correct_domain() {
}
}
-/// Regression guard. An earlier revision of
-/// [`DomainEvent::ApprovalRequested`] published a `session_id`
-/// field that historically carried the verbatim JSON-RPC bearer.
-/// Any downstream subscriber that Debug-printed the event (audit
-/// pipeline, `tracing` instrumentation, panic backtrace) leaked
-/// the credential. The field has been removed from the variant;
-/// this test fails loudly if it ever comes back, by name, via
-/// Debug — the bus does not derive `Serialize` so the audit-side
-/// risk lives entirely in the Debug surface.
+/// [`DomainEvent::ApprovalRequested`] must never carry a `session_id`, which
+/// could hold the JSON-RPC bearer and leak through any Debug print.
#[test]
fn approval_requested_does_not_surface_session_id() {
let event = DomainEvent::ApprovalRequested {
diff --git a/scripts/ci/check-openhuman-rust-layout.mjs b/scripts/ci/check-openhuman-rust-layout.mjs
index c28497b3e0..73b23eeac3 100644
--- a/scripts/ci/check-openhuman-rust-layout.mjs
+++ b/scripts/ci/check-openhuman-rust-layout.mjs
@@ -44,8 +44,8 @@ const LEGACY_LIMIT_ENTRIES = [
// state moved to tinyagents-runtime; this remaining composition is split in
// a follow-up without reintroducing an old harness/session exception.
["crates/openhuman-core/src/agent/session_host/builder/factory.rs", 986],
- ["crates/openhuman-core/src/agent/subagent_host/lifecycle.rs", 1309],
- ["crates/openhuman-core/src/agent/subagent_host/ops/runner.rs", 1152],
+ ["crates/openhuman-core/src/agent/subagent_host/lifecycle.rs", 1306],
+ ["crates/openhuman-core/src/agent/subagent_host/ops/runner.rs", 1148],
["crates/openhuman-core/src/tools/ops.rs", 1209],
["crates/openhuman-core/src/web_chat/progress_bridge.rs", 1304],
// These established external test modules grew with upstream coverage. Pin
@@ -55,7 +55,7 @@ const LEGACY_LIMIT_ENTRIES = [
["crates/openhuman-core/src/core/all.rs", 1492],
["crates/openhuman-core/src/core/all_tests.rs", 1632],
["crates/openhuman-core/src/core/events.rs", 1808],
- ["crates/openhuman-core/src/core/events_tests.rs", 1003],
+ ["crates/openhuman-core/src/core/events_tests.rs", 997],
["crates/openhuman-core/src/core/observability.rs", 3502],
["crates/openhuman-core/src/core/runtime/builder.rs", 813],
];