Skip to content

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

fix(docs, tests): rename `_precondition` to `precondition` and add SSE readiness check

Steven Enamakel31b568e37c2c
diff --git a/docs/prompt-evals.md b/docs/prompt-evals.md
index 56ada00c4b..c7cfc0e6d5 100644
--- a/docs/prompt-evals.md
+++ b/docs/prompt-evals.md
@@ -137,7 +137,7 @@ scoring proves too coarse.
Prefer read-only cases. Against a real account every write is cleanup that
someone does by hand, so a case that must write lists what it leaves behind
in its `writes` field. Cases that depend on account state carry a
-`_precondition`, for example that Gmail is connected, the Notion skill is
+`precondition`, for example that Gmail is connected, the Notion skill is
installed, or no MCP server exists. Re-verify those before a run: the account
changes, and a case whose precondition no longer holds measures something
else. `mcp-none-configured` is an error-path case by design. Do not install an
@@ -146,12 +146,13 @@ MCP server to make MCP "testable"; that changes the baseline being measured.
Cases run in file order, by increasing account risk. Cases that touch
nothing run first, because they also validate the rig on real inference; the
only writing case (`orchestrator-reminder`) runs last.
-**`composio-gmail-read` is gated.** The toolkit-scoped `integrations_agent`
+**`composio-gmail-read` is disabled by default.** The toolkit-scoped `integrations_agent`
runs in text mode, so its calls may not reach `calls` in the same shape as
native tool calls. Until a real transcript has shown one landing in a form its
`GMAIL_*` forbids match, those forbids are unproven. They would fail to notice
a send, not prevent it. Run the earlier cases, inspect a real `calls` field,
-and only then run it. Do not repair the matcher mid-run.
+and only then run it. Do not repair the matcher mid-run. The runner skips this
+case unless `--allow-disabled` is explicitly supplied after matcher validation.
Each case with account preconditions checks them with a read-only RPC just
before every run (`precondition` in `cases.json`: gmail connected, notion skill
@@ -168,6 +169,6 @@ a forbidden packed tool is caught either way.
Add an object to `cases` in `scripts/prompt-eval/cases.json`: `id`, `entry`
(`flows_build` or `agent_chat`), `message`, `expect_calls`, `forbid_calls`,
`max_consecutive` (`{tool: cap}`), `max_input_tokens`, `judge`, optional
-`reply_regex`, `surface`, `writes`, `_precondition`, and a `_why` naming the
+`reply_regex`, `surface`, `writes`, `precondition`, and a `_why` naming the
failure it guards against. Keep the set small; every case costs
money on every run.
diff --git a/tests/agent_prompt_comprehension_e2e.rs b/tests/agent_prompt_comprehension_e2e.rs
index ff7d32f6a9..2ebe47e95f 100644
--- a/tests/agent_prompt_comprehension_e2e.rs
+++ b/tests/agent_prompt_comprehension_e2e.rs
@@ -391,8 +391,14 @@ compaction_enabled = false
toml::from_str(&cfg).expect("config toml must match Config schema");
}
-fn spawn_sse_collector(events_url: String) -> tokio::sync::mpsc::UnboundedReceiver<Value> {
+fn spawn_sse_collector(
+ events_url: String,
+) -> (
+ tokio::sync::mpsc::UnboundedReceiver<Value>,
+ tokio::sync::oneshot::Receiver<()>,
+) {
let (tx, rx) = tokio::sync::mpsc::unbounded_channel();
+ let (ready_tx, ready_rx) = tokio::sync::oneshot::channel();
tokio::spawn(async move {
let client = reqwest::Client::builder()
.timeout(Duration::from_secs(300))
@@ -404,6 +410,8 @@ fn spawn_sse_collector(events_url: String) -> tokio::sync::mpsc::UnboundedReceiv
.send()
.await
.unwrap_or_else(|e| panic!("GET {events_url}: {e}"));
+ assert!(resp.status().is_success(), "GET {events_url}: {}", resp.status());
+ let _ = ready_tx.send(());
let mut stream = resp.bytes_stream();
let mut buffer: Vec<u8> = Vec::new();
while let Some(Ok(chunk)) = stream.next().await {
@@ -423,7 +431,14 @@ fn spawn_sse_collector(events_url: String) -> tokio::sync::mpsc::UnboundedReceiv
}
}
});
- rx
+ (rx, ready_rx)
+}
+
+async fn wait_for_sse_ready(ready: tokio::sync::oneshot::Receiver<()>) {
+ tokio::time::timeout(Duration::from_secs(10), ready)
+ .await
+ .expect("timed out waiting for SSE subscription")
+ .expect("SSE collector exited before subscription was ready");
}
async fn wait_for_terminal(rx: &mut tokio::sync::mpsc::UnboundedReceiver<Value>) -> Value {
@@ -619,8 +634,9 @@ async fn run_case_inner(case: Case) {
match case.entry {
Entry::WebChat => {
let client_id = format!("prompt-{}", case.agent);
- let mut events =
+ let (mut events, ready) =
spawn_sse_collector(format!("{}/events?client_id={client_id}", stack.rpc_base));
+ wait_for_sse_ready(ready).await;
let resp = post_json_rpc(
&stack.rpc_base,
10,
@@ -967,8 +983,9 @@ fn orchestrator_prompt_names_only_discoverable_delegates() {
reset_script(vec![text_completion("Hello.")]);
let stack = boot_stack("").await;
let client_id = "prompt-discoverable";
- let mut events =
+ let (mut events, ready) =
spawn_sse_collector(format!("{}/events?client_id={client_id}", stack.rpc_base));
+ wait_for_sse_ready(ready).await;
let resp = post_json_rpc(
&stack.rpc_base,
10,