Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
MUL-3502: OST-1161: Bound assignment comment catch-up
BeliyDym5fd3d01d1360
diff --git a/CLI_AND_DAEMON.md b/CLI_AND_DAEMON.mdindex 3c7fc90028..747fc41c81 100644--- a/CLI_AND_DAEMON.md+++ b/CLI_AND_DAEMON.md@@ -404,12 +404,12 @@ multica issue comment list <issue-id> --thread <comment-id> --tail 30 \# Most recently active threads (root + every descendant), grouped by# thread. Returns N complete conversational arcs, oldest-active first so# the freshest thread sits closest to "now" in an agent prompt.-multica issue comment list <issue-id> --recent 20+multica issue comment list <issue-id> --recent 10# Scroll older threads. Under --recent, --before / --before-id are a# THREAD cursor (thread last_activity_at + root id), emitted on stderr as# `Next thread cursor: --before <ts> --before-id <root-id>`.-multica issue comment list <issue-id> --recent 20 \+multica issue comment list <issue-id> --recent 10 \--before <ts> --before-id <root-id># Incremental polling. Combines with --thread or --recent; filters outdiff --git a/server/internal/daemon/execenv/execenv_test.go b/server/internal/daemon/execenv/execenv_test.goindex ea3fb04761..ee586bb278 100644--- a/server/internal/daemon/execenv/execenv_test.go+++ b/server/internal/daemon/execenv/execenv_test.go@@ -3790,11 +3790,15 @@ func TestInjectRuntimeConfigCommentTriggerColdStartRead(t *testing.T) {for _, want := range []string{"Read the triggering conversation first","multica issue comment list " + issueID + " --thread " + triggerID + " --tail 30 --output json",+ "multica issue comment list " + issueID + " --recent 10 --output json",} {if !strings.Contains(s, want) {t.Errorf("comment-triggered Workflow missing cold-start read %q\n---\n%s", want, s)}}+ if strings.Contains(s, "--recent 20") {+ t.Errorf("comment-triggered Workflow still uses recent 20\n---\n%s", s)+ }if strings.Contains(s, "new comment(s) since your last run") {t.Errorf("cold-start workflow must not render the since-delta hint\n---\n%s", s)}@@ -3873,11 +3877,9 @@ func TestInjectRuntimeConfigCommentTriggerResumedNoDeltaRead(t *testing.T) {}// TestInjectRuntimeConfigAssignmentTriggerMentionsRecent pins that the-// assignment-triggered Workflow keeps full-history reading as the mandatory-// default (the agent must still ingest earlier comments — that rule was-// added in MUL-1124) but ALSO points at `--recent N` as the long-issue-// alternative. Without this, the prompt would still be the only place-// telling the agent about --recent on busy issues.+// assignment-triggered Workflow keeps comment catch-up mandatory while bounding+// the mandatory first read to the recent active-thread window. Older context+// stays reachable through explicit pagination.func TestInjectRuntimeConfigAssignmentTriggerMentionsRecent(t *testing.T) {t.Parallel()@@ -3891,29 +3893,37 @@ func TestInjectRuntimeConfigAssignmentTriggerMentionsRecent(t *testing.T) {}s := string(data)- // Mandatory full-history rule (MUL-1124) must stay.+ // Mandatory comment catch-up must stay, but the required first read is+ // bounded to recent active threads instead of the full flat timeline.for _, want := range []string{- "multica issue comment list issue-1 --output json",+ "multica issue comment list issue-1 --recent 10 --output json","this is mandatory, not optional","Skipping this step is the most common cause",} {if !strings.Contains(s, want) {- t.Errorf("assignment Workflow regressed mandatory-history rule, missing %q\n---\n%s", want, s)+ t.Errorf("assignment Workflow regressed mandatory recent-first catch-up, missing %q\n---\n%s", want, s)}}- // AND --recent must be offered as the long-issue alternative.+ // Older context must remain reachable through pagination.for _, want := range []string{- "--recent 20 --output json","Next thread cursor:",+ "--before",+ "--before-id",} {if !strings.Contains(s, want) {- t.Errorf("assignment Workflow missing --recent guidance %q\n---\n%s", want, s)+ t.Errorf("assignment Workflow missing older-history pagination guidance %q\n---\n%s", want, s)+ }+ }+ for _, banned := range []string{+ "multica issue comment list issue-1 --output json",+ "read the full comment history",+ "read the full history page-by-page",+ "`--recent` is a way to read the full history",+ } {+ if strings.Contains(s, banned) {+ t.Errorf("assignment Workflow still carries full-flat mandatory phrasing %q\n---\n%s", banned, s)}}- // The previous wording framed `--recent` as a replacement ("you may- // switch to ..."), which conflicts with the mandatory full-history- // rule. Pin that the replacement semantics never reappears — `--recent`- // is a paging strategy, not a shortcut.for _, banned := range []string{"you may switch to","switch to `--recent",diff --git a/server/internal/daemon/execenv/reply_instructions.go b/server/internal/daemon/execenv/reply_instructions.goindex c81beea964..40ada85375 100644--- a/server/internal/daemon/execenv/reply_instructions.go+++ b/server/internal/daemon/execenv/reply_instructions.go@@ -81,7 +81,7 @@ func BuildResumedCommentsHint(issueID, triggerCommentID, triggerThreadID string)// timeline (oldest-first, server cap 2000), point the agent at the triggering// CONVERSATION: `--thread <trigger> --tail 30` returns that thread's root plus// its 30 newest replies (root is always included, even at --tail 0) — the-// context the triggering comment actually needs. A `--recent 20` pointer is kept+// context the triggering comment actually needs. A `--recent 10` pointer is kept// for cross-thread background the agent can pull on judgment.//// Both surfaces call this so the cold fallback cannot drift between them (same@@ -97,7 +97,7 @@ func BuildColdCommentsHint(issueID, triggerCommentID, triggerThreadID string) st"Read the triggering conversation first: "+"`multica issue comment list %s --thread %s --tail 30 --output json` "+"(that thread's root + its 30 newest replies). "+- "Need cross-thread background? `multica issue comment list %s --recent 20 --output json`.\n\n",+ "Need cross-thread background? `multica issue comment list %s --recent 10 --output json`.\n\n",issueID, threadID, issueID,)}diff --git a/server/internal/daemon/execenv/runtime_config.go b/server/internal/daemon/execenv/runtime_config.goindex c7acb7a5fa..284dd6d444 100644--- a/server/internal/daemon/execenv/runtime_config.go+++ b/server/internal/daemon/execenv/runtime_config.go@@ -663,7 +663,7 @@ func buildMetaSkillContent(provider string, ctx TaskContextForEnv) string {} else if cold := BuildColdCommentsHint(ctx.IssueID, ctx.TriggerCommentID, ctx.TriggerThreadID); cold != "" {b.WriteString("3. " + cold)} else {- fmt.Fprintf(&b, "3. Catch up on comments — read with `multica issue comment list %s --output json` (long issue? `--recent 20`).\n", ctx.IssueID)+ fmt.Fprintf(&b, "3. Catch up on comments — read with `multica issue comment list %s --recent 10 --output json`.\n", ctx.IssueID)}fmt.Fprintf(&b, "4. Find the triggering comment (ID: `%s`) and understand what is being asked — do NOT confuse it with previous comments\n", ctx.TriggerCommentID)if ctx.IsSquadLeader {@@ -682,7 +682,7 @@ func buildMetaSkillContent(provider string, ctx TaskContextForEnv) string {b.WriteString("You are responsible for managing the issue status throughout your work, unless your Agent Identity forbids issue status changes.\n\n")fmt.Fprintf(&b, "1. Run `multica issue get %s --output json` to understand your task\n", ctx.IssueID)fmt.Fprintf(&b, "2. Run `multica issue metadata list %s --output json` to see what prior agents pinned — best-effort, empty `{}` and CLI failures are normal. See the `## Issue Metadata` section above for what to look for.\n", ctx.IssueID)- fmt.Fprintf(&b, "3. Run `multica issue comment list %s --output json` to read the full comment history (returns all comments, capped server-side at 2000) — this is mandatory, not optional. Earlier comments often carry context the issue body lacks (e.g. which repo to work in, the prior agent's findings, the reason the issue was reassigned to you). Skipping this step is the most common cause of agents acting on stale or incomplete instructions. When the flat dump is too large to ingest in one shot, treat `--recent 20 --output json` plus the `--before` / `--before-id` cursor (from the stderr `Next thread cursor:` line) as a paging strategy: keep walking older threads until you have read enough history to satisfy this mandatory step. `--recent` is a way to read the full history page-by-page, not a shortcut that replaces it.\n", ctx.IssueID)+ fmt.Fprintf(&b, "3. Run `multica issue comment list %s --recent 10 --output json` to catch up on recent active comment threads — this is mandatory, not optional. Earlier comments often carry context the issue body lacks (e.g. which repo to work in, the prior agent's findings, the reason the issue was reassigned to you). Skipping this step is the most common cause of agents acting on stale or incomplete instructions. If the recent window shows that older context is needed, page older threads with the stderr `Next thread cursor:` values and the matching `--before` / `--before-id` flags until you have enough history.\n", ctx.IssueID)fmt.Fprintf(&b, "4. Run `multica issue status %s in_progress` unless your Agent Identity forbids issue status changes; if it does, skip this step.\n", ctx.IssueID)b.WriteString("5. Complete the task within your Agent Identity boundaries. Do not investigate, implement, create issues, update issues, or delegate if your Agent Identity forbids that action; if your role is delegation-only, perform the allowed delegation work and stop once that outcome is delivered.\n")if ctx.IsSquadLeader {diff --git a/server/internal/daemon/prompt.go b/server/internal/daemon/prompt.goindex 8bec307945..a1093a0581 100644--- a/server/internal/daemon/prompt.go+++ b/server/internal/daemon/prompt.go@@ -31,7 +31,7 @@ func BuildPrompt(task Task, provider string) string {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)fmt.Fprintf(&b, "Start by running `multica issue get %s --output json` to understand your task, then complete it.\n", task.IssueID)- fmt.Fprintf(&b, "For comment history, follow the rule in your runtime workflow file (assignment-triggered tasks treat the read as mandatory). `multica issue comment list %s --output json` returns all comments for the issue (server caps at 2000). On long-running issues use `--recent 20 --output json` to read the 20 most recently active threads, then page older threads via the stderr `Next thread cursor: ...` line and the matching `--before` / `--before-id` until you have enough history. `--since <RFC3339>` is still available for incremental polling and may combine with `--recent`.\n", task.IssueID)+ fmt.Fprintf(&b, "For comment history, follow the rule in your runtime workflow file (assignment-triggered tasks treat the read as mandatory). Start with `multica issue comment list %s --recent 10 --output json` to read the 10 most recently active threads, then page older threads via the stderr `Next thread cursor: ...` line and the matching `--before` / `--before-id` until you have enough history. `--since <RFC3339>` is still available for incremental polling and may combine with `--recent`.\n", task.IssueID)return b.String()}@@ -172,7 +172,7 @@ func buildCommentPrompt(task Task, provider string) string {} else if cold := execenv.BuildColdCommentsHint(task.IssueID, task.TriggerCommentID, task.TriggerThreadID); cold != "" {b.WriteString(cold)} else {- fmt.Fprintf(&b, "Read the discussion: `multica issue comment list %s --output json` (long issue? use `--recent 20`).\n\n", task.IssueID)+ fmt.Fprintf(&b, "Read the discussion: `multica issue comment list %s --recent 10 --output json`.\n\n", task.IssueID)}b.WriteString(execenv.BuildCommentReplyInstructions(provider, task.IssueID, task.TriggerCommentID))return b.String()diff --git a/server/internal/daemon/prompt_test.go b/server/internal/daemon/prompt_test.goindex 010d26ced5..00ffcc3af5 100644--- a/server/internal/daemon/prompt_test.go+++ b/server/internal/daemon/prompt_test.go@@ -376,14 +376,13 @@ func TestBuildChatPromptSlashSkills(t *testing.T) {}// TestBuildPromptDefaultMentionsRecent pins that the catch-all fallback-// prompt (no trigger comment, no chat, no autopilot, no quick-create) also-// teaches the agent about --recent as the long-issue-friendly alternative-// to the flat dump, even though it cannot anchor a --thread without a-// trigger comment id.+// prompt (no trigger comment, no chat, no autopilot, no quick-create)+// starts assignment-triggered comment catch-up with a bounded recent read,+// while still keeping older history available through pagination.func TestBuildPromptDefaultMentionsRecent(t *testing.T) {out := BuildPrompt(Task{IssueID: "issue-default-1"}, "claude")for _, s := range []string{- "--recent 20 --output json",+ "multica issue comment list issue-default-1 --recent 10 --output json","Next thread cursor:","--since",} {@@ -402,6 +401,9 @@ func TestBuildPromptDefaultMentionsRecent(t *testing.T) {if strings.Contains(out, "If you need comment history") {t.Errorf("default BuildPrompt still carries the legacy 'If you need' soft phrasing that conflicts with the mandatory workflow\n--- output ---\n%s", out)}+ if strings.Contains(out, "multica issue comment list issue-default-1 --output json") {+ t.Errorf("default BuildPrompt still presents the unbounded flat read as the assignment catch-up command\n--- output ---\n%s", out)+ }}// TestBuildPromptNonSquadLeaderNoRule verifies that non-squad-leader agents@@ -491,6 +493,12 @@ func TestBuildPromptColdStartThreadRead(t *testing.T) {if !strings.Contains(out, "multica issue comment list "+issueID+" --thread thread-root-1 --tail 30 --output json") {t.Errorf("cold start must point at the triggering thread read, got:\n%s", out)}+ if !strings.Contains(out, "multica issue comment list "+issueID+" --recent 10 --output json") {+ t.Errorf("cold start cross-thread fallback should use recent 10, got:\n%s", out)+ }+ if strings.Contains(out, "--recent 20") {+ t.Errorf("cold start cross-thread fallback still uses recent 20, got:\n%s", out)+ }}// TestBuildPromptResumedNoDeltaDoesNotForceThreadRead pins the warm/no-deltadiff --git a/server/internal/service/builtin_skills/multica-squads/SKILL.md b/server/internal/service/builtin_skills/multica-squads/SKILL.mdindex f243cf137a..e5ad28ab79 100644--- a/server/internal/service/builtin_skills/multica-squads/SKILL.md+++ b/server/internal/service/builtin_skills/multica-squads/SKILL.md@@ -15,7 +15,7 @@ If debugging why a squad did or did not run, inspect first:multica issue get <issue-id> --output jsonmultica squad get <squad-id> --output jsonmultica squad member list <squad-id> --output json-multica issue comment list <issue-id> --recent 20 --output json+multica issue comment list <issue-id> --recent 10 --output json```If the command shape is unclear, check help instead of guessing: