Tighten Kaya flood gate: pause and escalate to Mira only.
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

Lower threshold and prefer skipping agent→agent chatter.
This commit is contained in:
alex 2026-09-22 11:51:17 +03:00
parent 8c88d4ca8a
commit 6e11225667

View File

@ -17,8 +17,8 @@ import (
const ( const (
agentID = "kaya" agentID = "kaya"
floodMaxComments = 15 floodMaxComments = 8
floodWindow = 30 * time.Minute floodWindow = 15 * time.Minute
floodMarker = "[tasks-flood]" floodMarker = "[tasks-flood]"
) )
@ -118,9 +118,9 @@ func (l *Loop) handle(ctx context.Context, ev tasksws.Event) error {
} }
if recentCommentCount(comments, floodWindow) >= floodMaxComments { if recentCommentCount(comments, floodWindow) >= floodMaxComments {
l.log().Warn("tasks board flood limit", "task_id", taskID, "window", floodWindow, "max", floodMaxComments) l.log().Warn("tasks board flood limit — pausing (Mira coordinates)", "task_id", taskID)
body := fmt.Sprintf( body := fmt.Sprintf(
"@mira %s flood: ≥%d comments in %s on this task — please tag the human to intervene. Agents are pausing auto-replies.", "@mira %s flood: ≥%d comments in %s on this task — sister agents paused; please coordinate / tag the human.",
floodMarker, floodMaxComments, floodWindow, floodMarker, floodMaxComments, floodWindow,
) )
_, err := l.REST.PostComment(replyCtx, taskID, body, "flood-escalate:"+taskID) _, err := l.REST.PostComment(replyCtx, taskID, body, "flood-escalate:"+taskID)
@ -207,10 +207,10 @@ func (l *Loop) shouldReplyToAgentMention(ctx context.Context, task Task, mention
model = "deepseek-v4-flash" model = "deepseek-v4-flash"
} }
user := "Task: " + task.Title + "\nTrigger comment from another agent:\n" + trimRunes(mentionBody, 800) + user := "Task: " + task.Title + "\nTrigger comment from another agent:\n" + trimRunes(mentionBody, 800) +
"\n\nReply true only if you must add new substance. Reply false for acknowledgements/thanks/repeats." "\n\nReply true ONLY if you must add new substance (journal entry Mira asked for). Default false for thanks/repeats."
res, err := l.Core.RunAgent(ctx, inference.RunRequest{ res, err := l.Core.RunAgent(ctx, inference.RunRequest{
Messages: []inference.ChatMessage{ Messages: []inference.ChatMessage{
{Role: "system", Content: "You gate Kaya's board replies to agent @mentions. Output JSON only."}, {Role: "system", Content: "You gate Kaya's board replies to agent @mentions. Prefer false. Output JSON only."},
{Role: "user", Content: user}, {Role: "user", Content: user},
}, },
Model: model, Model: model,