mirror of
https://github.com/codewhale-hq/Codewhale.git
synced 2026-11-08 08:04:25 -10:00
test: drive the parallel cancellation witness through canonical read authority
The dc0 witness failed its first assertion (36 passed / 1 failed) because `registered_resource_claims` intentionally replaces a spec's own claims with the central authority's, and the custom `fixture_complete_then_cancel` name fell through to GlobalExclusive. That produced singleton chunks, so the two-tool parallel path was never exercised. Register the fixture under the canonical `read_file` identity with two existing, disjoint workspace paths. The unchanged central authority then grants two ReadPath claims and forms one real two-tool parallel chunk. Production admission and resource authority are unchanged, and no golden changed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: CodeWhale Bot <[email protected]>
This commit is contained in:
1 parent
dc0e0a134e
commit
1194d0ad22
1 file changed
+12
-13
@@ -628,8 +628,11 @@ async fn event_capacity_cancelled_parallel_tool_keeps_completed_span_and_call_wh
|
||||
}
|
||||
#[async_trait::async_trait]
|
||||
impl ToolSpec for CompleteThenCancel {
|
||||
// Registered under the canonical read identity so the engine's
|
||||
// central resource authority (not this fixture) grants the disjoint
|
||||
// ReadPath claims that form one real parallel chunk.
|
||||
fn name(&self) -> &str {
|
||||
"fixture_complete_then_cancel"
|
||||
"read_file"
|
||||
}
|
||||
fn description(&self) -> &str {
|
||||
"Finish an observed operation before firing its turn cancellation token."
|
||||
@@ -648,7 +651,7 @@ async fn event_capacity_cancelled_parallel_tool_keeps_completed_span_and_call_wh
|
||||
input: Value,
|
||||
context: &ToolContext,
|
||||
) -> Result<PreparedToolCall, ToolError> {
|
||||
let resource = input["resource"].as_str().expect("fixture resource");
|
||||
let path = input["path"].as_str().expect("fixture path");
|
||||
Ok(PreparedToolCall {
|
||||
name: self.name().to_string(),
|
||||
description: self.description().to_string(),
|
||||
@@ -656,7 +659,8 @@ async fn event_capacity_cancelled_parallel_tool_keeps_completed_span_and_call_wh
|
||||
supports_parallel: true,
|
||||
starts_detached: false,
|
||||
approval: ApprovalRequirement::Auto,
|
||||
resources: vec![ResourceClaim::ReadPath(context.workspace.join(resource))],
|
||||
// Replaced by `registered_resource_claims`; kept honest anyway.
|
||||
resources: vec![ResourceClaim::ReadPath(context.workspace.join(path))],
|
||||
input,
|
||||
})
|
||||
}
|
||||
@@ -676,18 +680,13 @@ async fn event_capacity_cancelled_parallel_tool_keeps_completed_span_and_call_wh
|
||||
|
||||
for fill_queue in [false, true] {
|
||||
let workspace = tempdir().unwrap();
|
||||
for path in ["one", "two"] {
|
||||
std::fs::write(workspace.path().join(path), path).unwrap();
|
||||
}
|
||||
let mock = Arc::new(MockLlmClient::new(vec![
|
||||
tool_batch_turn(&[
|
||||
(
|
||||
"one",
|
||||
"fixture_complete_then_cancel",
|
||||
r#"{"resource":"one"}"#,
|
||||
),
|
||||
(
|
||||
"two",
|
||||
"fixture_complete_then_cancel",
|
||||
r#"{"resource":"two"}"#,
|
||||
),
|
||||
("one", "read_file", r#"{"path":"one"}"#),
|
||||
("two", "read_file", r#"{"path":"two"}"#),
|
||||
]),
|
||||
canned::simple_text_turn("must not run after cancellation"),
|
||||
]));
|
||||
|
||||
Reference in new issue
Block a user