Skip to content

Commit 87c57aa

Browse files
committed
🤖 fix: restore MUX_OUTPUT/MUX_PROMPT in script execution history
Change-Id: I333264f12f60533456812a8cd48fd11dc5e87fec Signed-off-by: Thomas Kosiewski <[email protected]>
1 parent 66c0a4e commit 87c57aa

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

src/browser/utils/messages/modelMessageTransform.ts

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

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.
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+
}
232238

233239
return {
234240
...msg,

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

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

46-
it("should exclude MUX_OUTPUT and MUX_PROMPT from script execution messages (avoid duplication)", () => {
46+
it("should include all fields (stdout, output, prompt) if present", () => {
4747
const scriptResult: BashToolResult = {
4848
success: true,
4949
output: "stdout stuff",
@@ -79,10 +79,8 @@ 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).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");
82+
expect(textPart.text).toContain("MUX_OUTPUT:\nUser toast");
83+
expect(textPart.text).toContain("MUX_PROMPT:\nModel prompt");
8684
}
8785
});
8886
});

0 commit comments

Comments
 (0)