omx(team): auto-checkpoint worker-1 [1]

This commit is contained in:
bellman
2026-05-14 18:11:53 +09:00
parent 7214573f35
commit 0b0d55d7ec
5 changed files with 40 additions and 28 deletions

View File

@@ -212,8 +212,7 @@ fn summarize_messages(messages: &[ConversationMessage]) -> String {
.filter_map(|block| match block {
ContentBlock::ToolUse { name, .. } => Some(name.as_str()),
ContentBlock::ToolResult { tool_name, .. } => Some(tool_name.as_str()),
ContentBlock::Text { .. } => None,
ContentBlock::Thinking { .. } => None,
ContentBlock::Text { .. } | ContentBlock::Thinking { .. } => None,
})
.collect::<Vec<_>>();
tool_names.sort_unstable();

View File

@@ -344,7 +344,7 @@ fn glob_search_impl(
if let Some(root) = canonical_root.as_deref() {
let canonical_walk_root = walk_root
.canonicalize()
.unwrap_or_else(|_| walk_root.to_path_buf());
.unwrap_or_else(|_| walk_root.clone());
validate_workspace_boundary(&canonical_walk_root, root)?;
}
let entries = WalkDir::new(&walk_root)
@@ -484,27 +484,21 @@ fn grep_search_impl(
let (filenames, applied_limit, applied_offset) =
apply_limit(filenames, input.head_limit, input.offset);
let content_output = if output_mode == "content" {
let (lines, limit, offset) = apply_limit(content_lines, input.head_limit, input.offset);
return Ok(GrepSearchOutput {
mode: Some(output_mode),
num_files: filenames.len(),
if output_mode == "content" {
return Ok(build_grep_content_output(
output_mode,
filenames,
num_lines: Some(lines.len()),
content: Some(lines.join("\n")),
num_matches: None,
applied_limit: limit,
applied_offset: offset,
});
} else {
None
};
content_lines,
input.head_limit,
input.offset,
));
}
Ok(GrepSearchOutput {
mode: Some(output_mode.clone()),
num_files: filenames.len(),
filenames,
content: content_output,
content: None,
num_lines: None,
num_matches: (output_mode == "count").then_some(total_matches),
applied_limit,
@@ -512,6 +506,26 @@ fn grep_search_impl(
})
}
fn build_grep_content_output(
output_mode: String,
filenames: Vec<String>,
content_lines: Vec<String>,
head_limit: Option<usize>,
offset: Option<usize>,
) -> GrepSearchOutput {
let (lines, limit, offset) = apply_limit(content_lines, head_limit, offset);
GrepSearchOutput {
mode: Some(output_mode),
num_files: filenames.len(),
filenames,
num_lines: Some(lines.len()),
content: Some(lines.join("\n")),
num_matches: None,
applied_limit: limit,
applied_offset: offset,
}
}
fn canonicalize_workspace_root(workspace_root: &Path) -> PathBuf {
workspace_root
.canonicalize()

View File

@@ -2,7 +2,7 @@ use std::time::Duration;
pub type GreenLevel = u8;
const STALE_BRANCH_THRESHOLD: Duration = Duration::from_secs(60 * 60);
const STALE_BRANCH_THRESHOLD: Duration = Duration::from_hours(1);
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct PolicyRule {

View File

@@ -298,8 +298,7 @@ fn unshare_user_namespace_works() -> bool {
.stdout(std::process::Stdio::null())
.stderr(std::process::Stdio::null())
.status()
.map(|s| s.success())
.unwrap_or(false)
.is_ok_and(|status| status.success())
})
}

View File

@@ -22,7 +22,7 @@ fn stale_branch_detection_flows_into_policy_engine() {
let stale_context = LaneContext::new(
"stale-lane",
0,
Duration::from_secs(2 * 60 * 60), // 2 hours stale
Duration::from_hours(2), // 2 hours stale
LaneBlocker::None,
ReviewStatus::Pending,
DiffScope::Full,
@@ -49,7 +49,7 @@ fn fresh_branch_does_not_trigger_stale_policy() {
let fresh_context = LaneContext::new(
"fresh-lane",
0,
Duration::from_secs(30 * 60), // 30 min stale — under 1 hour threshold
Duration::from_mins(30), // 30 min stale — under 1 hour threshold
LaneBlocker::None,
ReviewStatus::Pending,
DiffScope::Full,
@@ -212,8 +212,8 @@ fn end_to_end_stale_lane_gets_merge_forward_action() {
// when: build context and evaluate policy
let context = LaneContext::new(
"lane-9411",
3, // Workspace green
Duration::from_secs(5 * 60 * 60), // 5 hours stale, definitely over threshold
3, // Workspace green
Duration::from_hours(5), // 5 hours stale, definitely over threshold
LaneBlocker::None,
ReviewStatus::Approved,
DiffScope::Scoped,
@@ -261,8 +261,8 @@ fn end_to_end_stale_lane_gets_merge_forward_action() {
fn fresh_approved_lane_gets_merge_action() {
let context = LaneContext::new(
"fresh-approved-lane",
3, // Workspace green
Duration::from_secs(30 * 60), // 30 min — under 1 hour threshold = fresh
3, // Workspace green
Duration::from_mins(30), // 30 min — under 1 hour threshold = fresh
LaneBlocker::None,
ReviewStatus::Approved,
DiffScope::Scoped,
@@ -347,7 +347,7 @@ fn worker_provider_failure_flows_through_recovery_to_policy() {
// (Simulating the policy check that would happen after successful recovery)
let recovery_success = matches!(result, RecoveryResult::Recovered { .. });
let green_level = 3; // Workspace green
let not_stale = Duration::from_secs(30 * 60); // 30 min — fresh
let not_stale = Duration::from_mins(30); // 30 min — fresh
let post_recovery_context = LaneContext::new(
"recovered-lane",