chore(agent): log natural-stop candidate when no tool calls

Add explicit response logging for the branch where the model returns
finish=stop with zero tool calls. This makes it easier to identify the
natural-stop path early in logs and correlate rounds that are likely to
be treated as final-answer candidates by analyzeResponse.

- include `tool_calls=0` in the no-tool summary log
- emit a dedicated "Natural-stop candidate detected" info log when
  finish_reason is stop and no tool calls are present
This commit is contained in:
wizardchen
2026-05-07 17:43:23 +08:00
committed by lyingbug
parent 450a5bd2dd
commit 1d3bd8bb13
+7 -1
View File
@@ -358,8 +358,14 @@ func (e *AgentEngine) callLLMWithRetry(
logger.Infof(ctx, "[Agent][Round-%d] LLM responded: finish=%s, content=%d chars, tools=%v",
round, response.FinishReason, len(response.Content), tcNames)
} else {
logger.Infof(ctx, "[Agent][Round-%d] LLM responded: finish=%s, content=%d chars",
logger.Infof(ctx, "[Agent][Round-%d] LLM responded: finish=%s, content=%d chars, tool_calls=0",
round, response.FinishReason, len(response.Content))
// Early signal for natural-stop path: this round will be analyzed as a
// likely final answer (no tool call branch).
if response.FinishReason == "stop" {
logger.Infof(ctx, "[Agent][Round-%d] Natural-stop candidate detected (finish=stop, tool_calls=0, content=%d chars)",
round, len(response.Content))
}
}
if response.Content != "" {
preview := response.Content