Skip to content

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

refactor(orchestrator): drop per-row intent text from withheld specialists

Steven Enamakela534934a40b8
diff --git a/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt.rs b/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt.rs
index 4b56831cab..ab0002fc1a 100644
--- a/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt.rs
+++ b/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt.rs
@@ -143,7 +143,7 @@ fn render_withheld_specialists(ctx: &PromptContext<'_>) -> String {
return String::new();
};
- let mut rows: Vec<(String, String, &'static str)> = Vec::new();
+ let mut rows: Vec<(String, &'static str)> = Vec::new();
for entry in &definition.subagents {
// `Skills(_)` expands to `delegate_to_integrations_agent`, which the
// `## Connected Integrations` block below documents in full.
@@ -170,7 +170,7 @@ fn render_withheld_specialists(ctx: &PromptContext<'_>) -> String {
// belt never listed it, so there is no route to describe.
continue;
};
- rows.push((tool_name, first_sentence(&target.when_to_use), pack.id));
+ rows.push((tool_name, pack.id));
}
if rows.is_empty() {
@@ -192,7 +192,7 @@ fn render_withheld_specialists(ctx: &PromptContext<'_>) -> String {
// full `when_to_use` arrives with the schema once the pack is loaded.
let mut by_pack: std::collections::BTreeMap<&'static str, Vec<String>> =
std::collections::BTreeMap::new();
- for (tool, _intent, pack) in rows {
+ for (tool, pack) in rows {
by_pack.entry(pack).or_default().push(format!("`{tool}`"));
}
let mut out = String::from(
@@ -307,56 +307,6 @@ fn resolve_definition<'r>(
registry.get(&best)
}
-/// The first sentence of `text`, or a hard-capped prefix when it has none.
-///
-/// `when_to_use` is written as a paragraph for the tool description; one
-/// sentence is the routing signal and the rest is detail the model only needs
-/// once it has loaded the schema.
-/// Longest routing intent a withheld-specialist row carries. One sentence is
-/// the signal; the full `when_to_use` is on the tool once it is loaded.
-const WITHHELD_INTENT_MAX_CHARS: usize = 64;
-
-fn first_sentence(text: &str) -> String {
- let text = text.trim();
- for (idx, _) in text.match_indices(". ") {
- // "…an ALREADY-CONNECTED MCP server (e.g. `gmail`)…" is one sentence.
- // An abbreviation carries a second period two bytes back, and a real
- // sentence boundary is followed by a capital; requiring both keeps the
- // row readable instead of cutting it mid-parenthetical.
- let is_abbreviation = text[..idx].ends_with('.') || text[..idx].ends_with(". ");
- let starts_new = text[idx + 2..]
- .chars()
- .next()
- .is_some_and(|c| c.is_uppercase());
- if !is_abbreviation && starts_new {
- let sentence = text[..=idx].trim_end();
- if sentence.chars().count() <= WITHHELD_INTENT_MAX_CHARS {
- return sentence.to_string();
- }
- break;
- }
- }
- if text.chars().count() <= WITHHELD_INTENT_MAX_CHARS {
- return text.to_string();
- }
- let cut: String = text.chars().take(WITHHELD_INTENT_MAX_CHARS).collect();
- // Cut at the last word boundary so the row never ends mid-word.
- let cut = match cut.rfind(' ') {
- Some(idx) if idx > WITHHELD_INTENT_MAX_CHARS / 2 => &cut[..idx],
- _ => cut.as_str(),
- };
- format!("{}...", cut.trim_end_matches([' ', ',', ';', ':', '-', '—']))
-}
-
-/// Render the `## Installed Skills` section listing locally installed
-/// workflows so the orchestrator knows what's available without calling
-/// `list_workflows` on every turn. Omitted when no skills are installed.
-///
-/// `run` and `install` are the hand-offs to `skill_executor` and `skill_setup`
-/// in the form this session can call ([`hand_off_route`]), or `None` when it has
-/// no route, in which case the section names none. This block once named five
-/// tools the model could not see; it names only what [`hand_off_route`] vouches
-/// for (#6302).
fn render_installed_skills(
skills: &[Workflow],
run: Option<&str>,
diff --git a/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt_tests_session_routing_tests.rs b/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt_tests_session_routing_tests.rs
index 2fa5e0e5d0..78c376fe91 100644
--- a/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt_tests_session_routing_tests.rs
+++ b/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt_tests_session_routing_tests.rs
@@ -64,40 +64,6 @@ fn the_withheld_block_renders_for_a_renamed_session_with_a_filter() {
);
}
-/// The row text must be one readable sentence, not a cut parenthetical.
-///
-/// `mcp_agent`'s `when_to_use` opens "…an ALREADY-CONNECTED MCP server (e.g.
-/// `gmail`)…", and a naive split on ". " ends the row at "(e.g." — which is
-/// what the first live capture rendered.
-#[test]
-fn a_row_is_not_cut_at_an_abbreviation() {
- assert_eq!(
- first_sentence("Calls tools on a connected server (e.g. gmail). Then reports back."),
- "Calls tools on a connected server (e.g. gmail).",
- );
- // A genuine boundary still ends the row.
- assert_eq!(
- first_sentence("Builds decks from evidence. Use for pitch-deck requests."),
- "Builds decks from evidence.",
- );
- // No boundary at all: capped at a word boundary, never mid-word.
- let long = "alpha ".repeat(200);
- let capped = first_sentence(&long);
- assert!(capped.ends_with("..."), "{capped}");
- assert!(capped.len() <= 90 + 3, "{capped}");
- assert!(!capped.contains("alph..."), "cut must land on a word boundary: {capped}");
- // A first sentence longer than the cap is capped the same way.
- let long_sentence = format!("{} end. Second sentence.", "word ".repeat(40));
- let capped = first_sentence(&long_sentence);
- assert!(capped.ends_with("..."), "{capped}");
- assert!(!capped.contains("Second"));
- // Short and unterminated: returned whole.
- assert_eq!(
- first_sentence("Runs installed agent skills"),
- "Runs installed agent skills"
- );
-}
-
/// The generated intro must not carry the source's line-continuation padding.
#[test]
fn the_generated_block_has_no_stray_whitespace_runs() {