Skip to content

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

Go

fix(daemon): drop IM chat prompt's issue/comment prohibition (MUL-10272) (#11647)

Multica Eved1afdec27b78
diff --git a/server/internal/daemon/prompt.go b/server/internal/daemon/prompt.go
index 395746ac99..c1f54fab62 100644
--- a/server/internal/daemon/prompt.go
+++ b/server/internal/daemon/prompt.go
@@ -810,10 +810,17 @@ func buildChatPromptWithOptions(task Task, opts promptOpts) string {
b.WriteString("Audience: direct room.\n\n")
}
// Channel awareness (MUL-3871). When the session is backed by an IM channel,
- // the agent must KNOW it is operating inside that channel — otherwise an ask
- // like "what did you just talk about" sends it to read Multica instead of the
- // channel conversation. A web-only chat session gets no such block — its
- // history is the Multica chat_session the agent already resumes.
+ // the agent must KNOW where the conversation lives — otherwise an ask like
+ // "what did you just talk about" sends it to read Multica issues instead of
+ // the channel conversation. Every branch below names the platform and says
+ // where to read the conversation back, and that positive pointer is the whole
+ // guard. A web-only chat session gets no such block — its history is the
+ // Multica chat_session the agent already resumes.
+ //
+ // Do not add a prohibition such as "never look in Multica issues or comments
+ // for this conversation" on top. Agents read "for this conversation" as the
+ // rule's scope and refused every issue or comment lookup asked from the IM
+ // chat, attributing the refusal to the channel (MUL-10272).
//
// The history half: `multica chat history` is served by handler/chat_history.go,
// which reads the live channel for Slack and falls back to the stored
@@ -823,8 +830,7 @@ func buildChatPromptWithOptions(task Task, opts promptOpts) string {
// thread reader, so they get the transcript command without the thread
// drill-down (MUL-4899).
//
- // WHERE the conversation lives is therefore per-branch, not shared: only the
- // unconditional "don't go looking in issues/comments" survives up top. Saying
+ // WHERE the conversation lives is therefore per-branch, not shared. Saying
// "its history lives in the channel, NOT in Multica" for every channel type
// contradicted the very next line on a transcript surface, which tells the
// agent Multica stored it and hands it the command to read it back. An agent
@@ -837,7 +843,6 @@ func buildChatPromptWithOptions(task Task, opts promptOpts) string {
// silently dropped it for Feishu/Lark (GH #6006).
if task.ChatChannelType != "" {
platform := channelDisplayName(task.ChatChannelType)
- fmt.Fprintf(&b, "You are operating inside a %s conversation — not the Multica web app. Never look in Multica issues or comments for this conversation.\n", platform)
if task.ChatChannelType == execenv.ChannelTypeFeishu {
// Every field passed the Feishu id shape check, so the JSON carries
// no free text that could read as instructions.
diff --git a/server/internal/daemon/prompt_test.go b/server/internal/daemon/prompt_test.go
index ab0d366cf7..09d32ebebd 100644
--- a/server/internal/daemon/prompt_test.go
+++ b/server/internal/daemon/prompt_test.go
@@ -521,6 +521,7 @@ func TestBuildChatPromptChannelAwareness(t *testing.T) {
execenv.ChannelTypeFeishu,
execenv.ChannelTypeWecom,
execenv.ChannelTypeDingtalk,
+ execenv.ChannelTypeWeixin,
} {
t.Run(channelType+" transcript prompt does not contradict itself", func(t *testing.T) {
out := buildChatPrompt(Task{
@@ -534,10 +535,36 @@ func TestBuildChatPromptChannelAwareness(t *testing.T) {
if strings.Contains(out, "NOT in Multica") {
t.Errorf("transcript surface told its history is NOT in Multica, then told to read it from Multica\n--- output ---\n%s", out)
}
- // The useful half of the original sentence must survive: the agent
- // still must not go hunting through issues and comments.
- if !strings.Contains(out, "Never look in Multica issues or comments") {
- t.Errorf("lost the issues/comments prohibition\n--- output ---\n%s", out)
+ })
+ }
+}
+
+// TestBuildChatPromptDoesNotRestrictIssueAccess guards MUL-10272. The IM chat
+// prompt used to say "Never look in Multica issues or comments for this
+// conversation"; agents read "for this conversation" as the rule's scope and
+// refused every issue or comment lookup asked from the IM chat. The per-channel
+// history pointer is the only guard against searching issues for the chat's own
+// history, so no channel's prompt may restrict issue or comment access.
+func TestBuildChatPromptDoesNotRestrictIssueAccess(t *testing.T) {
+ for _, channelType := range []string{
+ execenv.ChannelTypeSlack,
+ execenv.ChannelTypeFeishu,
+ execenv.ChannelTypeWecom,
+ execenv.ChannelTypeDingtalk,
+ execenv.ChannelTypeTelegram,
+ execenv.ChannelTypeWeixin,
+ } {
+ t.Run(channelType, func(t *testing.T) {
+ out := buildChatPrompt(Task{
+ ChatSessionID: "sess-1",
+ ChatChannelType: channelType,
+ ChatMessage: "帮我查一下 MUL-123 的进展",
+ })
+ lower := strings.ToLower(out)
+ for _, banned := range []string{"never look in", "issues or comments"} {
+ if strings.Contains(lower, banned) {
+ t.Errorf("chat prompt restricts issue/comment access (%q)\n--- output ---\n%s", banned, out)
+ }
}
})
}