Skip to content

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

fix(agent): honor iteration overrides and permanent host tools

Toyo Sagaa2d072253af9
diff --git a/crates/openhuman-core/src/agent/bus.rs b/crates/openhuman-core/src/agent/bus.rs
index 5e876fae8d..9b06689134 100644
--- a/crates/openhuman-core/src/agent/bus.rs
+++ b/crates/openhuman-core/src/agent/bus.rs
@@ -351,7 +351,9 @@ async fn handle_agent_run_turn_on_large_stack(
let (tx, rx) = tokio::sync::oneshot::channel();
let handle = std::thread::Builder::new()
.name("agent-run-turn-test".to_string())
- .stack_size(8 * 1024 * 1024)
+ // Match the CI test runtime's stack: LLVM instrumentation expands
+ // this full-pipeline future beyond the production worker's stack.
+ .stack_size(64 * 1024 * 1024)
.spawn(move || {
let runtime = tokio::runtime::Builder::new_current_thread()
.enable_all()
diff --git a/crates/openhuman-core/src/agent/session_host/builder/factory.rs b/crates/openhuman-core/src/agent/session_host/builder/factory.rs
index 7da78dc445..bf602692ec 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/factory.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/factory.rs
@@ -751,30 +751,10 @@ impl OpenHumanSessionHost {
// `agent_harness_e2e` mock now serves SSE for streaming, so the crate-native
// streaming path is exercised end-to-end.
//
- // Issue #4868 — resolve the per-agent iteration cap. When a named
- // definition is present, its `effective_max_iterations()` (which honors
- // `iteration_policy = "extended"` -> 50, and the declared `max_iterations`
- // for strict agents) takes priority over the global
- // `config.agent.max_tool_iterations` (default 10). This is the single
- // shared resolution point that closes #4868 for every direct-invocation
- // path: flows_build, flows_discover, agent-node runtime, cron, MCP
- // server, etc. Falls back to the global default when there is no
- // definition for this agent_id.
+ // Resolve explicit overrides before the agent definition's default.
let mut effective_agent_config = config.agent.clone();
- if let Some(def) = target_def {
- let def_cap = def.effective_max_iterations();
- log::info!(
- "[agent::builder] applying definition iteration cap for agent_id={}: \
- definition.max_iterations={} iteration_policy={:?} -> effective={} \
- (was global default {})",
- agent_id,
- def.max_iterations,
- def.iteration_policy,
- def_cap,
- config.agent.max_tool_iterations,
- );
- effective_agent_config.max_tool_iterations = def_cap;
- }
+ effective_agent_config.max_tool_iterations =
+ super::iteration_cap::resolve_max_tool_iterations(&config.agent, target_def);
// Host-first, so a host tool wins a name collision -- see
// `HostTurnTools::merge_into`, which owns that rule and why.
let merged_host_tools = super::host_tools::merge_for_turn(
@@ -845,7 +825,14 @@ impl OpenHumanSessionHost {
// names no registry holds; without handing the definition over
// here the lookup misses and the turn is rejected as a policy
// failure before any provider call (#6404/#6392/#6393).
- session_definition: target_def.cloned().map(Arc::new),
+ session_definition: target_def.cloned().map(|mut definition| {
+ // Explicit host attachments belong to this session's belt,
+ // including when the definition uses a named tool scope.
+ definition
+ .extra_tools
+ .extend(agent.permanent_tool_names.iter().cloned());
+ Arc::new(definition)
+ }),
})
});
if agent.hosted_base.is_none() {
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 e1b7de0eba..56172cf4a1 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session.rs
@@ -416,31 +416,14 @@ impl OpenHumanTurnPrelude {
synthesized_names.clone(),
);
let auto_include_new_synthesized_tools = surface.auto_include_new_synthesized_tools;
- let agent_definition_name = surface.agent_definition_name.clone();
reconcile_synthesized_visibility(
&mut surface.visible_tool_names,
&previous_synthesized,
&synthesized_names,
auto_include_new_synthesized_tools,
);
- crate::tools::toolpacks::strip_packed_from_visible(
- &mut surface.visible_tool_names,
- &agent_definition_name,
- );
- // Same split as the session host's `recompute_deferred_tool_names`:
- // a `Deferred` synthesised tool leaves the wire and joins the
- // searchable set, on a belt that opted into discovery.
- if surface.discovery_enabled {
- let deferred = crate::tools::implementations::meta::deferred_set(
- surface.tools.as_slice(),
- synthesized.as_slice(),
- &surface.requested_deferred_tools,
- );
- surface
- .visible_tool_names
- .retain(|name| !deferred.contains(name));
- surface.deferred_tool_names = deferred;
- }
+ // Preserve permanently attached tools when re-deriving the surface.
+ permanent::refresh_visibility(&mut surface, &synthesized);
let specs = surface
.durable_tool_specs
diff --git a/docs/JAPANESE-UI-VALIDATION.md b/docs/JAPANESE-UI-VALIDATION.md
index a52b894271..6c03652dd0 100644
--- a/docs/JAPANESE-UI-VALIDATION.md
+++ b/docs/JAPANESE-UI-VALIDATION.md
@@ -5,7 +5,8 @@ Validation performed on 2026-10-04, then repeated after merging upstream
lifecycle strings at `c261b29e6ac5eabb00c84fb7d87554632d0982d7`.
The final locale has 4,541 keys, with no missing or extra keys and no English
leak findings. The repeat native build and standalone remote Core use that
-application source; follow-up lockfile/documentation changes do not alter it.
+application source. Later CI repairs also change Core behavior as described
+below; the native observations above belong to the recorded application revision.
The remote Core binary's SHA-256 matched the local build:
`fe82c895bb33d3e6b595345ee6c7284c0217a164c8b4ff48b4442c5d0466b6fb`.
@@ -100,3 +101,38 @@ a revised user-origin check, and two existing memory task-local accesses; no
Core implementation or checker rule was changed. The ignored-test caps were
tightened from 17 to 8 for Core and 15 to 14 for the top-level tests because
upstream removed their old ignored tests. Both exact-inventory guards passed.
+
+## Repairs for the latest upstream CI failures
+
+The hosted run on `8fae68aa6156457ec440ac5e373b3452566f194f` passed
+frontend/static, Rust lint and Tauri, but failed seven Core coverage suites.
+The following repairs preserve the original test assertions:
+
+- Install the pinned pnpm workspace dependencies in the independent Rust
+ coverage job. Its Memory integration fixture imports `ws`; without the
+ install, the backend exits before its health endpoint starts.
+- Update the Memory RPC catalogue and reachability tests to the current
+ controller contract; explicitly assert that retired read methods are unknown.
+- Give vision-delegation fixtures an actual inline PNG, as required by the
+ production dispatcher. Request-count and child-response assertions remain.
+- Point the Composio fixture at the resolved workspace directory and continue
+ checking that its scope file exists.
+- Align the test-only agent handler's stack with CI's 64 MiB test stack;
+ its instrumented Discord full-pipeline test overflowed at both 8 and 16 MiB.
+- Wire the existing iteration-cap resolver into the factory so explicit
+ overrides are honored. Both cap-reporting/error integration tests pass.
+- Preserve permanent attachments during tool-surface refresh and add their
+ names to the session definition's extra tool scope. This fixes their omission
+ from the native provider wire for named scopes. All three attached-tool
+ integration tests pass, including clones and session resume.
+
+These repairs were verified in an isolated x86_64 Ubuntu 22.04 container on
+an Apple Silicon Mac Studio using the exact hosted CI image digest
+`sha256:c3c20d625bcc9f75e50c3c2c2b75c88d3e60a3f4352b0f19f5327b490438722d`.
+The VM has no host mounts and the container has no published ports or production
+credentials. Node 24.21.0, pnpm 10.10.0 and Rust 1.96.1 were used. The complete
+Node script suite passes (471 passed, one existing skip), as do the targeted
+Memory, Composio, delegation, attached-tools and Discord coverage tests.
+MacBook Core/CLI/Tauri Clippy passes with warnings denied. Full Rust coverage
+and the new GitHub run are being checked separately; targeted passes do not
+establish a green final CI gate.