Skip to content

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

Go

refactor(daemon): merge Reply/Ownership turn modes into one fact-driven workflow (MUL-6417) (#7245)

Bohan Jiang4f56785b02dd
diff --git a/apps/docs/content/docs/assigning-issues.mdx b/apps/docs/content/docs/assigning-issues.mdx
index 9aed2f1a31..502f2adbd0 100644
--- a/apps/docs/content/docs/assigning-issues.mdx
+++ b/apps/docs/content/docs/assigning-issues.mdx
@@ -37,9 +37,9 @@ While executing, the agent can:
What it can actually do is still limited by the agent's configuration, the runtime environment, and your permission to run it.
-During the run, the agent is expected to manage the issue's status by convention (typically `todo` → `in_progress`, then `in_review` on delivery) — these actions appear under the agent's identity in the timeline. Task lifecycle and issue status are separate: a task completing does not by itself change the issue status.
+During the run, the agent manages the issue's status by judging, at the end of each turn, what its work changed: delivery moves the issue to `in_review`, work continuing beyond the turn keeps it `in_progress`, and research or discussion leaves the status untouched — these actions appear under the agent's identity in the timeline. Task lifecycle and issue status are separate: a task completing does not by itself change the issue status.
-When the assignee is a [squad](/squads), the same expectations apply: Multica enqueues the leader, who moves the parent issue to `in_progress` on the first turn and keeps it there while members work. The leader only moves it to `in_review` once the overall goal is met — a successful first dispatch is not completion.
+When the assignee is a [squad](/squads), the same rule applies: Multica enqueues the leader, and dispatching members is not delivery — a dispatch turn leaves the parent issue `in_progress`, and the leader only moves it to `in_review` once the overall goal is met.
## Assign without starting
diff --git a/apps/docs/content/docs/assigning-issues.zh.mdx b/apps/docs/content/docs/assigning-issues.zh.mdx
index 29300dc618..a17d45c07d 100644
--- a/apps/docs/content/docs/assigning-issues.zh.mdx
+++ b/apps/docs/content/docs/assigning-issues.zh.mdx
@@ -37,9 +37,9 @@ Multica 会为智能体创建一条[执行任务](/tasks)。在线运行时领
具体能力仍受智能体配置、运行时环境和你的调用权限限制。
-执行过程中,智能体应按约定管理 issue 状态(通常 `todo` → `in_progress`,交付后再到 `in_review`)——这些动作以智能体的身份出现在时间线中。task 的生命周期和 issue 状态是分开的:task 完成本身不会改变 issue 状态。
+执行过程中,智能体在每轮结束时根据工作对 issue 的实际影响管理状态:交付即推到 `in_review`,工作跨轮继续则保持 `in_progress`,仅调研或讨论则不动状态——这些动作以智能体的身份出现在时间线中。task 的生命周期和 issue 状态是分开的:task 完成本身不会改变 issue 状态。
-负责人是[小队](/squads)时,同样的约定适用:Multica 入队的是队长,队长首次接单时把父 issue 推到 `in_progress`,成员工作期间保持不变;整体目标达成后才推到 `in_review`——第一次成功派活不等于完成。
+负责人是[小队](/squads)时,同样的规则适用:Multica 入队的是队长,派活不等于交付——派活轮结束时父 issue 处于 `in_progress`,整体目标达成后队长才推到 `in_review`。
## 只分配,暂时不启动
diff --git a/apps/docs/content/docs/issues.mdx b/apps/docs/content/docs/issues.mdx
index 2f9d55dda0..8af8210f41 100644
--- a/apps/docs/content/docs/issues.mdx
+++ b/apps/docs/content/docs/issues.mdx
@@ -52,7 +52,7 @@ Assignment does not bypass an agent's Access; when assigning to a squad, the lea
There is no fixed flow between statuses — members and agents can change them directly.
-Once an issue is assigned to an agent, the agent is expected to move the status from `backlog` / `todo` to `in_progress` when it starts, then to `in_review` when it has delivered. These updates are written explicitly by the agent through the Multica CLI during the run — the server does not flip issue status when a task starts or completes (apart from the two system exceptions below). `done` is usually a human confirmation, or an integration such as a PR with close intent that merges.
+Agents judge status at the end of a turn, from what the work changed about the issue: delivering what the issue asks for moves it to `in_review`; work that continues beyond the turn keeps it `in_progress`; research, answers, or discussion leave the status untouched. There is no automatic `in_progress` write when a run starts — an in-flight run is already visible on the issue. These updates are written explicitly by the agent through the Multica CLI during the run — the server does not flip issue status when a task starts or completes (apart from the two system exceptions below). `done` is usually a human confirmation, or an integration such as a PR with close intent that merges.
<Callout type="info">
Two changes are made by the system:
diff --git a/apps/docs/content/docs/issues.zh.mdx b/apps/docs/content/docs/issues.zh.mdx
index 5ca1d172bf..7458165465 100644
--- a/apps/docs/content/docs/issues.zh.mdx
+++ b/apps/docs/content/docs/issues.zh.mdx
@@ -52,7 +52,7 @@ Issue 是 Multica 中安排工作的基本单位:一项功能、一个 bug、
状态之间没有固定流转,成员和智能体都可以直接修改。
-把 issue 分配给智能体后,智能体开工时应把状态从 `backlog` / `todo` 推到 `in_progress`,交付后再推到 `in_review`。这些状态变更由智能体在运行中通过 Multica CLI 显式写入——task 开始或完成时,服务端不会自动改 issue 状态(下面两个系统例外除外)。`done` 通常留给人工确认,或由集成完成(例如带关闭意图的 PR 合并)。
+智能体在每轮工作结束时根据 issue 的实际进展判断状态:交付了 issue 要求的结果就推到 `in_review`;工作跨轮继续则保持 `in_progress`;仅调研、答疑或讨论则不改状态。运行开始时不会自动写入 `in_progress`——运行中的任务本身在 issue 上可见。这些状态变更由智能体在运行中通过 Multica CLI 显式写入——task 开始或完成时,服务端不会自动改 issue 状态(下面两个系统例外除外)。`done` 通常留给人工确认,或由集成完成(例如带关闭意图的 PR 合并)。
<Callout type="info">
两个变化由系统执行:
diff --git a/apps/docs/content/docs/squads.mdx b/apps/docs/content/docs/squads.mdx
index 8419fef40b..3c45a128fb 100644
--- a/apps/docs/content/docs/squads.mdx
+++ b/apps/docs/content/docs/squads.mdx
@@ -32,9 +32,9 @@ When a non-Backlog issue is assigned to a squad, Multica immediately enqueues a
1. **Leader claims the task.** The agent runtime picks up the task on its next poll, same as any other agent assignment.
2. **Leader is briefed.** On claim, Multica appends three sections to the leader's system prompt — see [What the leader sees on every turn](#what-the-leader-sees-on-every-turn) below.
-3. **Leader moves the parent to `in_progress`.** Same agent-managed status contract as a direct agent assignment: the first turn should leave `todo` / leave `backlog`-promoted work as `in_progress`. Dispatching members is not completion — the parent stays `in_progress` while the squad works.
-4. **Leader posts one delegation comment.** The comment `@`-mentions the chosen member(s) using the exact mention markdown from the roster — that mention triggers a new `task` for each mentioned agent.
-5. **Leader records its evaluation** via `multica squad activity <issue-id> action --reason "..."`. This writes an entry to the issue's activity timeline so humans can see the leader actually evaluated the trigger.
+3. **Leader posts one delegation comment.** The comment `@`-mentions the chosen member(s) using the exact mention markdown from the roster — that mention triggers a new `task` for each mentioned agent.
+4. **Leader records its evaluation** via `multica squad activity <issue-id> action --reason "..."`. This writes an entry to the issue's activity timeline so humans can see the leader actually evaluated the trigger.
+5. **The dispatch turn ends with the parent `in_progress`.** Same agent-managed status contract as a direct agent assignment — status is judged at the end of the turn, and dispatching members is not delivery, so the parent leaves `todo` for `in_progress` and stays there while the squad works.
6. **Leader stops.** The leader does not do the implementation itself. When the delegated member posts back — or when a sub-issue / stage barrier closes — the leader is re-triggered to read the update and either delegate the next step, escalate, move the parent to `in_review` once the overall goal is met, or stay silent. `done` is left to a human reviewer or existing integrations (for example a PR with close intent that merges).
If the issue is in **Backlog**, the leader is not triggered — Backlog is a parking lot, same rule as for direct agent assignment.
@@ -43,7 +43,7 @@ If the issue is in **Backlog**, the leader is not triggered — Backlog is a par
On each squad-leader run, three blocks are appended to the leader's instructions:
-- **Squad Operating Protocol** — a hard-coded rule set: read the issue, move the parent to `in_progress` on the first turn, delegate by `@`-mention, be terse (don't restate the issue body — the assignee can read it), record an evaluation every turn, **stop after dispatching**, and only move the parent to `in_review` once the overall goal is met. This protocol is system-managed and not editable.
+- **Squad Operating Protocol** — a hard-coded rule set: read the issue, delegate by `@`-mention, be terse (don't restate the issue body — the assignee can read it), record an evaluation every turn, **stop after dispatching** — the dispatch turn ends with the parent `in_progress` — and only move the parent to `in_review` once the overall goal is met. This protocol is system-managed and not editable.
The status half of that protocol is **scoped to issues actually assigned to this squad**. A leader woken by an `@squad` mention on someone else's issue gets the same roster and delegation rules, but is told explicitly **not** to touch that issue's status — status stays with the issue's own assignee.
- **Squad Roster** — the leader's self-row plus one row per non-archived member. Each row carries the exact mention markdown (`[@Name](mention://agent/<uuid>)` or `[@Name](mention://member/<uuid>)`) the leader should paste — typing a plain `@name` won't trigger anyone.
diff --git a/apps/docs/content/docs/squads.zh.mdx b/apps/docs/content/docs/squads.zh.mdx
index eb479517c0..e4769e2caf 100644
--- a/apps/docs/content/docs/squads.zh.mdx
+++ b/apps/docs/content/docs/squads.zh.mdx
@@ -32,9 +32,9 @@ import { Callout } from "fumadocs-ui/components/callout";
1. **队长的运行时领走 task**,和普通智能体的分配流程一样。
2. **队长拿到 briefing。** 领走的瞬间,Multica 会在队长的指令后面追加三段内容,见下文[队长每次执行看到的内容](#队长每次执行看到的内容)。
-3. **队长把父 issue 推到 `in_progress`。** 和直接分配给智能体同一套状态约定:首次接单应离开 `todo`,进入 `in_progress`。分发成员不等于完成——小队干活期间父 issue 保持 `in_progress`。
-4. **队长发一条派活评论。** 评论里用花名册给好的 mention markdown `@` 选中的成员——这个 `@` 会触发被派的成员入队新 task。
-5. **队长记录 evaluation**:`multica squad activity <issue-id> <outcome> --reason "..."`。这一行会写进 issue 的 activity 时间线,方便人类回溯队长的每次评估。
+3. **队长发一条派活评论。** 评论里用花名册给好的 mention markdown `@` 选中的成员——这个 `@` 会触发被派的成员入队新 task。
+4. **队长记录 evaluation**:`multica squad activity <issue-id> <outcome> --reason "..."`。这一行会写进 issue 的 activity 时间线,方便人类回溯队长的每次评估。
+5. **派活轮结束时父 issue 处于 `in_progress`。** 和直接分配给智能体同一套状态约定:状态在每轮结束时按实际进展判断,派活不等于交付——所以父 issue 离开 `todo` 进入 `in_progress`,小队干活期间保持不变。
6. **队长停下。** 派完活,队长不亲自动手。被派成员有回复时,队长会被自动唤醒,决定下一步:继续派活、上抛给人类、在整体目标达成后把父 issue 推到 `in_review`,或保持沉默。`done` 留给人工确认或既有集成(例如带 close intent 的 PR merge)。
如果 issue 仍在 `backlog`,分配本身不会触发队长。移出 `backlog` 后才会开始执行。
@@ -43,7 +43,7 @@ import { Callout } from "fumadocs-ui/components/callout";
每次队长被触发,三段内容会附加到它的指令上:
-- **Squad Operating Protocol(小队工作规范)**——一段硬编码的规则集:读 issue → 首次接单把父 issue 推到 `in_progress` → 用 `@` 派活 → 保持简洁(不复述 issue 内容,被派的成员自己能读)→ 每次记 evaluation → 派完就停 → 整体目标达成后才推 `in_review`。这段由系统管理,不可编辑。
+- **Squad Operating Protocol(小队工作规范)**——一段硬编码的规则集:读 issue → 用 `@` 派活 → 保持简洁(不复述 issue 内容,被派的成员自己能读)→ 每次记 evaluation → 派完就停(派活轮结束时父 issue 处于 `in_progress`)→ 整体目标达成后才推 `in_review`。这段由系统管理,不可编辑。
其中状态相关的规则只对"确实分配给本小队"的 issue 生效。队长被别人 issue 里的 `@小队` 唤醒时,同样拿到花名册和派活规则,但会被明确告知不要改动那条 issue 的状态——状态仍归它自己的负责人。
- **Squad Roster(小队花名册)**——队长一行 + 每个未归档成员一行,每行带可直接复制的 mention markdown(`[@Name](mention://agent/<uuid>)`)。纯文本 `@name` 不会触发任何人。
diff --git a/server/internal/daemon/execenv/execenv_test.go b/server/internal/daemon/execenv/execenv_test.go
index 17336d0c4b..7f275bd70c 100644
--- a/server/internal/daemon/execenv/execenv_test.go
+++ b/server/internal/daemon/execenv/execenv_test.go
@@ -4999,27 +4999,37 @@ func TestInjectRuntimeConfigMentionLoopHardening(t *testing.T) {
t.Run("mentions-section-lists-loop-protocol", func(t *testing.T) {
t.Parallel()
s := readClaudeMD(t, assignmentCtx)
+ // MUL-6417: the section is fact-anchored, no prescriptive default.
+ // Pin each fact that invalidates a false reason to mention — losing
+ // any one of them re-opens the incident class it closed.
for _, want := range []string{
"side-effecting actions",
"enqueues a new run for that agent",
- // MUL-5442 judgment rewrite: the two H3 subsections merged into one
- // paragraph — pin the policy anchors, not the retired headings.
- "Default: NO mention",
- // Each warranted-case scope qualifier pinned separately — "not yet
- // involved" and "for the first time" ARE the anti-repeat-notify
- // scope, not decoration (review catch on #6453).
- "restarts an agent-to-agent loop and costs the user money",
- "Mention only when escalating to a human owner",
- "not yet involved",
- "for the first time",
- "explicitly asks to loop someone in",
- "end with no mention at all",
+ // Notifying FOLLOWERS is a false need: delivery already happens.
+ // Scoped to followers on purpose — for a non-follower, a mention
+ // IS how they find out (Elon's review catch on #7245).
+ "followers of the issue already see your comment",
+ "completion notifications are platform-owned",
+ // The one real function, with its scope.
+ "pulls someone into work they are not doing yet",
+ // The courtesy-loop fact (the incident class behind #1581/#6453).
+ "whose only possible reply is another courtesy",
+ // The asymmetry that breaks ambiguous cases toward not mentioning.
+ "a missed mention costs one follow-up ask, a stray one costs a run",
"Silence ends conversations",
} {
if !strings.Contains(s, want) {
t.Errorf("Mentions section missing %q\n---\n%s", want, s)
}
}
+ // Neither the bare prescription (MUL-6417) nor the overreach that
+ // replaced it may come back: "never how someone finds out" was false
+ // for non-followers and suppressed legitimate human escalation.
+ for _, banned := range []string{"Default: NO mention", "never how someone finds out"} {
+ if strings.Contains(s, banned) {
+ t.Errorf("Mentions section carries retired wording %q\n---\n%s", banned, s)
+ }
+ }
})
t.Run("closing-line-no-longer-says-always-mention", func(t *testing.T) {
@@ -5046,10 +5056,13 @@ func TestInjectRuntimeConfigMentionLoopHardening(t *testing.T) {
// back: "Decide whether a reply is warranted", "produced actual
// work", "pure acknowledgment / thanks / sign-off", "do NOT reply",
// "Silence is a valid and preferred way".
+ // MUL-6417 merged the reply-mode block into the shared steps: the
+ // unconditional one-comment contract now lives in step 4, and the
+ // mention-after-work bullet is gone with the block (the discipline
+ // itself stays in `## Mentions`, pinned by the Mentions subtest).
for _, want := range []string{
- "Posting your reply as a comment is mandatory",
- "Do any requested work first",
- "Never @mention the agent you are replying to as a thank-you or sign-off",
+ "**Post your final results as a comment — this step is mandatory**",
+ "whose only possible reply is another courtesy",
} {
if !strings.Contains(s, want) {
t.Errorf("comment-triggered CLAUDE.md missing %q", want)
@@ -5102,24 +5115,23 @@ func TestInjectRuntimeConfigSquadLeaderCommentTriggeredNoAction(t *testing.T) {
}
s := string(data)
- // The comment-triggered workflow must contain the squad leader no_action
- // rule, and the reply imperative must carry the no_action carve-out so a
- // later bullet never contradicts it (MUL-5442 #6493 review).
+ // The no_action rule lives on the leader variant of workflow step 4 since
+ // MUL-6417 (the reply-mode block that used to duplicate it is gone): the
+ // delivery imperative itself carries the carve-out, so no later bullet
+ // can contradict it (MUL-5442 #6493 review).
for _, want := range []string{
- "Squad leader rule",
- "DO NOT post any comment",
+ "unless your outcome is `no_action`",
"multica squad activity",
- "Unless your outcome is `no_action` (Squad leader rule above), posting your reply as a comment is mandatory",
+ "DO NOT post a comment announcing no_action",
} {
if !strings.Contains(s, want) {
t.Errorf("squad leader comment-triggered CLAUDE.md missing %q", want)
}
}
- // Capital-P form = the ordinary unconditional bullet; the leader brief
- // must carry only the carve-out variant (its lowercase "posting your
- // reply as a comment is mandatory" tail is expected and legal).
- if strings.Contains(s, "Posting your reply as a comment is mandatory") {
- t.Errorf("squad leader CLAUDE.md still carries the unconditional reply bullet")
+ // The unconditional ordinary-agent imperative must not coexist with the
+ // carve-out variant.
+ if strings.Contains(s, "**Post your final results as a comment — this step is mandatory**") {
+ t.Errorf("squad leader CLAUDE.md still carries the unconditional delivery step")
}
// The Output section must use strong prohibition language.
@@ -5142,8 +5154,8 @@ func TestInjectRuntimeConfigSquadLeaderCommentTriggeredNoAction(t *testing.T) {
t.Fatalf("read CLAUDE.md: %v", err)
}
s2 := string(data2)
- if strings.Contains(s2, "Squad leader rule") {
- t.Errorf("non-squad-leader CLAUDE.md should NOT contain squad leader rule")
+ if strings.Contains(s2, "unless your outcome is `no_action`") {
+ t.Errorf("non-squad-leader CLAUDE.md should NOT contain the leader no_action carve-out")
}
}
diff --git a/server/internal/daemon/execenv/reply_instructions_test.go b/server/internal/daemon/execenv/reply_instructions_test.go
index f69df6a045..00ee0d7984 100644
--- a/server/internal/daemon/execenv/reply_instructions_test.go
+++ b/server/internal/daemon/execenv/reply_instructions_test.go
@@ -204,30 +204,29 @@ func TestInjectRuntimeConfigKeepsTriggerCommentOutOfBrief(t *testing.T) {
t.Errorf("CLAUDE.md must not carry the trigger comment id (MUL-5377)\n---\n%s", s)
}
for _, want := range []string{
- // MUL-5442 stage 1: the mode-router paragraph compressed to a
- // "Turn mode." lead. Pin every routing RULE, not just the markers —
- // a further compression that drops the one-block rule or the
- // no-mode-line fallback must fail here (stage-1 review).
- "**Turn mode.**",
- "Steps 1–5 are shared",
- "apply exactly one mode block",
- "differ on issue status",
- // The full fallback MAPPING, not its halves: "No mode line" and
- // "Reply mode" pinned separately could both pass while the text
- // says "No mode line → Ownership mode" (final-review catch).
- "No mode line → Reply mode",
- // The fallback is only safe because Reply mode's own status rule is
- // conditional: no work, no status write (MUL-6300).
- "Purely conversational turns (question, discussion, acknowledgement) never touch status",
- "`Turn mode: Reply.`",
- "`Turn mode: Ownership.`",
- "Use the `--parent` value the per-turn user message gives you for this turn",
- "do NOT reuse a `--parent` from an earlier turn in this session",
+ // MUL-6417 retired the turn-mode router: one workflow, delivery
+ // routed on what the per-turn message carries. Pin the routing RULE
+ // halves — a compression that drops either delivery case must fail
+ // here.
+ "**Every issue turn runs the same workflow.**",
+ "with the `--parent` value it gives you for THIS turn",
+ "never one from an earlier turn",
+ "With no triggering comment, post a new top-level comment",
+ // The no-write default that makes the un-routed workflow safe: a
+ // turn that moved nothing writes nothing (MUL-6300 → MUL-6417).
+ "questions, discussion, and acknowledgements never touch status",
} {
if !strings.Contains(s, want) {
t.Errorf("CLAUDE.md missing %q\n---\n%s", want, s)
}
}
+
+ // The retired router must not come back in any phrasing.
+ for _, banned := range []string{"Turn mode", "mode block", "No mode line"} {
+ if strings.Contains(s, banned) {
+ t.Errorf("CLAUDE.md still carries retired mode-router text %q (MUL-6417)\n---\n%s", banned, s)
+ }
+ }
}
// Windows reply instructions are file-first, never stdin. The instructions
diff --git a/server/internal/daemon/execenv/runtime_config_sections.go b/server/internal/daemon/execenv/runtime_config_sections.go
index 9f6490ca3c..1e36d6f780 100644
--- a/server/internal/daemon/execenv/runtime_config_sections.go
+++ b/server/internal/daemon/execenv/runtime_config_sections.go
@@ -520,25 +520,46 @@ func writeWorkflowAutopilot(b *strings.Builder, ctx TaskContextForEnv) {
b.WriteString("- " + AutopilotIssueCommandsGuard + "\n\n")
}
-// writeWorkflowIssue emits the single issue workflow used by BOTH
-// assignment-triggered and comment-triggered runs.
-//
-// One section, not two, because this text lands in messages[0] — ahead of the
-// whole conversation — and any divergence between the first run and later runs
-// on the same resumed session throws away the prompt cache for the entire
-// history (MUL-5377). So nothing here may depend on which trigger fired this
-// turn, and no per-run identifier (trigger comment id, thread id, new-comment
-// delta, reply targets) may be interpolated. Those travel in the per-turn user
-// message instead; see daemon.buildCommentPrompt.
-//
-// The two modes are expressed as a router rather than two concatenated step
-// lists: the mode-specific status rules live INSIDE their own mode block so
-// the unconditional arc and the conditional one can never be read as peer
-// instructions with no arbitration. Ownership mode opens the arc on every
-// turn (the trigger itself is the intent); Reply mode opens it only when the
-// turn does substantive work on an issue assigned to this agent.
-//
-// Step 3 asks for a roots scan first, not `--recent 10` (MUL-5372). `--recent N`
+// writeWorkflowIssue emits the single issue workflow used by every
+// issue-bound run, whatever triggered it.
+//
+// One section with no per-trigger branching, because this text lands in
+// messages[0] — ahead of the whole conversation — and any divergence between
+// the first run and later runs on the same resumed session throws away the
+// prompt cache for the entire history (MUL-5377). So nothing here may depend
+// on which trigger fired this turn, and no per-run identifier (trigger comment
+// id, thread id, new-comment delta, reply targets) may be interpolated. Those
+// travel in the per-turn user message instead; see daemon.buildCommentPrompt.
+//
+// There is deliberately no "turn mode" anymore (MUL-6417). The Reply/Ownership
+// split dated from PR #205 and was already merged in substance by MUL-5377
+// (one section, mode router) and MUL-6300 (reply turns own the same status
+// arc); what remained was a marker plus two small blocks restating information
+// the per-turn message already carries as data. The two rules that replace the
+// router:
+//
+// - Delivery routes on data: the per-turn message either carries a
+// triggering comment with this turn's --parent value (reply in that
+// thread) or it does not (post a new top-level comment).
+// - Status is judged once, at the END of the turn, from what the work
+// actually changed about the issue — not from the trigger type, not from
+// the run lifecycle, and not gated on being the assignee. Lifecycle
+// writes oscillate under concurrent runs (every run flips its own
+// open/close pair — the churn MUL-6300's assignee gate existed to stop);
+// fact writes converge, because agents judging the same fact write the
+// same value or nothing. The board's in-flight signal is the issue
+// activity indicator, which renders independently of status, so no
+// opening in_progress write is needed — and a todo issue the agent was
+// only asked to research correctly stays todo, which the old
+// unconditional arc got wrong twice.
+//
+// The invariants MUL-6300 pinned survive as consequences instead of gates: a
+// conversational turn changes nothing about the issue's state, so it writes
+// nothing; an @mention pull-in on someone else's (or an unassigned) issue
+// almost never changes its state, so it writes nothing — but a turn that
+// genuinely does move the work may now record it, whoever the assignee is.
+//
+// Step 2 asks for a roots scan first, not `--recent 10` (MUL-5372). `--recent N`
// caps THREADS, not comments: each returned thread carries its root plus every
// descendant with no depth cap, so on an issue with fewer than N root threads it
// returns the entire comment history. Because this step is mandatory and fires on
@@ -554,92 +575,38 @@ func writeWorkflowAutopilot(b *strings.Builder, ctx TaskContextForEnv) {
// is the single discovery point for the comment-read surface; repeating them per
// step is what made this one bloat in the first place.
//
-// Ordinary agents own the full status arc for their issue: open with
-// in_progress, deliver with in_review. That arc is the agent's on BOTH
-// modes (MUL-6300) — a comment asking for rework is the same work as an
-// assignment, so gating the arc on trigger type left delivered-then-reworked
-// issues stale until a human moved the card. What stays out of the arc is
-// what never carried work: conversational turns, and turns on an issue not
-// assigned to this agent (someone else's, or unassigned).
-//
-// Squad leaders share the opening in_progress step so the parent leaves todo
-// as soon as coordination starts, but their first assignment turn is only a
-// dispatch — flipping the parent to in_review there would mark unfinished
-// multi-stage work as ready for review. Leaders move the parent to in_review
-// later, when a re-trigger (member update / stage barrier) confirms the
-// overall goal is met; see the Squad Operating Protocol and child-done system
-// comments.
+// Squad leaders keep one status bullet: a dispatch turn leaves the parent
+// mid-flight, so its end-of-turn fact is in_progress, and in_review waits for
+// the re-trigger (member update / stage barrier) that confirms the overall
+// goal is met. Flipping the parent on the dispatch turn would mark unfinished
+// multi-stage work as ready for review; see the Squad Operating Protocol and
+// child-done system comments.
//
// ctx.IsSquadLeader is a PER-TASK role, not agent configuration: branching on
// it here does move brief bytes when the same agent runs leader one turn and
// worker the next. Owner-accepted tradeoff; decision recorded in MUL-5811.
func writeWorkflowIssue(b *strings.Builder, ctx TaskContextForEnv) {
- b.WriteString("**Turn mode.** The per-turn user message names this run's mode on a line of its own: `Turn mode: Reply.` (respond to the comment that message carries — it brings the triggering comment's id and your `--parent` value) or `Turn mode: Ownership.` (an assignment or status change started this run). Steps 1–5 are shared; then **apply exactly one mode block, the one the user message named** — they differ on issue status. No mode line → Reply mode.\n\n")
+ b.WriteString("**Every issue turn runs the same workflow.** The per-turn user message carries what triggered this run — an assignment handoff, or a triggering comment with its id and your `--parent` value — plus this issue's real id and ready-to-run context-read commands; assemble other calls from `## Available Commands`.\n\n")
- b.WriteString("**Steps 1–5 — both modes** (the per-turn user message carries this issue's real id and ready-to-run context-read commands; assemble other calls from `## Available Commands`)\n\n")
b.WriteString("1. Read the issue (`multica issue get`) to understand the context — its JSON already carries the issue's `metadata` bag (empty `{}` is normal), so no separate metadata read is needed. What to look for: `## Issue Metadata`.\n")
- b.WriteString("2. Catch up on the comment history — this is mandatory, not optional — in two bounded reads, never one bulk pull: scan every thread cheaply (`--roots-only --summary --compact`), then expand only the threads that matter (`--thread <id> --tail 30 --compact`). Earlier comments often carry context the issue body lacks. Skipping this step is the most common cause of agents acting on stale or incomplete instructions — so always run the scan, even when the trigger looks self-contained. In Reply mode the per-turn user message names the thread to expand first; the scan is how you decide whether any OTHER thread is also relevant.\n")
+ b.WriteString("2. Catch up on the comment history — this is mandatory, not optional — in two bounded reads, never one bulk pull: scan every thread cheaply (`--roots-only --summary --compact`), then expand only the threads that matter (`--thread <id> --tail 30 --compact`). Earlier comments often carry context the issue body lacks. Skipping this step is the most common cause of agents acting on stale or incomplete instructions — so always run the scan, even when the trigger looks self-contained. When a comment triggered this run, the per-turn user message names the thread to expand first; the scan is how you decide whether any OTHER thread is also relevant.\n")
b.WriteString("3. Complete the task within your Agent Identity boundaries (`## Instruction Precedence` lists the actions Agent Identity can forbid). If your role is delegation-only, perform the allowed delegation work and stop once that outcome is delivered. Before self-assigning, check the target issue's comment history for an existing claim and any `## Active sibling runs` block; when assignment or status only records ownership/progress for work already underway, pass `--no-start` on every such command (the default start behavior is for handing off fresh work).\n")
if ctx.IsSquadLeader {
- b.WriteString("4. **Post your final results as a comment** (unless your outcome is `no_action` — in that case, calling `multica squad activity <issue-id> no_action --reason \"...\"` alone is sufficient; you MUST exit without posting any comment. DO NOT post a comment announcing no_action or saying you are exiting silently): post it with `multica issue comment add` using the platform-correct non-inline mode from ## Comment Formatting (never inline `--content`). Your results are only visible to the user if posted via this CLI call; text in your terminal or run logs is NOT delivered.\n")
+ b.WriteString("4. **Post your final results as a comment** (unless your outcome is `no_action` — in that case, calling `multica squad activity <issue-id> no_action --reason \"...\"` alone is sufficient; you MUST exit without posting any comment. DO NOT post a comment announcing no_action or saying you are exiting silently): post it with `multica issue comment add` using the platform-correct non-inline mode from ## Comment Formatting (never inline `--content`). When the per-turn user message carries a triggering comment, reply in its thread with the `--parent` value it gives you for THIS turn (never one from an earlier turn); when it lists several threads, post one reply per thread. With no triggering comment, post a new top-level comment. Your results are only visible to the user if posted via this CLI call; text in your terminal or run logs is NOT delivered.\n")
} else {
- b.WriteString("4. **Post your final results as a comment — this step is mandatory**: post it with `multica issue comment add` using the platform-correct non-inline mode from ## Comment Formatting (never inline `--content`). `## Output` states why this call is the only delivery channel.\n")
+ b.WriteString("4. **Post your final results as a comment — this step is mandatory**: post it with `multica issue comment add` using the platform-correct non-inline mode from ## Comment Formatting (never inline `--content`). When the per-turn user message carries a triggering comment, reply in its thread with the `--parent` value it gives you for THIS turn (never one from an earlier turn); when it lists several threads, post one reply per thread. With no triggering comment, post a new top-level comment. `## Output` states why this call is the only delivery channel.\n")
}
b.WriteString("5. Before exiting, pin or clear a metadata key via `multica issue metadata set`/`delete` only if it clears the bar in `## Issue Metadata`. Most runs write nothing here — that is the expected outcome, not a gap. When in doubt, do not write.\n\n")
- b.WriteString("**Ownership mode only — you own the issue status this run** (skip any status call below that your Agent Identity forbids)\n\n")
- b.WriteString("- Before step 3, run `multica issue status <issue-id> in_progress`.\n")
+ b.WriteString("**Issue status — judge once, at the end of the turn** (skip any status call your Agent Identity forbids)\n\n")
+ b.WriteString("Status reflects the state the ISSUE is in, not your run's lifecycle: a run in flight is already visible on the issue, so do not open with a status write. When your work is done, write the status the issue is now actually in — only if it differs from the current value, whoever the assignee is:\n\n")
+ b.WriteString("- You delivered what the issue itself asks for and it awaits acceptance → `in_review`. Delivering an issue assigned to you — including a sub-issue in a chain or stage — always lands here; stage barriers and parent notifications depend on that signal. `done` stays human.\n")
+ b.WriteString("- The issue's work continues beyond this turn — you dispatched sub-issues, or delivered one part with more underway → `in_progress`.\n")
+ b.WriteString("- You cannot proceed without something you are missing → `blocked`, and post a comment explaining the blocker unless your Agent Identity forbids issue comments.\n")
if ctx.IsSquadLeader {
- b.WriteString("- After this initial dispatch, leave the parent issue `in_progress` — do NOT move it to `in_review` or `done` on this turn. Dispatching members is not completion. You will be re-triggered when members post updates or a stage closes; only then, if the overall goal is met, move the parent to `in_review`.\n")
- } else {
- b.WriteString("- When done, run `multica issue status <issue-id> in_review`.\n")
- }
- b.WriteString("- If blocked, run `multica issue status <issue-id> blocked`, and post a comment explaining the blocker unless your Agent Identity forbids issue comments.\n\n")
-
- b.WriteString("**Reply mode only — respond to the comment in the user message**\n\n")
- b.WriteString("- Respond to THAT specific comment; take its id from the user message, never from this file or from an earlier turn.\n")
- if ctx.IsSquadLeader {
- b.WriteString("- **Squad leader rule:** If your evaluation outcome is `no_action`, call `multica squad activity <issue-id> no_action --reason \"...\"` and then EXIT IMMEDIATELY. DO NOT post any comment whose only purpose is to announce that you are taking no action, exiting silently, or acknowledging another agent. A comment like \"No action needed\" or \"Exiting silently\" is noise — the `squad activity` call already records your decision in the timeline.\n")
- }
- b.WriteString("- Do any requested work first, then **decide whether to include any `@mention` link.** The default is NO mention; `## Mentions` states when one is warranted.\n")
- if ctx.IsSquadLeader {
- b.WriteString("- **Unless your outcome is `no_action` (Squad leader rule above), posting your reply as a comment is mandatory** (`## Output`). Use the `--parent` value the per-turn user message gives you for this turn; do NOT reuse a `--parent` from an earlier turn in this session. When that message lists more than one thread to answer, post one reply per thread instead of merging them.\n")
- } else {
- b.WriteString("- **Posting your reply as a comment is mandatory** (`## Output`). Use the `--parent` value the per-turn user message gives you for this turn; do NOT reuse a `--parent` from an earlier turn in this session. When that message lists more than one thread to answer, post one reply per thread instead of merging them.\n")
- }
- if ctx.IsSquadLeader {
- // A leader's authority over the parent's status comes from the Squad
- // Operating Protocol's "Own the parent issue status" responsibility,
- // which the server injects ONLY when the issue is assigned to this
- // squad (see buildSquadLeaderBriefing). Naming that section is what
- // keeps this bullet correct on both leader paths: a guest leader —
- // @squad-mentioned on an issue owned by someone else — never receives
- // the grant, so the no-status-writes half below governs.
- //
- // The leader's arc is not the ordinary one: dispatch is not delivery,
- // so the parent stays in_progress until a later re-trigger confirms
- // the goal is met.
- b.WriteString("- Issue status: your instructions may grant you ownership of this issue's status (the Squad Operating Protocol's \"Own the parent issue status\" responsibility — it only appears when this issue is assigned to your squad). When present, treat it as standing: keep the parent `in_progress` while members work, and move it to `in_review` on the turn you confirm the overall goal is met, without waiting to be asked. Dispatching members is not completion. When absent, this issue is not yours: never run `multica issue status` on it. Purely conversational turns (question, discussion, acknowledgement) never touch status.\n\n")
- } else {
- // MUL-6300 replaces the original "do NOT change the issue status
- // unless the comment explicitly asks for it" (PR #205) with the arc
- // this rule always meant to protect. That prohibition was written to
- // stop conversational turns from churning the board, but it also
- // covered the most common real trigger — a comment asking for rework
- // on a delivered issue — so the status sat stale until a human moved
- // the card by hand.
- //
- // Two invariants survive verbatim from #205 / #2918, and the guard
- // tests pin both: a conversational turn never writes status, and a
- // turn on an issue not assigned to this agent never writes status
- // either. The second is deliberately "not assigned to you", not
- // "assigned to someone else": an @mention can also land the agent on
- // an UNASSIGNED issue (triage), and that case must stay no-write too.
- // Whether this agent is the assignee is answerable on every turn:
- // step 1 already reads `assignee_id`, and `## Agent Identity` carries
- // this agent's own id.
- b.WriteString("- Issue status: when this issue is assigned to you and this turn does substantive work on it, own the status arc as Ownership mode does — set `in_progress` when you start, and at turn end set the status the work has reached (delivered and awaiting acceptance = `in_review`; `done` stays human). Purely conversational turns (question, discussion, acknowledgement) never touch status; neither does any turn on an issue not assigned to you.\n\n")
+ b.WriteString("- Squad leader: dispatching members is not delivery — a dispatch turn leaves the parent `in_progress`, and it moves to `in_review` only on the later turn (a member update or stage-barrier re-trigger) where you confirm the overall goal is met.\n")
}
+ b.WriteString("- Your turn only researched, answered, reviewed, or discussed — the issue's own state did not move → write nothing. A `todo` issue you were asked to research stays `todo`; questions, discussion, and acknowledgements never touch status. This no-write default is what keeps concurrent runs from flapping the board.\n\n")
}
// writeSubIssueCreation emits the Sub-issue Creation section.
@@ -695,7 +662,19 @@ func writeMentions(b *strings.Builder) {
b.WriteString("- `[Project Name](mention://project/<project-id>)` — clickable link (no side effect)\n")
b.WriteString("- `[@Name](mention://member/<user-id>)` — **notifies a human**\n")
b.WriteString("- `[@Name](mention://agent/<agent-id>)` — **enqueues a new run for that agent**\n\n")
- b.WriteString("Default: NO mention — an accidental `@mention` restarts an agent-to-agent loop and costs the user money. Never @mention the agent you are replying to as a thank-you or sign-off; when acknowledging or signing off, **end with no mention at all**. Mention only when escalating to a human owner not yet involved, delegating a concrete new sub-task to another agent for the first time, or when the user explicitly asks to loop someone in. Silence ends conversations.\n\n")
+ // No prescriptive default here (MUL-6417): the mention syntax hides its
+ // semantics — it reads like a free social gesture but is a spawn/notify
+ // operation — so what this paragraph must supply is the facts that
+ // invalidate the human-@-culture prior (cc-for-visibility, thanks-@X),
+ // not a rule. Every real incident was an agent acting on a false need:
+ // notifying followers who already see the comment (completion wakes are
+ // platform-owned too) or courtesy (a thank-you run whose only reply is
+ // another thank-you run). The notify caveat is scoped to FOLLOWERS on
+ // purpose — for a human who does not follow the issue, a mention is
+ // exactly how they find out, and that escalation must stay available
+ // (Elon's review catch on #7245). The cost asymmetry line is what breaks
+ // the ambiguous middle.
+ b.WriteString("A mention pulls someone into work they are not doing yet: escalate to a human owner, hand another agent a concrete new sub-task, loop someone in because the user asked. It is not needed merely to notify — followers of the issue already see your comment, and completion notifications are platform-owned. A thank-you / sign-off / FYI mention of another agent enqueues a paid run whose only possible reply is another courtesy; a missed mention costs one follow-up ask, a stray one costs a run. Silence ends conversations.\n\n")
}
// writeAttachments emits the Attachments pointer.
diff --git a/server/internal/daemon/execenv/runtime_config_test.go b/server/internal/daemon/execenv/runtime_config_test.go
index c3d84730d3..407b0f5e87 100644
--- a/server/internal/daemon/execenv/runtime_config_test.go
+++ b/server/internal/daemon/execenv/runtime_config_test.go
@@ -139,19 +139,21 @@ func TestBriefHasNoParentNotificationGuidance(t *testing.T) {
}
}
-// Reply mode owns the same status arc as Ownership mode, but only for turns
-// that carry work on this agent's own issue (MUL-6300). Two invariants from
-// the original prohibition (PR #205, reinforced by Elon's blocking review on
-// PR #2918) survive it and are pinned here:
+// The status rule is a single end-of-turn fact judgment (MUL-6417): no
+// trigger-type modes, no assignee gate, no opening in_progress write. The two
+// invariants MUL-6300 pinned as gates (PR #205, reinforced by Elon's blocking
+// review on PR #2918) survive as consequences of the fact anchor and stay
+// pinned here:
//
-// - a purely conversational turn never writes status;
-// - a turn on an issue not assigned to this agent never writes status
-// (someone else's issue, or an unassigned one reached via @mention).
+// - a purely conversational turn changes nothing about the issue's state,
+// so it writes nothing;
+// - concurrently triggered agents judging the same fact write the same
+// value or nothing, so the board cannot flap.
//
// The brief must also still carry no unconditional placeholder flip: a bare
// `multica issue status <this-issue-id> in_review` command would fire on every
-// reply turn regardless of whether the turn delivered anything.
-func TestReplyModeStatusRuleIsScopedToOwnedWorkTurns(t *testing.T) {
+// turn regardless of whether the turn delivered anything.
+func TestStatusRuleIsEndOfTurnFactJudgment(t *testing.T) {
t.Parallel()
ctx := TaskContextForEnv{
IssueID: "55555555-6666-7777-8888-999999999999",
@@ -160,66 +162,53 @@ func TestReplyModeStatusRuleIsScopedToOwnedWorkTurns(t *testing.T) {
out := buildMetaSkillContent("claude", ctx)
if strings.Contains(out, "`multica issue status <this-issue-id> in_review`") {
- t.Errorf("reply brief must not contain a placeholder `<this-issue-id> in_review` flip — the arc is conditional on the turn having delivered work")
+ t.Errorf("brief must not contain a placeholder `<this-issue-id> in_review` flip — status is judged from what the turn delivered")
}
for _, want := range []string{
- // The arc itself: both ends, and the ceiling that keeps `done` human.
- "when this issue is assigned to you and this turn does substantive work on it",
- "set `in_progress` when you start",
- "delivered and awaiting acceptance = `in_review`; `done` stays human",
- // Invariant 1: conversation does not move the board.
- "Purely conversational turns (question, discussion, acknowledgement) never touch status",
- // Invariant 2: no status writes on an issue not assigned to this agent —
- // "not assigned to you" on purpose, so the unassigned @mention path is
- // covered, not just issues owned by someone else.
- "neither does any turn on an issue not assigned to you",
+ // The anchor: issue state, not run lifecycle, judged once at the end.
+ "**Issue status — judge once, at the end of the turn**",
+ "Status reflects the state the ISSUE is in, not your run's lifecycle",
+ "so do not open with a status write",
+ // No assignee gate: the judgment applies to whoever is running.
+ "whoever the assignee is",
+ // Delivery lands in in_review and the ceiling keeps `done` human.
+ "`done` stays human",
+ // Assigned deliverables must not be misread as status-neutral
+ // research: stage barriers and parent notifications key off the
+ // delivery write.
+ "stage barriers and parent notifications depend on that signal",
+ // Invariant 1: conversation does not move the board...
+ "questions, discussion, and acknowledgements never touch status",
+ // ...and a research-only ask leaves a todo issue in todo — the case
+ // the old unconditional arc got wrong twice (MUL-6417).
+ "A `todo` issue you were asked to research stays `todo`",
+ // Invariant 2: concurrent agents converge instead of flapping.
+ "This no-write default is what keeps concurrent runs from flapping the board",
} {
if !strings.Contains(out, want) {
- t.Errorf("reply-mode status rule missing %q\n---\n%s", want, out)
+ t.Errorf("status rule missing %q\n---\n%s", want, out)
}
}
- // The squad-leader carve-out below must not leak into the ordinary path.
- if strings.Contains(out, "Own the parent issue status") {
- t.Errorf("ordinary-agent comment brief must not reference the squad status grant:\n%s", out)
- }
-}
-
-// A squad leader's authority over the parent's status is granted by the Squad
-// Operating Protocol, not by this brief: the server injects "Own the parent
-// issue status" only when the issue is assigned to THIS squad. The reply-mode
-// bullet therefore routes on that section by name, so the same text is correct
-// for an owning leader (dispatch, wait, then in_review) and for a guest leader
-// @squad-mentioned on someone else's issue (no status writes at all).
-func TestCommentTriggeredSquadLeaderDefersToStatusOwnershipGrant(t *testing.T) {
- t.Parallel()
- out := buildMetaSkillContent("claude", TaskContextForEnv{
- IssueID: "55555555-6666-7777-8888-999999999999",
- TriggerCommentID: "66666666-7777-8888-9999-aaaaaaaaaaaa",
- IsSquadLeader: true,
- })
-
- for _, want := range []string{
- `Squad Operating Protocol's "Own the parent issue status"`,
- "only appears when this issue is assigned to your squad",
- "without waiting to be asked",
- // Dispatch is not delivery: without this the leader would close out
- // the parent on the turn it hands work to members.
- "Dispatching members is not completion.",
- // No grant → no status writes, the guest-leader path (MUL-3724).
- "When absent, this issue is not yours: never run `multica issue status` on it.",
- "Purely conversational turns (question, discussion, acknowledgement) never touch status",
+ // The retired gates must not come back: no trigger-type modes, no
+ // assignee-scoped arc, no opening flip.
+ for _, banned := range []string{
+ "Turn mode",
+ "Ownership mode",
+ "Reply mode",
+ "when this issue is assigned to you and this turn does substantive work on it",
+ "set `in_progress` when you start",
+ "Before step 3, run `multica issue status",
} {
- if !strings.Contains(out, want) {
- t.Errorf("squad-leader comment brief missing %q\n---\n%s", want, out)
+ if strings.Contains(out, banned) {
+ t.Errorf("brief still carries retired status gate %q (MUL-6417)\n---\n%s", banned, out)
}
}
- // The leader must NOT inherit the ordinary agent's arc: it keys off
- // assignment to the agent itself, which is never true for a squad parent.
- if strings.Contains(out, "when this issue is assigned to you and this turn does substantive work on it") {
- t.Errorf("squad-leader comment brief must not carry the ordinary-agent status arc\n---\n%s", out)
+ // The squad-leader bullet must not leak into the ordinary path.
+ if strings.Contains(out, "dispatching members is not delivery") {
+ t.Errorf("ordinary-agent brief must not carry the squad-leader status bullet:\n%s", out)
}
}
@@ -386,16 +375,16 @@ func TestIssueWorkflowHonorsAgentIdentity(t *testing.T) {
// type Agent Identity can forbid. This and workflow step 3 each used to
// carry their own list and the two disagreed (MUL-5442).
"Never treat this runtime workflow as permission to change issue status, investigate, implement, create issues, update issues, delegate, or otherwise act beyond your Agent Identity.",
- // MUL-5442: the forbids-clause is stated once on the Ownership-mode
- // header instead of once per status bullet.
- "skip any status call below that your Agent Identity forbids",
- "Before step 3, run `multica issue status <issue-id> in_progress`.",
+ // MUL-5442 (carried through MUL-6417): the forbids-clause is stated
+ // once on the status-rule header instead of once per status bullet.
+ "skip any status call your Agent Identity forbids",
"Complete the task within your Agent Identity boundaries",
// Step 3 keeps only what the enumeration cannot express: a
// delegation-only role stops once the delegation is delivered.
"If your role is delegation-only, perform the allowed delegation work and stop once that outcome is delivered",
- "When done, run `multica issue status <issue-id> in_review`.",
- "If blocked, run `multica issue status <issue-id> blocked`, and post a comment explaining the blocker unless your Agent Identity forbids issue comments.",
+ // The blocked end-state keeps its own comment carve-out: an agent
+ // whose identity forbids comments must still be able to mark blocked.
+ "post a comment explaining the blocker unless your Agent Identity forbids issue comments",
} {
if !strings.Contains(out, want) {
t.Errorf("issue brief missing identity-bound workflow text %q\n---\n%s", want, out)
@@ -413,8 +402,11 @@ func TestIssueWorkflowHonorsAgentIdentity(t *testing.T) {
}
}
-// Squad-leader briefs must open the parent with in_progress, but must not
-// treat the first dispatch turn as completion (no unconditional in_review).
+// A squad leader's dispatch turn must not read as completion: the end-of-turn
+// fact is in_progress, and in_review waits for the re-trigger that confirms
+// the overall goal is met. Without this bullet the general rule's "delivered →
+// in_review" reading would let a leader close out the parent on the very turn
+// it hands work to members.
func TestSquadLeaderIssueWorkflowKeepsParentInProgress(t *testing.T) {
t.Parallel()
const issueID = "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"
@@ -424,22 +416,16 @@ func TestSquadLeaderIssueWorkflowKeepsParentInProgress(t *testing.T) {
})
for _, want := range []string{
- "Before step 3, run `multica issue status <issue-id> in_progress`.",
- "After this initial dispatch, leave the parent issue `in_progress`",
- // The guest-leader contract test (handler side) bans any runnable
- // in_review command shape from reaching a guest — the dispatch rule
- // therefore states the prohibition without a command form.
- "do NOT move it to `in_review` or `done` on this turn",
- "only then, if the overall goal is met, move the parent to `in_review`",
+ "dispatching members is not delivery",
+ "a dispatch turn leaves the parent `in_progress`",
+ "where you confirm the overall goal is met",
+ // The shared no-write default still governs leader conversation turns.
+ "questions, discussion, and acknowledgements never touch status",
} {
if !strings.Contains(out, want) {
t.Errorf("squad-leader issue brief missing %q\n---\n%s", want, out)
}
}
-
- if strings.Contains(out, "When done, run `multica issue status <issue-id> in_review`") {
- t.Errorf("squad-leader issue brief must not contain the ordinary-agent completion step\n---\n%s", out)
- }
}
// TestProtocolHeadingInInstructionsGetsNoLeaderBrief is the brief-side half of
@@ -466,16 +452,15 @@ func TestProtocolHeadingInInstructionsGetsNoLeaderBrief(t *testing.T) {
for _, banned := range []string{
"### Squad maintenance",
"multica squad member set-role",
- "Squad leader rule:",
"multica squad activity",
- `Squad Operating Protocol's "Own the parent issue status"`,
- "After this initial dispatch, leave the parent issue `in_progress`",
+ "unless your outcome is `no_action`",
+ "dispatching members is not delivery",
} {
if strings.Contains(out, banned) {
t.Fatalf("ordinary-agent brief leaked leader-only content %q\n---\n%s", banned, out)
}
}
- if !strings.Contains(out, "**Posting your reply as a comment is mandatory**") {
+ if !strings.Contains(out, "**Post your final results as a comment — this step is mandatory**") {
t.Fatalf("ordinary-agent brief lost the unconditional reply obligation\n---\n%s", out)
}
}
diff --git a/server/internal/daemon/prompt.go b/server/internal/daemon/prompt.go
index bf2fdad90d..01f1656c66 100644
--- a/server/internal/daemon/prompt.go
+++ b/server/internal/daemon/prompt.go
@@ -47,22 +47,6 @@ func backendResumeContinuityNotice(task Task) string {
return sessionContinuityNoticeFor(task)
}
-// Turn-mode markers consumed by the runtime brief's mode router
-// (execenv.writeWorkflowIssue). The brief is byte-identical on every run and
-// therefore cannot say what triggered this turn; these lines do, and they are
-// emitted unconditionally from the same branches BuildPrompt uses to pick a
-// path, so the two can never disagree.
-//
-// Reply mode = respond to the triggering comment; the status arc opens only
-// when the turn does substantive work on an issue assigned to this agent
-// (MUL-6300). Ownership mode = an assignment/status change started this run;
-// own the status arc unconditionally. Applying the wrong one changes when
-// issue status moves.
-const (
- turnModeReply = "**Turn mode: Reply.** Follow the Reply-mode block in your runtime workflow file for this turn; the Ownership-mode status steps do not apply.\n\n"
- turnModeOwnership = "**Turn mode: Ownership.** Follow the Ownership-mode block in your runtime workflow file for this turn; the Reply-mode rules do not apply.\n\n"
-)
-
// perTurnContextBlocks renders the run-scoped context blocks that used to live
// in the runtime brief (CLAUDE.md / AGENTS.md).
//
@@ -158,7 +142,6 @@ func buildPromptBody(task Task, provider string) string {
var b strings.Builder
b.WriteString("You are running as a local coding agent for a Multica workspace.\n\n")
fmt.Fprintf(&b, "Your assigned issue ID is: %s\n\n", task.IssueID)
- b.WriteString(turnModeOwnership)
// Assignment handoff (MUL-3375): a free-text instruction the person who
// assigned/promoted this issue left for you. Frame it as a handoff, not a
// comment to reply to — there is no comment thread to answer here.
@@ -285,13 +268,6 @@ func buildCommentPrompt(task Task, provider string) string {
var b strings.Builder
b.WriteString("You are running as a local coding agent for a Multica workspace.\n\n")
fmt.Fprintf(&b, "Your assigned issue ID is: %s\n\n", task.IssueID)
- // Mode marker for the brief's router. Emitted unconditionally from the same
- // branch that selects this code path, so the brief and the prompt can never
- // disagree about which mode this turn is in. It must NOT be gated on
- // TriggerCommentContent: an empty comment body (or an older server that
- // doesn't send one) would otherwise leave the turn unlabelled, and the
- // agent would fall through to Ownership mode and change the issue status.
- b.WriteString(turnModeReply)
if task.TriggerCommentContent != "" {
authorLabel := "A user"
if task.TriggerAuthorType == "system" {
diff --git a/server/internal/daemon/prompt_test.go b/server/internal/daemon/prompt_test.go
index 4a37390370..3219e71f07 100644
--- a/server/internal/daemon/prompt_test.go
+++ b/server/internal/daemon/prompt_test.go
@@ -1620,74 +1620,23 @@ func TestPerTurnContextBlocksOnAssignmentPath(t *testing.T) {
}
}
-// TestTurnModeMarkerAlwaysPresent is the regression guard for the review
-// finding on #6021: the brief's mode router keys off an explicit marker in the
-// per-turn prompt, so that marker must be emitted unconditionally from the same
-// branch that selects the code path.
-//
-// The dangerous case is a comment-triggered run whose comment body is empty (or
-// an older server that doesn't send one). Before this guard the prompt emitted
-// no `[NEW COMMENT]` block at all, the brief fell through to Ownership mode,
-// and the agent would change the issue status on a turn that must not.
-func TestTurnModeMarkerAlwaysPresent(t *testing.T) {
- t.Parallel()
-
- cases := []struct {
- name string
- task Task
- want string
- deny string
- }{
- {
- name: "comment-triggered with content",
- task: Task{IssueID: "issue-1", TriggerCommentID: "c-1", TriggerCommentContent: "please look"},
- want: "**Turn mode: Reply.**",
- deny: "**Turn mode: Ownership.**",
- },
- {
- name: "comment-triggered with EMPTY content",
- task: Task{IssueID: "issue-1", TriggerCommentID: "c-1"},
- want: "**Turn mode: Reply.**",
- deny: "**Turn mode: Ownership.**",
- },
- {
- name: "assignment-triggered",
- task: Task{IssueID: "issue-1"},
- want: "**Turn mode: Ownership.**",
- deny: "**Turn mode: Reply.**",
- },
- {
- name: "assignment-triggered with handoff note",
- task: Task{IssueID: "issue-1", HandoffNote: "start with the API"},
- want: "**Turn mode: Ownership.**",
- deny: "**Turn mode: Reply.**",
- },
- }
-
- for _, tc := range cases {
- tc := tc
- t.Run(tc.name, func(t *testing.T) {
- t.Parallel()
- prompt := BuildPrompt(tc.task, "claude")
- if !strings.Contains(prompt, tc.want) {
- t.Errorf("prompt missing turn-mode marker %q\n---\n%s", tc.want, prompt)
- }
- if strings.Contains(prompt, tc.deny) {
- t.Errorf("prompt carries the wrong turn-mode marker %q\n---\n%s", tc.deny, prompt)
- }
- })
- }
-}
-
-// The mode marker only makes sense for the two issue paths — the issue-less
-// kinds have no Reply/Ownership distinction and no issue status to protect.
-func TestTurnModeMarkerAbsentOnIssuelessKinds(t *testing.T) {
+// TestTurnModeMarkersRetired pins MUL-6417: the Reply/Ownership turn-mode
+// split is gone, so no task kind may emit a `Turn mode:` marker. The brief no
+// longer carries a router to consume one, and a stray marker would read as an
+// instruction the brief never defines. The empty-content comment case is kept
+// from the old router guard: it exercised the branch that historically
+// misrouted, and it must stay marker-free like every other path.
+func TestTurnModeMarkersRetired(t *testing.T) {
t.Parallel()
for _, tc := range []struct {
name string
task Task
}{
+ {"comment-triggered with content", Task{IssueID: "issue-1", TriggerCommentID: "c-1", TriggerCommentContent: "please look"}},
+ {"comment-triggered with EMPTY content", Task{IssueID: "issue-1", TriggerCommentID: "c-1"}},
+ {"assignment-triggered", Task{IssueID: "issue-1"}},
+ {"assignment-triggered with handoff note", Task{IssueID: "issue-1", HandoffNote: "start with the API"}},
{"chat", Task{ChatSessionID: "chat-1"}},
{"quick-create", Task{QuickCreatePrompt: "make an issue"}},
{"autopilot", Task{AutopilotRunID: "run-1"}},
@@ -1696,34 +1645,30 @@ func TestTurnModeMarkerAbsentOnIssuelessKinds(t *testing.T) {
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
prompt := BuildPrompt(tc.task, "claude")
- for _, banned := range []string{"**Turn mode: Reply.**", "**Turn mode: Ownership.**"} {
- if strings.Contains(prompt, banned) {
- t.Errorf("%s prompt must not carry %q\n---\n%s", tc.name, banned, prompt)
- }
+ if strings.Contains(prompt, "Turn mode") {
+ t.Errorf("%s prompt must not carry a turn-mode marker (MUL-6417)\n---\n%s", tc.name, prompt)
}
})
}
}
-// The brief's router must describe the markers the prompt actually emits.
-// A drift here is exactly the bug this pair of changes fixes, and it is
-// invisible at runtime until an agent silently picks the wrong mode.
-func TestBriefModeRouterMatchesPromptMarkers(t *testing.T) {
+// The brief must not carry the retired mode router either — end-to-end through
+// InjectRuntimeConfig, so a reintroduction anywhere in the assembled brief
+// fails here even if the workflow section itself stays clean.
+func TestBriefCarriesNoModeRouter(t *testing.T) {
t.Parallel()
brief, err := execenv.InjectRuntimeConfig(t.TempDir(), "claude", execenv.TaskContextForEnv{IssueID: "issue-1"})
if err != nil {
t.Fatalf("InjectRuntimeConfig: %v", err)
}
- for _, want := range []string{"`Turn mode: Reply.`", "`Turn mode: Ownership.`"} {
- if !strings.Contains(brief, want) {
- t.Errorf("brief mode router does not name %s\n---\n%s", want, brief)
+ for _, banned := range []string{"Turn mode", "Ownership mode", "Reply mode", "mode block"} {
+ if strings.Contains(brief, banned) {
+ t.Errorf("brief still references the retired turn-mode split via %q (MUL-6417)\n---\n%s", banned, brief)
}
}
- // The retired wording keyed off the prompt's first line, which was never
- // actually the [NEW COMMENT] block.
- if strings.Contains(brief, "It opens with a `[NEW COMMENT]` block") {
- t.Error("brief still routes on the prompt's opening line; it must route on the explicit marker")
+ if !strings.Contains(brief, "**Issue status — judge once, at the end of the turn**") {
+ t.Errorf("brief lost the unified end-of-turn status rule\n---\n%s", brief)
}
}
diff --git a/server/internal/handler/squad_briefing.go b/server/internal/handler/squad_briefing.go
index 49e0d2376e..529e37a85a 100644
--- a/server/internal/handler/squad_briefing.go
+++ b/server/internal/handler/squad_briefing.go
@@ -74,15 +74,18 @@ Your responsibilities, in order:
// leader was woken on is assigned to THIS squad. Only then does the leader own
// the parent's status arc.
//
-// This grant is what the reply-mode leader bullet routes on, by section name:
-// present → the leader owns the parent's arc, absent → no status writes at
-// all (MUL-6300). The ordinary assignee-scoped arc never applies to a leader,
-// because the parent is assigned to the squad, not to the leader agent — so
-// without this section a leader could never wrap the parent up, and the
-// @mention-dispatch shape (no child issues, so no child-done system comment)
-// would leave it stuck in in_progress forever. The "even when no comment
-// asked you to" clause makes the standing nature explicit — keep the heading
-// text in sync with writeWorkflowIssue.
+// Since MUL-6417 the runtime brief has no grant routing that consumes this
+// section by name: the unified workflow judges status once, at the end of the
+// turn, from what the work changed, and the leader's only brief-side special
+// case is that a dispatch turn leaves the parent in_progress. This section's
+// job is the owning/guest permission boundary, drawn at the Agent Identity
+// layer (Instruction Precedence puts it above the workflow). The owning
+// leader needs the standing wrap-up instruction below — the @mention-dispatch
+// shape (no child issues, so no child-done system comment) never produces a
+// comment that asks for in_review, so without it the parent would sit in
+// in_progress forever; the guest leader gets the prohibition instead
+// (squadParentStatusNotOwned). Both compositions are pinned by
+// handler/squad_parent_status_contract_test.go.
const squadParentStatusOwned = `6. **Own the parent issue status.** This issue is assigned to your squad,
so its status is yours to manage (unless Agent Identity forbids status
changes). On the first assignment turn, move the parent to
diff --git a/server/internal/handler/squad_parent_status_contract_test.go b/server/internal/handler/squad_parent_status_contract_test.go
index 6a5e18fe8d..b4b79f1fe9 100644
--- a/server/internal/handler/squad_parent_status_contract_test.go
+++ b/server/internal/handler/squad_parent_status_contract_test.go
@@ -66,11 +66,12 @@ func TestSquadAssignedLeaderCanWrapUpOnCommentTurn(t *testing.T) {
"which contradicts the Own-the-parent-issue-status grant")
}
for _, want := range []string{
- // The carve-out must name the granting section, not gesture at it —
- // the leader has to be able to tell whether it applies to this turn.
- `Squad Operating Protocol's "Own the parent issue status"`,
- "only appears when this issue is assigned to your squad",
- "without waiting to be asked",
+ // MUL-6417: the brief's status rule is a fact judgment, and the
+ // leader bullet must point the same way as the briefing's grant —
+ // in_review is reached on the confirming turn, not on dispatch.
+ "dispatching members is not delivery",
+ "a dispatch turn leaves the parent `in_progress`",
+ "where you confirm the overall goal is met",
} {
if !strings.Contains(brief, want) {
t.Errorf("leader runtime brief missing %q\n--- brief ---\n%s", want, brief)
@@ -111,8 +112,9 @@ func TestGuestLeaderCannotChangeStatusOnCommentTurn(t *testing.T) {
}
}
- // But the grant is absent, so the runtime brief's grant branch has nothing
- // to activate and its no-status-writes branch governs.
+ // But the grant is absent: the briefing's prohibition governs (Agent
+ // Identity outranks the workflow), and the brief's fact-judgment rule
+ // (MUL-6417) hands the guest no runnable status command to contradict it.
if strings.Contains(briefing, "Own the parent issue status") {
t.Errorf("guest leader must not receive the status-ownership grant:\n%s", briefing)
}
diff --git a/server/internal/service/builtin_skills/multica-squads/references/squad-source-map.md b/server/internal/service/builtin_skills/multica-squads/references/squad-source-map.md
index f8a7071b22..c27ee87f9d 100644
--- a/server/internal/service/builtin_skills/multica-squads/references/squad-source-map.md
+++ b/server/internal/service/builtin_skills/multica-squads/references/squad-source-map.md
@@ -142,16 +142,16 @@ Contracts:
enqueue-time via `canEnqueueSquadLeader` (squad.go:1037);
- archived squad / archived leader rejected at assign-time (issue.go:2622-2627);
- pending task dedup is applied (squad.go:1042-1048);
-- parent status is agent-managed: the Ownership-mode block (`writeWorkflowIssue`
- with `IsSquadLeader`) requires `in_progress` on the first turn and forbids
- unconditional `in_review` on that dispatch turn; Squad Operating Protocol
- (`squad_briefing.go`) owns the ongoing `in_progress` → later `in_review`
- contract. `StartTask` / `CompleteTask` do not write issue status. On reply
- turns the leader's status bullet routes on that protocol responsibility by
- name: present (issue assigned to this squad) → wrap up with `in_review` when
- the goal is met, absent (guest leader) → no status writes at all. Ordinary
- agents get the assignee-scoped arc instead, which never fires for a squad
- parent because the parent is assigned to the squad, not to the leader agent.
+- parent status is agent-managed: since MUL-6417 the brief's status rule is a
+ single end-of-turn fact judgment (`writeWorkflowIssue`), and the leader
+ variant adds one bullet — dispatching members is not delivery, so a dispatch
+ turn leaves the parent `in_progress` and `in_review` waits for the re-trigger
+ that confirms the overall goal is met. Squad Operating Protocol
+ (`squad_briefing.go`) still states the ongoing `in_progress` → later
+ `in_review` responsibility for owning leaders. `StartTask` / `CompleteTask`
+ do not write issue status. There is no assignee gate anymore: a guest leader
+ writes nothing not because it lacks a grant but because a turn that did not
+ move the issue's state has nothing to record.
## Comment / Mention
@@ -232,10 +232,11 @@ Contracts:
ungated path; any future invocation gate must be added to BOTH together.
- parent status is not auto-advanced by the barrier: the system comment asks the
leader to continue or — when the overall goal is met — run
- `multica issue status <parent-id> in_review`. The write is authorized by the
- Squad Operating Protocol's standing "Own the parent issue status" grant
- (present exactly when the issue is assigned to this squad); the system
- comment marks the wrap-up moment, it is not the permission. `done` remains
+ `multica issue status <parent-id> in_review`. The Squad Operating Protocol's
+ standing "Own the parent issue status" responsibility (present exactly when
+ the issue is assigned to this squad) states the same expectation; the system
+ comment marks the wrap-up moment. Since MUL-6417 the write itself needs no
+ grant — the brief's end-of-turn fact judgment covers it — but `done` remains
human / integration owned.
## Private Leader Access
diff --git a/server/internal/service/builtin_skills/multica-working-on-issues/SKILL.md b/server/internal/service/builtin_skills/multica-working-on-issues/SKILL.md
index 08e8340f7d..159eb97017 100644
--- a/server/internal/service/builtin_skills/multica-working-on-issues/SKILL.md
+++ b/server/internal/service/builtin_skills/multica-working-on-issues/SKILL.md
@@ -189,17 +189,19 @@ on it. These are the contracts, not advice:
fires. Moving `backlog → todo` (or any non-done/non-cancelled status) enqueues
the assigned agent then.
- **`in_progress` / `in_review`** are agent-managed CLI mutations, not
- `StartTask` / `CompleteTask` side effects. The runtime brief asks ordinary
- agents for `todo`/`backlog` → `in_progress` then `in_review` when they have
- delivered. Ownership turns open that arc unconditionally; reply turns own the
- same arc, but only when the issue is assigned to you AND the turn does
- substantive work — a question, a discussion, or an acknowledgement never
- moves the status, and neither does a turn on an issue not assigned to you
- (someone else's, or unassigned — you were pulled in by an @mention either
- way). Squad leaders share the opening
- `in_progress` step on the first assignment turn, keep the parent there while
- members work, and only move to `in_review` when a later re-trigger confirms
- the overall goal is met.
+ `StartTask` / `CompleteTask` side effects. The runtime brief asks agents to
+ judge status once, at the END of a turn, from what the work changed about
+ the issue — not from the trigger type or the run's lifecycle, and not gated
+ on being the assignee: delivered the issue's own ask → `in_review`; work
+ continues beyond the turn (dispatched sub-issues, partial delivery) →
+ `in_progress`; stuck → `blocked`. A turn that only researched, answered,
+ reviewed, or discussed writes nothing — a `todo` issue researched on
+ request stays `todo`, and questions, discussion, or acknowledgements never
+ move the status. There is no opening `in_progress` write; the in-flight
+ run is already visible on the issue. Squad leaders: dispatching members is
+ not delivery — a dispatch turn leaves the parent `in_progress`, and it
+ moves to `in_review` only when a later re-trigger confirms the overall
+ goal is met.
- **`in_review`** is an accepted issue status. Some workflows use it while a PR
is open and awaiting review; moving to it is an explicit mutation.
- **`done`** on a child issue posts a system comment on its parent. If a PR
diff --git a/server/internal/service/builtin_skills/multica-working-on-issues/references/working-on-issues-source-map.md b/server/internal/service/builtin_skills/multica-working-on-issues/references/working-on-issues-source-map.md
index f2cd79214c..2e1ffe42fa 100644
--- a/server/internal/service/builtin_skills/multica-working-on-issues/references/working-on-issues-source-map.md
+++ b/server/internal/service/builtin_skills/multica-working-on-issues/references/working-on-issues-source-map.md
@@ -130,7 +130,7 @@ and is hidden from the PR list.
| Child → `done` notifies + wakes the parent, gated by the stage barrier | `server/internal/handler/issue_child_done.go:66` (`notifyParentOfChildDone`; doc comment at `:15`; barrier gate at `:115`) | func def `:51` |
| Status change (incl. → `cancelled`) does NOT cancel in-flight tasks; only issue deletion does (MUL-4465) | no-cancel note in `server/internal/handler/issue.go:2652-2658` (`UpdateIssue`) and `:3170-3171` (`BatchUpdateIssues`); deletion still cancels at `:2863` (`DeleteIssue`) / `:3239` (`BatchDeleteIssues`) via `CancelTasksForIssue` (`server/internal/service/task.go:1229`) | new citation |
| `StartTask` / `CompleteTask` do not write issue status (agent CLI owns progress) | `server/internal/service/task.go` (`StartTask` / `CompleteTask` comments) | new citation |
-| Runtime brief: ordinary agent `in_progress` then `in_review` (Ownership mode unconditionally, Reply mode only for work turns on its own issue); squad leader `in_progress` only on first dispatch | `server/internal/daemon/execenv/runtime_config_sections.go` (`writeWorkflowIssue`) | new citation |
+| Runtime brief: status judged once at end of turn from what the work changed (delivery → `in_review`, continuing → `in_progress`, stuck → `blocked`, research/conversation → no write; no assignee gate, no opening `in_progress`); squad leader dispatch is not delivery (MUL-6417) | `server/internal/daemon/execenv/runtime_config_sections.go` (`writeWorkflowIssue`) | new citation |
| Failed task may roll `in_progress` → `todo` when no active task remains | `server/internal/service/task.go` (`HandleFailedTasks`) | new citation |
Creation with `--status todo` (or any non-backlog status) on an agent-assigned
@@ -174,9 +174,9 @@ Advancement is agent-driven: the server only detects the closed barrier and
wakes the parent assignee. Promoting the next stage's `backlog` sub-issues to
`todo` is the woken agent's decision, not a server side effect. When the woken
assignee (often a squad leader) decides the parent is complete, the system
-comment explicitly asks for `multica issue status <parent-id> in_review`. A
-reply turn may move the status on its own too, but only when the issue is
-assigned to that agent and the turn actually delivered work.
+comment explicitly asks for `multica issue status <parent-id> in_review`. Any
+turn may move the status on its own too, judged at the end of the turn from
+what the work changed about the issue — there is no assignee gate (MUL-6417).
## Metadata CLI