From 2dede038137209f7ba1c32372cf14966f69cd932 Mon Sep 17 00:00:00 2001 From: lpf Date: Tue, 17 Feb 2026 00:20:07 +0800 Subject: [PATCH] fix bug --- pkg/agent/loop.go | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/pkg/agent/loop.go b/pkg/agent/loop.go index fcf6d54..581c0ec 100644 --- a/pkg/agent/loop.go +++ b/pkg/agent/loop.go @@ -591,15 +591,8 @@ func (al *AgentLoop) maybeRunAutonomyRound(msg bus.InboundMessage) bool { s.lastNudgeAt = now s.pending = true focus := strings.TrimSpace(s.focus) - idleFor := now.Sub(s.lastUserAt).Truncate(time.Second) al.autonomyMu.Unlock() - al.bus.PublishOutbound(bus.OutboundMessage{ - Channel: msg.Channel, - ChatID: msg.ChatID, - Content: fmt.Sprintf("[自主模式] 你已空闲 %s,我已启动第 %d 轮自主推进。", idleFor, round), - }) - al.bus.PublishInbound(bus.InboundMessage{ Channel: msg.Channel, SenderID: "autonomy", @@ -893,18 +886,22 @@ func (al *AgentLoop) processMessage(ctx context.Context, msg bus.InboundMessage) } directives := parseTaskExecutionDirectives(msg.Content) - if inferred, ok := al.inferTaskExecutionDirectives(ctx, msg.Content); ok { - // Explicit /run/@run command always has higher priority than inferred directives. - if !isExplicitRunCommand(msg.Content) { - directives = inferred + if controlEligible { + if inferred, ok := al.inferTaskExecutionDirectives(ctx, msg.Content); ok { + // Explicit /run/@run command always has higher priority than inferred directives. + if !isExplicitRunCommand(msg.Content) { + directives = inferred + } } + } else { + // Synthetic messages should run quietly and only report final outcomes. + directives.stageReport = false } userPrompt := directives.task if strings.TrimSpace(userPrompt) == "" { userPrompt = msg.Content } if al.isAutonomyEnabled(msg.SessionKey) && controlEligible { - directives.stageReport = true userPrompt = buildAutonomyTaskPrompt(userPrompt) }