Skip to content

An agent-managed museum exhibit, built in Rust with Gajae-Code / LazyCodex — developed and maintained with no human intervention.

Rust

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

bellman0b0d55d7ec40
diff --git a/rust/crates/runtime/src/compact.rs b/rust/crates/runtime/src/compact.rs
index e4fd3db0..7b0f5f95 100644
--- a/rust/crates/runtime/src/compact.rs
+++ b/rust/crates/runtime/src/compact.rs
@@ -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();
diff --git a/rust/crates/runtime/src/file_ops.rs b/rust/crates/runtime/src/file_ops.rs
index 1d1e29c3..aa7b5813 100644
--- a/rust/crates/runtime/src/file_ops.rs
+++ b/rust/crates/runtime/src/file_ops.rs
@@ -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()
diff --git a/rust/crates/runtime/src/policy_engine.rs b/rust/crates/runtime/src/policy_engine.rs
index 84912a67..0403853c 100644
--- a/rust/crates/runtime/src/policy_engine.rs
+++ b/rust/crates/runtime/src/policy_engine.rs
@@ -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 {
diff --git a/rust/crates/runtime/src/sandbox.rs b/rust/crates/runtime/src/sandbox.rs
index 45f118a9..2df08791 100644
--- a/rust/crates/runtime/src/sandbox.rs
+++ b/rust/crates/runtime/src/sandbox.rs
@@ -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())
})
}
diff --git a/rust/crates/runtime/tests/integration_tests.rs b/rust/crates/runtime/tests/integration_tests.rs
index cc7bd9c5..0bf1442d 100644
--- a/rust/crates/runtime/tests/integration_tests.rs
+++ b/rust/crates/runtime/tests/integration_tests.rs
@@ -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",