mirror of
https://github.com/codewhale-hq/Codewhale.git
synced 2026-11-07 17:09:13 -10:00
test(engine): let a start on a cancelled parent lose the race to its child
child_wall_time_is_unbounded_unless_an_owner_sets_it cancels the parent's token on purpose so no provider request runs. run_prepared_subagent_task selects on that token first, so a child that is polled before AgentTool start commits its launch exits and drops the receiver, and start reports "prepared child execution owner closed". That is the intended behavior for a cancelled parent, but the test unwrapped the result and failed whenever a yield let the child run first (blocked #7211, #7217, #7218, #7228, #7229 on ubuntu and windows). The test now retries that one error up to 50 times and fails on any other error. Verified: the test passed 25 of 25 consecutive runs after the change. It was not run in a loop before the change, so the prior rate is unmeasured here. No hosted CI. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
1 parent
85f26cba66
commit
13760312ee
1 file changed
+27
-15
@@ -353,21 +353,33 @@ async fn child_wall_time_is_unbounded_unless_an_owner_sets_it() {
|
||||
drop(guard);
|
||||
for owner_steps in [0, 7] {
|
||||
runtime.worker_profile.max_steps = owner_steps;
|
||||
let result = AgentTool::new(Arc::clone(&manager), runtime.clone())
|
||||
.execute(
|
||||
json!({
|
||||
"action": "start",
|
||||
"type": "explore",
|
||||
"prompt": "inspect",
|
||||
"max_steps": 1,
|
||||
"wall_time_secs": 1,
|
||||
"max_output_tokens": 1,
|
||||
"max_depth": 0
|
||||
}),
|
||||
&runtime.context,
|
||||
)
|
||||
.await
|
||||
.expect("legacy model caps cannot restrict the child");
|
||||
let args = json!({
|
||||
"action": "start",
|
||||
"type": "explore",
|
||||
"prompt": "inspect",
|
||||
"max_steps": 1,
|
||||
"wall_time_secs": 1,
|
||||
"max_output_tokens": 1,
|
||||
"max_depth": 0
|
||||
});
|
||||
let mut closed_before_commit = 0;
|
||||
let result = loop {
|
||||
match AgentTool::new(Arc::clone(&manager), runtime.clone())
|
||||
.execute(args.clone(), &runtime.context)
|
||||
.await
|
||||
{
|
||||
Ok(result) => break result,
|
||||
Err(error)
|
||||
if closed_before_commit < 50
|
||||
&& error
|
||||
.to_string()
|
||||
.contains("prepared child execution owner closed") =>
|
||||
{
|
||||
closed_before_commit += 1;
|
||||
}
|
||||
Err(error) => panic!("legacy model caps cannot restrict the child: {error}"),
|
||||
}
|
||||
};
|
||||
let receipt: Value = serde_json::from_str(&result.content).unwrap();
|
||||
assert_eq!(receipt["effective_limits"]["max_steps"], owner_steps);
|
||||
assert!(receipt["effective_limits"]["wall_deadline_ms"].is_null());
|
||||
|
||||
Reference in new issue
Block a user