Skip to content

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

test(saas_mode): remove hang-after-tool mock behaviour

Steven Enamakel2f01074dd770
diff --git a/tests/saas_mode/mock_llm.rs b/tests/saas_mode/mock_llm.rs
index f6d0c729c1..72dacfd500 100644
--- a/tests/saas_mode/mock_llm.rs
+++ b/tests/saas_mode/mock_llm.rs
@@ -4,9 +4,7 @@
//! so a test can check which credential carried which content. Inference
//! (`…/chat/completions`) is answered from the last message:
//!
-//! - after a tool result: `TOOL-RESULT: <the tool's output>`, unless the user
-//! message holds [`HANG_AFTER_TOOL`]: then the follow-up request is held open
-//! like [`HANG`], so the turn stays in flight after its tool call ran;
+//! - after a tool result: `TOOL-RESULT: <the tool's output>`;
//! - a user message containing [`HANG`]: the request is held open until the
//! peer goes away, so the turn stays in flight until it is cancelled;
//! - a user message containing `PROBE-TOOL <name> <json args>`: one call to
@@ -28,9 +26,6 @@ use serde_json::{json, Value};
pub const HANG: &str = "HANG-TURN";
/// Marks a user message whose turn calls a tool: `PROBE-TOOL <name> <json>`.
pub const PROBE: &str = "PROBE-TOOL";
-/// Marks a user message whose turn, once its tool call has run, must stay in
-/// flight: put it on a line after the [`PROBE`] line.
-pub const HANG_AFTER_TOOL: &str = "HANG-AFTER-TOOL";
/// One request the backend received.
#[derive(Debug, Clone)]
@@ -197,21 +192,18 @@ pub fn content_text(message: &Value) -> String {
fn reply_for(request: &Value) -> Reply {
let messages = request["messages"].as_array().cloned().unwrap_or_default();
let agent_turn = request["tools"].as_array().is_some_and(|t| !t.is_empty());
- let text = messages
- .iter()
- .rev()
- .find(|m| m["role"] == "user")
- .map(content_text)
- .unwrap_or_default();
if let Some(last) = messages.last() {
if last["role"] == "tool" {
- if agent_turn && text.contains(HANG_AFTER_TOOL) {
- return Reply::Hang;
- }
let output: String = content_text(last).chars().take(4000).collect();
return Reply::Text(format!("TOOL-RESULT: {output}"));
}
}
+ let text = messages
+ .iter()
+ .rev()
+ .find(|m| m["role"] == "user")
+ .map(content_text)
+ .unwrap_or_default();
if agent_turn && text.contains(HANG) {
return Reply::Hang;
}