Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix(squads): warn leader against double-triggering an agent (#3053)

Bohan Jiang46a29b1ebb1a
diff --git a/server/internal/handler/squad_briefing.go b/server/internal/handler/squad_briefing.go
index c4f3ff9c39..291c86b13e 100644
--- a/server/internal/handler/squad_briefing.go
+++ b/server/internal/handler/squad_briefing.go
@@ -79,7 +79,14 @@ Hard rules:
explaining the gap (and @mention the issue's reporter if possible)
rather than silently doing the work.
- ALWAYS call ` + "`" + `multica squad activity` + "`" + ` before ending your turn —
- even when the outcome is no_action.`
+ even when the outcome is no_action.
+- A child issue you create with ` + "`" + `--status todo` + "`" + ` and an agent assignee
+ already fires that agent automatically — the assignment IS the trigger.
+ If you also @mention the same agent on this parent issue for the same
+ work, the agent runs twice in parallel (once from the mention, once
+ from the assignment). Pick exactly one path: either delegate by
+ @mention on this issue, or create a ` + "`" + `todo` + "`" + ` child issue assigned to
+ them. Never both for the same work.`
// buildSquadLeaderBriefing composes the full system briefing appended to a
// squad leader's Instructions when it claims a task on a squad-assigned
diff --git a/server/internal/handler/squad_briefing_test.go b/server/internal/handler/squad_briefing_test.go
index 6a7214cf8d..6fdccc9802 100644
--- a/server/internal/handler/squad_briefing_test.go
+++ b/server/internal/handler/squad_briefing_test.go
@@ -13,6 +13,24 @@ import (
db "github.com/multica-ai/multica/server/pkg/db/generated"
)
+// TestSquadOperatingProtocolWarnsAgainstDualTrigger locks in the rule
+// added for #3033: the protocol must tell the squad leader that a `todo`
+// child issue with an agent assignee already fires that agent, so they
+// must not also @mention the same agent on the parent issue for the
+// same work. Asserts behavior, not exact wording — keep the substrings
+// narrow so harmless rewording doesn't break the test.
+func TestSquadOperatingProtocolWarnsAgainstDualTrigger(t *testing.T) {
+ compact := strings.Join(strings.Fields(squadOperatingProtocol), " ")
+ for _, want := range []string{
+ "--status todo` and an agent assignee already fires that agent automatically",
+ "Never both for the same work.",
+ } {
+ if !strings.Contains(compact, want) {
+ t.Errorf("expected squad operating protocol to contain %q\n--- protocol ---\n%s", want, squadOperatingProtocol)
+ }
+ }
+}
+
// seedSquadForBriefing creates a squad with the seeded test agent as
// leader. Returns the loaded db.Squad and a cleanup-registered ID.
func seedSquadForBriefing(t *testing.T, leaderID string, name, instructions string) db.Squad {