Skip to content

Commit a2c11e2

Browse files
stephentoubCopilot
andcommitted
Make Rust both-hooks E2E test tolerant of report_intent (1.0.64-0)
The 1.0.64-0 runtime removed report_intent, so the model's recorded report_intent call now resolves to "does not exist". That fires a preToolUse hook but no postToolUse hook, so the strict assert_eq!(pre.1, post.1) (first pre tool == first post tool) breaks because the first pre hook is report_intent while the first post hook is view. Collect all pre/post tool names and assert a tool appears in both, matching the tolerant assertion the Go reference test already uses. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent fd5d064 commit a2c11e2

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

rust/tests/e2e/hooks.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use std::collections::HashSet;
12
use std::sync::Arc;
23

34
use async_trait::async_trait;
@@ -122,7 +123,19 @@ async fn should_invoke_both_pretooluse_and_posttooluse_hooks_for_single_tool_cal
122123
let post = recv_with_timeout(&mut post_rx, "postToolUse hook").await;
123124
assert_eq!(pre.0, *session.id());
124125
assert_eq!(post.0, *session.id());
125-
assert_eq!(pre.1, post.1);
126+
127+
let mut pre_tools: HashSet<String> = HashSet::from([pre.1]);
128+
while let Ok((_, tool_name)) = pre_rx.try_recv() {
129+
pre_tools.insert(tool_name);
130+
}
131+
let mut post_tools: HashSet<String> = HashSet::from([post.1]);
132+
while let Ok((_, tool_name, _)) = post_rx.try_recv() {
133+
post_tools.insert(tool_name);
134+
}
135+
assert!(
136+
pre_tools.intersection(&post_tools).next().is_some(),
137+
"expected a tool to appear in both pre and post hooks, got pre={pre_tools:?} post={post_tools:?}"
138+
);
126139

127140
session.disconnect().await.expect("disconnect session");
128141
client.stop().await.expect("stop client");

0 commit comments

Comments
 (0)