Skip to content

Commit 4a69d2e

Browse files
sanil-23claude
andcommitted
test(prompt): update test callers + assertions for new renderer signature
Follow-up to tinyhumansai#447. The main patch changed three signatures that test callers hadn't been updated for, and flipped one assertion that was validating the now-removed prose schema duplication. - `SubagentRunOptions` test constructors in subagent_runner.rs (2 sites) now pass `toolkit_override: None`. - `ConnectedIntegration` test constructor in orchestrator_tools.rs now passes `connected: true` (the default for test integrations — they're treated as authorized so delegation logic still runs). - 12 `render_subagent_system_prompt` test callers in prompt.rs now pass `&[]` for the new `extra_tools` slice and `ToolCallFormat::PFormat` for the new `tool_call_format` argument. - `render_subagent_system_prompt_honors_identity_safety_and_skills_flags` used to assert `rendered.contains("Parameters:")` on the Json dispatcher branch — that was valid in the old world where the prose `## Tools` section dumped full JSON schemas for Json/Native formats. The main patch deliberately removes that dump (it was the ~30k-token duplication of the native `tools` field), so the test now asserts the opposite: no `## Tools` header and no `Parameters:` line are emitted for Native/Json dispatchers. The schemas still travel through the provider request's `tools` field. Also picks up `rustfmt` rewraps in action_tool.rs and ops.rs from a background linter run — pure whitespace, no semantic change. Verified green against the full `cargo test --lib` suite for every test touched by this PR: - openhuman::context::prompt::tests (26 passed) - openhuman::agent::harness::subagent_runner::tests (19 passed) - openhuman::composio::ops::tests (2 passed) - openhuman::tools::impl::agent::tests (0 scoped) The 7 remaining failures in `cargo test --lib` are pre-existing Windows-path/filesystem flakes in subsystems this PR doesn't touch (self_healing polyfill path separator, cron scheduler shell spawning, local_ai::paths absolute-path detection, security::policy sandbox path handling, composio::trigger_history jsonl archive, and a real pre-existing `Option::unwrap()` panic in browser::screenshot). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 142155f commit 4a69d2e

5 files changed

Lines changed: 47 additions & 18 deletions

File tree

