From 24d4fbb8a70492c6d6c7c4297424f7c152a36a51 Mon Sep 17 00:00:00 2001 From: Henry Park Date: Tue, 10 Mar 2026 11:57:50 -0700 Subject: [PATCH] Revert "Feat/docker shell edition" + fix fmt/clippy (#886) * Revert "Feat/docker shell edition (#804)" This reverts commit c566faf28fb77c2fa4df92c2947fb48f1a25df9b. * style: fix formatting issues from revert Run cargo fmt to fix formatting across 7 files after the revert of the docker shell edition feature. Co-Authored-By: Claude Opus 4.6 --------- Co-authored-by: Claude Opus 4.6 --- .github/workflows/code_style.yml | 2 - src/agent/commands.rs | 8 ++-- src/agent/compaction.rs | 4 +- src/agent/heartbeat.rs | 4 +- src/agent/routine_engine.rs | 5 ++- src/llm/reasoning.rs | 76 +++++++++++++++++++++++--------- src/tools/builder/core.rs | 8 ++-- src/worker/job.rs | 4 +- 8 files changed, 72 insertions(+), 39 deletions(-) diff --git a/.github/workflows/code_style.yml b/.github/workflows/code_style.yml index 45a624b8..620760ae 100644 --- a/.github/workflows/code_style.yml +++ b/.github/workflows/code_style.yml @@ -1,8 +1,6 @@ name: Code Style on: pull_request: - branches: - - main jobs: format: diff --git a/src/agent/commands.rs b/src/agent/commands.rs index 7c2394b5..90266d0b 100644 --- a/src/agent/commands.rs +++ b/src/agent/commands.rs @@ -405,8 +405,8 @@ impl Agent { .with_max_tokens(512) .with_temperature(0.3); - let reasoning = Reasoning::new(self.llm().clone()) - .with_model_name(self.llm().active_model_name()); + let reasoning = + Reasoning::new(self.llm().clone()).with_model_name(self.llm().active_model_name()); match reasoning.complete(request).await { Ok((text, _usage)) => Ok(SubmissionResult::response(format!( "Thread Summary:\n\n{}", @@ -454,8 +454,8 @@ impl Agent { .with_max_tokens(512) .with_temperature(0.5); - let reasoning = Reasoning::new(self.llm().clone()) - .with_model_name(self.llm().active_model_name()); + let reasoning = + Reasoning::new(self.llm().clone()).with_model_name(self.llm().active_model_name()); match reasoning.complete(request).await { Ok((text, _usage)) => Ok(SubmissionResult::response(format!( "Suggested Next Steps:\n\n{}", diff --git a/src/agent/compaction.rs b/src/agent/compaction.rs index 24dcda90..30bb2b6c 100644 --- a/src/agent/compaction.rs +++ b/src/agent/compaction.rs @@ -227,8 +227,8 @@ Be brief but capture all important details. Use bullet points."#, .with_max_tokens(1024) .with_temperature(0.3); - let reasoning = Reasoning::new(self.llm.clone()) - .with_model_name(self.llm.active_model_name()); + let reasoning = + Reasoning::new(self.llm.clone()).with_model_name(self.llm.active_model_name()); let (text, _) = reasoning.complete(request).await?; Ok(text) } diff --git a/src/agent/heartbeat.rs b/src/agent/heartbeat.rs index 09d9b181..4157be1b 100644 --- a/src/agent/heartbeat.rs +++ b/src/agent/heartbeat.rs @@ -303,8 +303,8 @@ impl HeartbeatRunner { .with_max_tokens(max_tokens) .with_temperature(0.3); - let reasoning = Reasoning::new(self.llm.clone()) - .with_model_name(self.llm.active_model_name()); + let reasoning = + Reasoning::new(self.llm.clone()).with_model_name(self.llm.active_model_name()); let (content, _usage) = match reasoning.complete(request).await { Ok(r) => r, Err(e) => return HeartbeatResult::Failed(format!("LLM call failed: {}", e)), diff --git a/src/agent/routine_engine.rs b/src/agent/routine_engine.rs index 1d8e7618..1bc16b95 100644 --- a/src/agent/routine_engine.rs +++ b/src/agent/routine_engine.rs @@ -219,7 +219,10 @@ impl RoutineEngine { let mut matched = true; for (key, expected) in filters { - let Some(actual) = payload.get(key).and_then(crate::agent::routine::json_value_as_filter_string) else { + let Some(actual) = payload + .get(key) + .and_then(crate::agent::routine::json_value_as_filter_string) + else { tracing::debug!(routine = %routine.name, filter_key = %key, "Filter key not found in payload"); matched = false; break; diff --git a/src/llm/reasoning.rs b/src/llm/reasoning.rs index 063fe466..3a654fed 100644 --- a/src/llm/reasoning.rs +++ b/src/llm/reasoning.rs @@ -2580,7 +2580,10 @@ That's my plan."#; // ... is closed — skipped. // second is unclosed — truncated here. let input = "Text before first and second"; - assert_eq!(truncate_at_tool_tags(input), "Text before first and "); + assert_eq!( + truncate_at_tool_tags(input), + "Text before first and " + ); } #[test] @@ -2658,7 +2661,10 @@ That's my plan."#; // preserving any text after the tag. let model_output = "Info here.\n{\"name\": \"x\"}\nMore text."; let pre_truncated = truncate_at_tool_tags(model_output); - assert_eq!(pre_truncated, model_output, "Closed tag should not be truncated"); + assert_eq!( + pre_truncated, model_output, + "Closed tag should not be truncated" + ); let cleaned = clean_response(&pre_truncated); assert_eq!(cleaned, "Info here.\n\nMore text."); } @@ -2827,13 +2833,12 @@ That's my plan."#; #[tokio::test] async fn test_respond_with_tools_force_text_truncates_tool_tags() { use crate::testing::StubLlm; - let response = - "Here is my analysis of the code.\n{\"name\": \"read_file\", \"arguments\": {\"path\": \"main.rs\"}}"; + let response = "Here is my analysis of the code.\n{\"name\": \"read_file\", \"arguments\": {\"path\": \"main.rs\"}}"; let llm = Arc::new(StubLlm::new(response)); let reasoning = Reasoning::new(llm); - let mut context = ReasoningContext::new() - .with_message(ChatMessage::user("analyze the code")); + let mut context = + ReasoningContext::new().with_message(ChatMessage::user("analyze the code")); context.force_text = true; let output = reasoning.respond_with_tools(&context).await.unwrap(); @@ -2854,8 +2859,7 @@ That's my plan."#; let llm = Arc::new(StubLlm::new(response)); let reasoning = Reasoning::new(llm); - let mut context = ReasoningContext::new() - .with_message(ChatMessage::user("hi")); + let mut context = ReasoningContext::new().with_message(ChatMessage::user("hi")); context.force_text = true; let output = reasoning.respond_with_tools(&context).await.unwrap(); @@ -2974,8 +2978,7 @@ That's my plan."#; use crate::testing::StubLlm; // StubLlm returns empty tool_calls + content with XML tool tags. // The recovery path should parse the tool call AND preserve text before it. - let response = - "Let me search for that.\n{\"name\": \"tool_list\", \"arguments\": {}}"; + let response = "Let me search for that.\n{\"name\": \"tool_list\", \"arguments\": {}}"; let llm = Arc::new(StubLlm::new(response)); let reasoning = Reasoning::new(llm); @@ -3008,8 +3011,7 @@ That's my plan."#; async fn test_respond_with_tools_recovered_only_tag_content_is_none() { use crate::testing::StubLlm; // Content is ONLY a tool call tag — after truncation+cleaning, content should be None - let response = - "{\"name\": \"tool_list\", \"arguments\": {}}"; + let response = "{\"name\": \"tool_list\", \"arguments\": {}}"; let llm = Arc::new(StubLlm::new(response)); let reasoning = Reasoning::new(llm); @@ -3029,7 +3031,10 @@ That's my plan."#; } => { assert_eq!(tool_calls.len(), 1); assert_eq!(tool_calls[0].name, "tool_list"); - assert!(content.is_none(), "Content should be None when only tool tags present"); + assert!( + content.is_none(), + "Content should be None when only tool tags present" + ); } RespondResult::Text(_) => { panic!("Expected recovered tool calls, got text"); @@ -3053,24 +3058,51 @@ That's my plan."#; #[test] fn test_closing_tag_for_standard_tags() { - assert_eq!(closing_tag_for("").as_deref(), Some("")); - assert_eq!(closing_tag_for("").as_deref(), Some("")); - assert_eq!(closing_tag_for("").as_deref(), Some("")); + assert_eq!( + closing_tag_for("").as_deref(), + Some("") + ); + assert_eq!( + closing_tag_for("").as_deref(), + Some("") + ); + assert_eq!( + closing_tag_for("").as_deref(), + Some("") + ); } #[test] fn test_closing_tag_for_space_suffixed_patterns() { // Patterns with trailing space (for attribute matching) - assert_eq!(closing_tag_for("")); - assert_eq!(closing_tag_for("")); - assert_eq!(closing_tag_for("")); + assert_eq!( + closing_tag_for("") + ); + assert_eq!( + closing_tag_for("") + ); + assert_eq!( + closing_tag_for("") + ); } #[test] fn test_closing_tag_for_pipe_delimited() { - assert_eq!(closing_tag_for("<|tool_call|>").as_deref(), Some("<|/tool_call|>")); - assert_eq!(closing_tag_for("<|function_call|>").as_deref(), Some("<|/function_call|>")); - assert_eq!(closing_tag_for("<|tool_calls|>").as_deref(), Some("<|/tool_calls|>")); + assert_eq!( + closing_tag_for("<|tool_call|>").as_deref(), + Some("<|/tool_call|>") + ); + assert_eq!( + closing_tag_for("<|function_call|>").as_deref(), + Some("<|/function_call|>") + ); + assert_eq!( + closing_tag_for("<|tool_calls|>").as_deref(), + Some("<|/tool_calls|>") + ); } #[test] diff --git a/src/tools/builder/core.rs b/src/tools/builder/core.rs index 9d606acf..190fd21e 100644 --- a/src/tools/builder/core.rs +++ b/src/tools/builder/core.rs @@ -509,8 +509,8 @@ Create alongside the .wasm file to grant capabilities: let mut iteration = 0; // Create reasoning engine - let reasoning = Reasoning::new(self.llm.clone()) - .with_model_name(self.llm.active_model_name()); + let reasoning = + Reasoning::new(self.llm.clone()).with_model_name(self.llm.active_model_name()); // Build initial context let tool_defs = self.get_build_tools().await; @@ -811,8 +811,8 @@ Create alongside the .wasm file to grant capabilities: impl SoftwareBuilder for LlmSoftwareBuilder { async fn analyze(&self, description: &str) -> Result { // Use LLM to parse the description - let reasoning = Reasoning::new(self.llm.clone()) - .with_model_name(self.llm.active_model_name()); + let reasoning = + Reasoning::new(self.llm.clone()).with_model_name(self.llm.active_model_name()); let prompt = format!( r#"Analyze this software requirement and extract structured information. diff --git a/src/worker/job.rs b/src/worker/job.rs index fd7fcd12..ad5c7157 100644 --- a/src/worker/job.rs +++ b/src/worker/job.rs @@ -223,8 +223,8 @@ impl Worker { let job_ctx = self.context_manager().get_context(self.job_id).await?; // Create reasoning engine - let reasoning = Reasoning::new(self.llm().clone()) - .with_model_name(self.llm().active_model_name()); + let reasoning = + Reasoning::new(self.llm().clone()).with_model_name(self.llm().active_model_name()); // Build initial reasoning context (tool definitions refreshed each iteration in execution_loop) let mut reason_ctx = ReasoningContext::new().with_job(&job_ctx.description);