mirror of
https://github.com/instructkr/claw-code.git
synced 2026-05-18 21:41:26 +08:00
omx(team): auto-checkpoint worker-1 [1]
This commit is contained in:
@@ -6212,6 +6212,8 @@ Command exceeded timeout of {timeout_ms} ms",
|
||||
stderr.trim_end()
|
||||
)
|
||||
};
|
||||
let is_test = is_test_command(command);
|
||||
let return_code_interpretation = if is_test { "test.hung" } else { "timeout" };
|
||||
return Ok(runtime::BashCommandOutput {
|
||||
stdout: String::from_utf8_lossy(&output.stdout).into_owned(),
|
||||
stderr,
|
||||
@@ -6222,9 +6224,11 @@ Command exceeded timeout of {timeout_ms} ms",
|
||||
backgrounded_by_user: None,
|
||||
assistant_auto_backgrounded: None,
|
||||
dangerously_disable_sandbox: None,
|
||||
return_code_interpretation: Some(String::from("timeout")),
|
||||
return_code_interpretation: Some(String::from(return_code_interpretation)),
|
||||
no_output_expected: Some(false),
|
||||
structured_content: None,
|
||||
structured_content: Some(vec![test_timeout_provenance(
|
||||
command, timeout_ms, is_test,
|
||||
)]),
|
||||
persisted_output_path: None,
|
||||
persisted_output_size: None,
|
||||
sandbox_status: None,
|
||||
@@ -6258,6 +6262,37 @@ Command exceeded timeout of {timeout_ms} ms",
|
||||
})
|
||||
}
|
||||
|
||||
fn is_test_command(command: &str) -> bool {
|
||||
let normalized = command
|
||||
.split_whitespace()
|
||||
.collect::<Vec<_>>()
|
||||
.join(" ")
|
||||
.to_ascii_lowercase();
|
||||
normalized.contains("cargo test")
|
||||
|| normalized.contains("cargo nextest")
|
||||
|| normalized.contains("npm test")
|
||||
|| normalized.contains("pnpm test")
|
||||
|| normalized.contains("yarn test")
|
||||
|| normalized.contains("pytest")
|
||||
}
|
||||
|
||||
fn test_timeout_provenance(
|
||||
command: &str,
|
||||
timeout_ms: u64,
|
||||
classified_as_test_hang: bool,
|
||||
) -> serde_json::Value {
|
||||
json!({
|
||||
"event": if classified_as_test_hang { "test.hung" } else { "command.timeout" },
|
||||
"failureClass": if classified_as_test_hang { "test_hang" } else { "timeout" },
|
||||
"data": {
|
||||
"command": command,
|
||||
"timeoutMs": timeout_ms,
|
||||
"provenance": "shell.timeout",
|
||||
"classification": if classified_as_test_hang { "test.hung" } else { "timeout" }
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fn resolve_cell_index(
|
||||
cells: &[serde_json::Value],
|
||||
cell_id: Option<&str>,
|
||||
|
||||
Reference in New Issue
Block a user