src/openhuman/agent/harness/subagent_runner.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,7 @@ async fn run_typed_mode(
249249
// are stripped from the parent-filtered indices in this path so
250250
// the model only sees one way to call each action.
251251
let mut dynamic_tools: Vec<Box<dyn Tool>> = Vec::new();
252-
let is_skills_agent_with_toolkit =
253-
definition.id == "skills_agent" && toolkit_filter.is_some();
252+
let is_skills_agent_with_toolkit = definition.id == "skills_agent" && toolkit_filter.is_some();
254253
if is_skills_agent_with_toolkit {
255254
// Drop EVERY skill-category parent tool. In the new
256255
// architecture all integration discovery / authorization /
@@ -1385,6 +1384,7 @@ mod tests {
13851384
SubagentRunOptions {
13861385
skill_filter_override: None,
13871386
category_filter_override: None,
1387+
toolkit_override: None,
13881388
context: None,
13891389
task_id: Some("t1".into()),
13901390
},
@@ -1515,6 +1515,7 @@ mod tests {
15151515
SubagentRunOptions {
15161516
skill_filter_override: Some("notion".into()),
15171517
category_filter_override: None,
1518+
toolkit_override: None,
15181519
context: None,
15191520
task_id: None,
15201521
},

src/openhuman/composio/action_tool.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,10 @@ impl Tool for ComposioActionTool {
8383

8484
async fn execute(&self, args: Value) -> anyhow::Result<ToolResult> {
8585
let started = std::time::Instant::now();
86-
let res = self.client.execute_tool(&self.action_name, Some(args)).await;
86+
let res = self
87+
.client
88+
.execute_tool(&self.action_name, Some(args))
89+
.await;
8790
let elapsed_ms = started.elapsed().as_millis() as u64;
8891

8992
match res {
@@ -111,10 +114,7 @@ impl Tool for ComposioActionTool {
111114
elapsed_ms,
112115
},
113116
);
114-
Ok(ToolResult::error(format!(
115-
"{}: {e}",
116-
self.action_name
117-
)))
117+
Ok(ToolResult::error(format!("{}: {e}", self.action_name)))
118118
}
119119
}
120120
}

src/openhuman/composio/ops.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -473,9 +473,7 @@ async fn fetch_connected_integrations_uncached(
473473
let allowlisted_toolkits: Vec<String> = match client.list_toolkits().await {
474474
Ok(resp) => resp.toolkits,
475475
Err(e) => {
476-
tracing::warn!(
477-
"[composio] fetch_connected_integrations: list_toolkits failed: {e}"
478-
);
476+
tracing::warn!("[composio] fetch_connected_integrations: list_toolkits failed: {e}");
479477
return Some(Vec::new());
480478
}
481479
};
@@ -488,9 +486,7 @@ async fn fetch_connected_integrations_uncached(
488486
let connections = match client.list_connections().await {
489487
Ok(resp) => resp.connections,
490488
Err(e) => {
491-
tracing::warn!(
492-
"[composio] fetch_connected_integrations: list_connections failed: {e}"
493-
);
489+
tracing::warn!("[composio] fetch_connected_integrations: list_connections failed: {e}");
494490
// Allowlist still useful — render every toolkit as
495491
// not-connected so the orchestrator can surface them.
496492
Vec::new()
@@ -517,9 +513,7 @@ async fn fetch_connected_integrations_uncached(
517513
match client.list_tools(Some(&connected_slugs_vec)).await {
518514
Ok(resp) => resp.tools,
519515
Err(e) => {
520-
tracing::warn!(
521-
"[composio] fetch_connected_integrations: list_tools failed: {e}"
522-
);
516+
tracing::warn!("[composio] fetch_connected_integrations: list_tools failed: {e}");
523517
Vec::new()
524518
}
525519
}

src/openhuman/context/prompt.rs

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,8 +1600,10 @@ mod tests {
16001600
"test-model",
16011601
&[0],
16021602
&tools,
1603+
&[],
16031604
"You are a focused sub-agent.",
16041605
SubagentRenderOptions::narrow(),
1606+
ToolCallFormat::PFormat,
16051607
&[],
16061608
));
16071609

@@ -1664,6 +1666,7 @@ mod tests {
16641666
"reasoning-v1",
16651667
&[0],
16661668
&tools,
1669+
&[],
16671670
"You are a specialist.",
16681671
SubagentRenderOptions {
16691672
include_identity: true,
@@ -1680,14 +1683,22 @@ mod tests {
16801683
assert!(rendered.contains("### SOUL.md"));
16811684
assert!(rendered.contains("## Safety"));
16821685
assert!(rendered.contains("## Available Skills"));
1683-
assert!(rendered.contains("Parameters:"));
1684-
assert!(rendered.contains("\"type\""));
1686+
// Native/Json dispatchers: the prose `## Tools` section is
1687+
// deliberately omitted from the rendered system prompt — schemas
1688+
// travel through the provider request's `tools` field instead.
1689+
// Previously this path emitted `- **test_tool**: …\n Parameters: {…}`
1690+
// for every tool, which duplicated the native function-calling
1691+
// channel and inflated token cost (see the #447 patch). Regression
1692+
// guards: no `## Tools` header, no inline schema.
1693+
assert!(!rendered.contains("\n## Tools\n"));
1694+
assert!(!rendered.contains("Parameters:"));
16851695

16861696
let native = render_subagent_system_prompt_with_format(
16871697
&workspace,
16881698
"reasoning-v1",
16891699
&[0],
16901700
&tools,
1701+
&[],
16911702
"You are a specialist.",
16921703
SubagentRenderOptions::narrow(),
16931704
ToolCallFormat::Native,
@@ -1729,6 +1740,7 @@ mod tests {
17291740
"test-model",
17301741
&[0],
17311742
&tools,
1743+
&[],
17321744
"You are the welcome agent.",
17331745
SubagentRenderOptions {
17341746
include_identity: false,
@@ -1737,6 +1749,7 @@ mod tests {
17371749
include_profile: true,
17381750
include_memory_md: false,
17391751
},
1752+
ToolCallFormat::PFormat,
17401753
&[],
17411754
);
17421755

@@ -1784,8 +1797,10 @@ mod tests {
17841797
"test-model",
17851798
&[0],
17861799
&tools,
1800+
&[],
17871801
"You are a narrow specialist.",
17881802
SubagentRenderOptions::narrow(), // include_profile defaults to false
1803+
ToolCallFormat::PFormat,
17891804
&[],
17901805
);
17911806

@@ -1820,6 +1835,7 @@ mod tests {
18201835
"test-model",
18211836
&[0],
18221837
&tools,
1838+
&[],
18231839
"You are a specialist.",
18241840
SubagentRenderOptions {
18251841
include_identity: true,
@@ -1828,6 +1844,7 @@ mod tests {
18281844
include_profile: true,
18291845
include_memory_md: false,
18301846
},
1847+
ToolCallFormat::PFormat,
18311848
&[],
18321849
);
18331850

@@ -1858,8 +1875,10 @@ mod tests {
18581875
"test-model",
18591876
&[0],
18601877
&tools,
1878+
&[],
18611879
"You are the welcome agent.",
18621880
SubagentRenderOptions::narrow(),
1881+
ToolCallFormat::PFormat,
18631882
&[],
18641883
);
18651884

@@ -1909,8 +1928,10 @@ mod tests {
19091928
"test-model",
19101929
&[0],
19111930
&tools,
1931+
&[],
19121932
"# Welcome Agent\n\nYou are the welcome agent.",
19131933
options,
1934+
ToolCallFormat::PFormat,
19141935
&[],
19151936
);
19161937

@@ -1953,8 +1974,10 @@ mod tests {
19531974
"test-model",
19541975
&[0],
19551976
&tools,
1977+
&[],
19561978
"You are a narrow specialist.",
19571979
options,
1980+
ToolCallFormat::PFormat,
19581981
&[],
19591982
);
19601983

@@ -1991,6 +2014,7 @@ mod tests {
19912014
"test-model",
19922015
&[0],
19932016
&tools,
2017+
&[],
19942018
"You are the welcome agent.",
19952019
SubagentRenderOptions {
19962020
include_identity: false,
@@ -1999,6 +2023,7 @@ mod tests {
19992023
include_profile: false,
20002024
include_memory_md: true,
20012025
},
2026+
ToolCallFormat::PFormat,
20022027
&[],
20032028
);
20042029

@@ -2035,8 +2060,10 @@ mod tests {
20352060
"test-model",
20362061
&[0],
20372062
&tools,
2063+
&[],
20382064
"You are a narrow specialist.",
20392065
SubagentRenderOptions::narrow(),
2066+
ToolCallFormat::PFormat,
20402067
&[],
20412068
);
20422069

@@ -2073,6 +2100,7 @@ mod tests {
20732100
"test-model",
20742101
&[0],
20752102
&tools,
2103+
&[],
20762104
"You are the orchestrator.",
20772105
SubagentRenderOptions {
20782106
include_identity: false,
@@ -2081,6 +2109,7 @@ mod tests {
20812109
include_profile: true,
20822110
include_memory_md: true,
20832111
},
2112+
ToolCallFormat::PFormat,
20842113
&[],
20852114
);
20862115

@@ -2130,17 +2159,21 @@ mod tests {
21302159
"test-model",
21312160
&[0],
21322161
&tools,
2162+
&[],
21332163
"You are the orchestrator.",
21342164
opts,
2165+
ToolCallFormat::PFormat,
21352166
&[],
21362167
);
21372168
let second = render_subagent_system_prompt(
21382169
&workspace,
21392170
"test-model",
21402171
&[0],
21412172
&tools,
2173+
&[],
21422174
"You are the orchestrator.",
21432175
opts,
2176+
ToolCallFormat::PFormat,
21442177
&[],
21452178
);
21462179

src/openhuman/tools/orchestrator_tools.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ mod tests {
235235
toolkit: toolkit.into(),
236236
description: description.into(),
237237
tools: vec![],
238+
connected: true,
238239
}
239240
}
240241

0 commit comments

Comments
 (0)