Skip to content

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

Go

fix(slack): stop the chat agent narrating its history reads (MUL-3871) (#4776)

Bohan Jiang444c2f29a5a4
diff --git a/server/internal/daemon/prompt.go b/server/internal/daemon/prompt.go
index cee8d5a530..ddca45e9f1 100644
--- a/server/internal/daemon/prompt.go
+++ b/server/internal/daemon/prompt.go
@@ -203,10 +203,14 @@ func buildChatPrompt(task Task) string {
b.WriteString("- `multica chat history --output json` — the channel overview: recent top-level messages, each thread tagged with a `thread_id` and `reply_count`. It does NOT expand thread contents.\n")
b.WriteString("- `multica chat thread [<thread_id>] --output json` — read one thread's messages; omit the id to read the thread you are in, or pass a `thread_id` from the overview to read a specific thread.\n")
if task.ChatInThread {
- b.WriteString("You were @mentioned inside a thread: start with `multica chat thread` to read it; if you need the wider channel, run `multica chat history` and open a specific thread with `multica chat thread <thread_id>`.\n\n")
+ b.WriteString("You were @mentioned inside a thread: start with `multica chat thread` to read it; if you need the wider channel, run `multica chat history` and open a specific thread with `multica chat thread <thread_id>`.\n")
} else {
- b.WriteString("You were @mentioned at the channel top level: start with `multica chat history` to see the channel, then read a specific thread's contents with `multica chat thread <thread_id>`.\n\n")
+ b.WriteString("You were @mentioned at the channel top level: start with `multica chat history` to see the channel, then read a specific thread's contents with `multica chat thread <thread_id>`.\n")
}
+ // These reads are the agent's private context-gathering; narrating them
+ // into a chat reply reads as noise (the user reported every reply being
+ // prefixed with "我先读取…"). Tell the agent to keep them out of its answer.
+ b.WriteString("Do these reads SILENTLY as an internal step — they are how you gather context, not part of your answer. Do NOT narrate them: your reply must not begin with what you are about to read or just read (no \"我先读取…\" / \"let me read the history / open the thread\"). Reply to the user with your answer only.\n\n")
}
if task.Agent != nil && len(task.Agent.Skills) > 0 {
refs := ExtractSlashSkills(task.ChatMessage)
diff --git a/server/internal/daemon/prompt_test.go b/server/internal/daemon/prompt_test.go
index 86a19262c3..eca45cb298 100644
--- a/server/internal/daemon/prompt_test.go
+++ b/server/internal/daemon/prompt_test.go
@@ -277,7 +277,7 @@ func TestBuildChatPromptChannelAwareness(t *testing.T) {
ChatChannelType: "slack",
ChatMessage: "你刚刚和 xxx 聊了什么",
})
- for _, want := range []string{"Slack", "NOT in Multica", "multica chat history", "multica chat thread"} {
+ for _, want := range []string{"Slack", "NOT in Multica", "multica chat history", "multica chat thread", "Do NOT narrate"} {
if !strings.Contains(out, want) {
t.Fatalf("slack-backed prompt missing %q\n--- output ---\n%s", want, out)
}