Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
agent2: Less noisy logs (#36863)
Bennet Bo Fennerdb949546cf47
diff --git a/crates/agent2/src/agent.rs b/crates/agent2/src/agent.rsindex 415933b7d1b..1576c3cf96c 100644--- a/crates/agent2/src/agent.rs+++ b/crates/agent2/src/agent.rs@@ -180,7 +180,7 @@ impl NativeAgent {fs: Arc<dyn Fs>,cx: &mut AsyncApp,) -> Result<Entity<NativeAgent>> {- log::info!("Creating new NativeAgent");+ log::debug!("Creating new NativeAgent");let project_context = cx.update(|cx| Self::build_project_context(&project, prompt_store.as_ref(), cx))?@@ -756,7 +756,7 @@ impl NativeAgentConnection {}}- log::info!("Response stream completed");+ log::debug!("Response stream completed");anyhow::Ok(acp::PromptResponse {stop_reason: acp::StopReason::EndTurn,})@@ -781,7 +781,7 @@ impl AgentModelSelector for NativeAgentConnection {model_id: acp_thread::AgentModelId,cx: &mut App,) -> Task<Result<()>> {- log::info!("Setting model for session {}: {}", session_id, model_id);+ log::debug!("Setting model for session {}: {}", session_id, model_id);let Some(thread) = self.0.read(cx)@@ -852,7 +852,7 @@ impl acp_thread::AgentConnection for NativeAgentConnection {cx: &mut App,) -> Task<Result<Entity<acp_thread::AcpThread>>> {let agent = self.0.clone();- log::info!("Creating new thread for project at: {:?}", cwd);+ log::debug!("Creating new thread for project at: {:?}", cwd);cx.spawn(async move |cx| {log::debug!("Starting thread creation in async context");@@ -917,7 +917,7 @@ impl acp_thread::AgentConnection for NativeAgentConnection {.into_iter().map(Into::into).collect::<Vec<_>>();- log::info!("Converted prompt to message: {} chars", content.len());+ log::debug!("Converted prompt to message: {} chars", content.len());log::debug!("Message id: {:?}", id);log::debug!("Message content: {:?}", content);diff --git a/crates/agent2/src/native_agent_server.rs b/crates/agent2/src/native_agent_server.rsindex 12d3c79d1bf..33ee44c9a36 100644--- a/crates/agent2/src/native_agent_server.rs+++ b/crates/agent2/src/native_agent_server.rs@@ -44,7 +44,7 @@ impl AgentServer for NativeAgentServer {project: &Entity<Project>,cx: &mut App,) -> Task<Result<Rc<dyn acp_thread::AgentConnection>>> {- log::info!(+ log::debug!("NativeAgentServer::connect called for path: {:?}",_root_dir);@@ -63,7 +63,7 @@ impl AgentServer for NativeAgentServer {// Create the connection wrapperlet connection = NativeAgentConnection(agent);- log::info!("NativeAgentServer connection established successfully");+ log::debug!("NativeAgentServer connection established successfully");Ok(Rc::new(connection) as Rc<dyn acp_thread::AgentConnection>)})diff --git a/crates/agent2/src/thread.rs b/crates/agent2/src/thread.rsindex 43f391ca64a..4bbbdbdec75 100644--- a/crates/agent2/src/thread.rs+++ b/crates/agent2/src/thread.rs@@ -1088,7 +1088,7 @@ impl Thread {self.messages.push(Message::Resume);cx.notify();- log::info!("Total messages in thread: {}", self.messages.len());+ log::debug!("Total messages in thread: {}", self.messages.len());self.run_turn(cx)}@@ -1106,7 +1106,7 @@ impl Thread {{let model = self.model().context("No language model configured")?;- log::info!("Thread::send called with model: {:?}", model.name());+ log::info!("Thread::send called with model: {}", model.name().0);self.advance_prompt_id();let content = content.into_iter().map(Into::into).collect::<Vec<_>>();@@ -1116,7 +1116,7 @@ impl Thread {.push(Message::User(UserMessage { id, content }));cx.notify();- log::info!("Total messages in thread: {}", self.messages.len());+ log::debug!("Total messages in thread: {}", self.messages.len());self.run_turn(cx)}@@ -1140,7 +1140,7 @@ impl Thread {event_stream: event_stream.clone(),tools: self.enabled_tools(profile, &model, cx),_task: cx.spawn(async move |this, cx| {- log::info!("Starting agent turn execution");+ log::debug!("Starting agent turn execution");let turn_result: Result<()> = async {let mut intent = CompletionIntent::UserPrompt;@@ -1165,7 +1165,7 @@ impl Thread {log::info!("Tool use limit reached, completing turn");return Err(language_model::ToolUseLimitReachedError.into());} else if end_turn {- log::info!("No tool uses found, completing turn");+ log::debug!("No tool uses found, completing turn");return Ok(());} else {intent = CompletionIntent::ToolResults;@@ -1177,7 +1177,7 @@ impl Thread {match turn_result {Ok(()) => {- log::info!("Turn execution completed");+ log::debug!("Turn execution completed");event_stream.send_stop(acp::StopReason::EndTurn);}Err(error) => {@@ -1227,7 +1227,7 @@ impl Thread {attempt);- log::info!(+ log::debug!("Calling model.stream_completion, attempt {}",attempt.unwrap_or(0));@@ -1254,7 +1254,7 @@ impl Thread {}while let Some(tool_result) = tool_results.next().await {- log::info!("Tool finished {:?}", tool_result);+ log::debug!("Tool finished {:?}", tool_result);event_stream.update_tool_call_fields(&tool_result.tool_use_id,@@ -1528,7 +1528,7 @@ impl Thread {});let supports_images = self.model().is_some_and(|model| model.supports_images());let tool_result = tool.run(tool_use.input, tool_event_stream, cx);- log::info!("Running tool {}", tool_use.name);+ log::debug!("Running tool {}", tool_use.name);Some(cx.foreground_executor().spawn(async move {let tool_result = tool_result.await.and_then(|output| {if let LanguageModelToolResultContent::Image(_) = &output.llm_output@@ -1640,7 +1640,7 @@ impl Thread {summary.extend(lines.next());}- log::info!("Setting summary: {}", summary);+ log::debug!("Setting summary: {}", summary);let summary = SharedString::from(summary);this.update(cx, |this, cx| {@@ -1657,7 +1657,7 @@ impl Thread {return;};- log::info!(+ log::debug!("Generating title with model: {:?}",self.summarization_model.as_ref().map(|model| model.name()));@@ -1799,8 +1799,8 @@ impl Thread {log::debug!("Completion mode: {:?}", self.completion_mode);let messages = self.build_request_messages(cx);- log::info!("Request will include {} messages", messages.len());- log::info!("Request includes {} tools", tools.len());+ log::debug!("Request will include {} messages", messages.len());+ log::debug!("Request includes {} tools", tools.len());let request = LanguageModelRequest {thread_id: Some(self.id.to_string()),