Skip to content

Commit bcaedb3

Browse files
committed
🤖 fix: revert MUX_OUTPUT/MUX_PROMPT inclusion for user-initiated scripts (duplication)
Change-Id: Ide029c89bd7309fcc6d4d8ea0dc2d0f8b46a02b4 Signed-off-by: Thomas Kosiewski <tk@coder.com>
1 parent a174a42 commit bcaedb3

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

‎src/browser/utils/messages/modelMessageTransform.ts‎

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -226,15 +226,9 @@ export function transformScriptMessagesForLLM(messages: MuxMessage[]): MuxMessag
226226
llmContent += `\nStdout/Stderr: (no output)`;
227227
}
228228

229-
// Include MUX_OUTPUT if present
230-
if (result.outputFile?.trim()) {
231-
llmContent += `\nMUX_OUTPUT:\n${result.outputFile.trim()}`;
232-
}
233-
234-
// Include MUX_PROMPT if present
235-
if (result.promptFile?.trim()) {
236-
llmContent += `\nMUX_PROMPT:\n${result.promptFile.trim()}`;
237-
}
229+
// EXCLUDE MUX_OUTPUT and MUX_PROMPT from the LLM context for the script message itself.
230+
// MUX_PROMPT is sent as a separate user message by ChatInput, so including it here would be duplication.
231+
// MUX_OUTPUT is intended for user toasts, not LLM context.
238232

239233
return {
240234
...msg,

‎src/browser/utils/messages/transformScriptMessagesForLLM.test.ts‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ describe("transformScriptMessagesForLLM", () => {
4343
}
4444
});
4545

46-
it("should include all fields (stdout, output, prompt) if present", () => {
46+
it("should exclude MUX_OUTPUT and MUX_PROMPT from script execution messages (avoid duplication)", () => {
4747
const scriptResult: BashToolResult = {
4848
success: true,
4949
output: "stdout stuff",
@@ -79,8 +79,10 @@ describe("transformScriptMessagesForLLM", () => {
7979
expect(textPart.type).toBe("text");
8080
if (textPart.type === "text") {
8181
expect(textPart.text).toContain("Stdout/Stderr:\nstdout stuff");
82-
expect(textPart.text).toContain("MUX_OUTPUT:\nUser toast");
83-
expect(textPart.text).toContain("MUX_PROMPT:\nModel prompt");
82+
expect(textPart.text).not.toContain("MUX_OUTPUT");
83+
expect(textPart.text).not.toContain("User toast");
84+
expect(textPart.text).not.toContain("MUX_PROMPT");
85+
expect(textPart.text).not.toContain("Model prompt");
8486
}
8587
});
8688
});

0 commit comments

Comments
 (0)