diff --git a/src/agent/agent_loop.rs b/src/agent/agent_loop.rs index 1cbd9f8..1c7ac29 100644 --- a/src/agent/agent_loop.rs +++ b/src/agent/agent_loop.rs @@ -1406,7 +1406,7 @@ impl AgentLoop { } // Execute tool calls - tracing::info!( + tracing::debug!( iteration, count = response.tool_calls.len(), "Tool calls detected, executing tools" @@ -2088,7 +2088,7 @@ impl AgentLoop { serde_json::Value::Object(obj) if obj.is_empty() => "{}".to_string(), other => serde_json::to_string_pretty(other).unwrap_or_else(|_| other.to_string()), }; - tracing::info!(tool = %tool_call.name, args = %args_str, "Calling tool"); + tracing::debug!(tool = %tool_call.name, args = %args_str, "Calling tool"); // Record ToolCallStart event if let Some(ref observer) = self.observer { diff --git a/src/command/handlers/load_task_messages.rs b/src/command/handlers/load_task_messages.rs index cfa7b88..33589ec 100644 --- a/src/command/handlers/load_task_messages.rs +++ b/src/command/handlers/load_task_messages.rs @@ -56,7 +56,7 @@ async fn handle_load_task_messages( task_id: String, ctx: CommandContext, ) -> Result { - tracing::info!( + tracing::debug!( task_id = %task_id, request_id = %ctx.request_id, "LoadTaskMessages: looking up task" @@ -65,7 +65,7 @@ async fn handle_load_task_messages( // 1. Try in-memory repository first let task = match handler.task_repository.load_task_session(&task_id).await { Ok(Some(task)) => { - tracing::info!( + tracing::debug!( task_id = %task.id, session_id = %task.session_id, state = ?task.state, @@ -74,7 +74,7 @@ async fn handle_load_task_messages( Some(task) } Ok(None) => { - tracing::info!( + tracing::debug!( task_id = %task_id, "LoadTaskMessages: task not in memory, searching database" ); diff --git a/src/gateway/agent_factory.rs b/src/gateway/agent_factory.rs index 61c5c94..b363eda 100644 --- a/src/gateway/agent_factory.rs +++ b/src/gateway/agent_factory.rs @@ -233,8 +233,8 @@ impl AgentFactory { _ => expert_provider_config, }; - // 诊断日志:记录 agent 实际使用的配置和实例 ID - tracing::info!( + // 诊断日志(debug):记录 agent 实际使用的配置和实例 ID + tracing::debug!( instance_id = self.instance_id, channel = %request.channel_name, session_id = %session_id, diff --git a/src/gateway/agent_prompt_provider.rs b/src/gateway/agent_prompt_provider.rs index ef1845b..7e60811 100644 --- a/src/gateway/agent_prompt_provider.rs +++ b/src/gateway/agent_prompt_provider.rs @@ -61,15 +61,6 @@ impl SystemPromptProvider for AgentPromptProvider { return None; } - // 诊断日志:记录系统提示词实际使用的模型配置(用于排查"配置不生效"问题) - tracing::info!( - session_id = ?context.session_id, - chat_id = %context.chat_id, - provider = %self.provider_config.name, - model_id = %self.provider_config.model_id, - "AgentPromptProvider: building system prompt with model config" - ); - // 加载 Agent 提示词(AGENT.md + builtin + MEMORY_SUMMARY.md) let agent_prompt = load_agent_prompt().ok().flatten()?; diff --git a/src/gateway/execution.rs b/src/gateway/execution.rs index c8d8155..fc50b0b 100644 --- a/src/gateway/execution.rs +++ b/src/gateway/execution.rs @@ -167,7 +167,7 @@ impl AgentExecutionService { .as_deref() .unwrap_or(request.chat_id), ); - tracing::info!( + tracing::debug!( channel = %request.channel_name, chat_id = %request.chat_id, user_message_id = %request.user_message.id, diff --git a/src/gateway/processor.rs b/src/gateway/processor.rs index 40e91c4..c9b083c 100644 --- a/src/gateway/processor.rs +++ b/src/gateway/processor.rs @@ -594,7 +594,7 @@ impl InboundProcessor { .list_pending_subagents(topic_id, Some("running")) .unwrap_or_default(); if !pending.is_empty() { - tracing::info!( + tracing::debug!( topic_id = %topic_id, pending_count = pending.len(), "Skipping ExecutionCompleted: pending subagents still running" diff --git a/src/gateway/ws.rs b/src/gateway/ws.rs index 49f6996..b428baa 100644 --- a/src/gateway/ws.rs +++ b/src/gateway/ws.rs @@ -557,13 +557,15 @@ async fn handle_inbound( // 处理响应 if response.success { - // 更新当前会话 ID(如果是创建会话) + // 更新当前会话 ID(如果是创建会话);仅在变化时记录日志 if let Some(session_id) = response.metadata.get("session_id") { - tracing::info!( - old_session_id = %current_session_id, - new_session_id = %session_id, - "Updating current_session_id" - ); + if session_id != current_session_id { + tracing::info!( + old_session_id = %current_session_id, + new_session_id = %session_id, + "Updating current_session_id" + ); + } *current_session_id = session_id.clone(); let _ = state .channel_manager diff --git a/src/providers/openai.rs b/src/providers/openai.rs index 0f7c805..d17b7d8 100644 --- a/src/providers/openai.rs +++ b/src/providers/openai.rs @@ -96,7 +96,6 @@ impl StreamingAccumulator { /// 跳过 total_tokens=0 的占位帧,避免覆盖真实值。 fn set_usage(&mut self, usage: OpenAIUsage) { if usage.total_tokens > 0 { - usage.log_cache_diagnostics("stream_final_frame"); self.usage = Some(usage); } } @@ -725,7 +724,6 @@ impl OpenAIProvider { }) .unwrap_or_default(); // 回退场景下也从非流式响应提取 usage - openai_resp.usage.log_cache_diagnostics("non_streaming_fallback"); response.usage = Usage { prompt_tokens: openai_resp.usage.prompt_tokens, completion_tokens: openai_resp.usage.completion_tokens, @@ -1108,19 +1106,6 @@ impl OpenAIUsage { }) .unwrap_or(0) } - - /// 诊断日志:记录 API 是否返回缓存字段及解析后的值(排查"缓存一直不命中"问题)。 - /// field_present=false 说明 API/网关根本没返回缓存字段(中转服务剥离或模型不支持)。 - fn log_cache_diagnostics(&self, source: &str) { - tracing::info!( - source = %source, - prompt_tokens = self.prompt_tokens, - cached_tokens = self.cached_tokens(), - deepseek_cache_field_present = self.prompt_cache_hit_tokens.is_some(), - openai_cache_details_present = self.prompt_tokens_details.is_some(), - "OpenAI usage cache diagnostics" - ); - } } #[async_trait] @@ -1279,7 +1264,6 @@ impl LLMProvider for OpenAIProvider { reasoning_content: openai_resp.choices[0].message.reasoning_content.clone(), tool_calls, usage: { - openai_resp.usage.log_cache_diagnostics("non_streaming"); Usage { prompt_tokens: openai_resp.usage.prompt_tokens, completion_tokens: openai_resp.usage.completion_tokens,