Skip to content

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

chore: files changed src/openhuman/tools/orchestrator_tools.rs

Steven Enamakel7267ad60fa97
diff --git a/src/openhuman/tools/orchestrator_tools.rs b/src/openhuman/tools/orchestrator_tools.rs
index a7eadd36d9..f10f081673 100644
--- a/src/openhuman/tools/orchestrator_tools.rs
+++ b/src/openhuman/tools/orchestrator_tools.rs
@@ -205,6 +205,28 @@ pub fn collect_orchestrator_tools(
};
connected.push((slug, description));
}
+ // Order the enum by slug, because the order it arrives in is
+ // not a contract and the order it is *advertised* in is.
+ //
+ // This tool's schema and description both enumerate the
+ // toolkits, and the tool block is rendered ahead of the
+ // conversation in every provider's cached prefix — so a
+ // backend that returns the same integrations in a different
+ // order would otherwise re-write the schema, and with it
+ // invalidate the whole prefix including the system prompt the
+ // turn loop freezes for exactly that reason. The rest of the
+ // pipeline already treats order as meaningless:
+ // `connected_set_hash` sorts before hashing, which is what
+ // stops a reordering from reaching a reconcile at the turn
+ // boundary in the first place. Sorting here makes the
+ // advertised surface agree with that view instead of
+ // contradicting it a layer down.
+ //
+ // Sorting AFTER the dedup loop, never before: the collision
+ // rule above is "the first arrival keeps the slug", which is a
+ // statement about arrival order and would change meaning if the
+ // list were sorted first.
+ connected.sort_by(|(a, _), (b, _)| a.cmp(b));
match SkillDelegationTool::for_connected(connected) {
Some(tool) => {
log::debug!(