diff --git a/src/core/prompts/sections/__tests__/custom-instructions.spec.ts b/src/core/prompts/sections/__tests__/custom-instructions.spec.ts index 9c8e003143..7c7ece4822 100644 --- a/src/core/prompts/sections/__tests__/custom-instructions.spec.ts +++ b/src/core/prompts/sections/__tests__/custom-instructions.spec.ts @@ -505,14 +505,16 @@ describe("addCustomInstructions", () => { expect(result).toContain("Rules from .roorules-test-mode:\nmode specific rules") }) - it("should return empty string when no instructions provided", async () => { + it("should show placeholder text when no instructions provided", async () => { // Simulate no .roo/rules directory statMock.mockRejectedValueOnce({ code: "ENOENT" }) readFileMock.mockRejectedValue({ code: "ENOENT" }) const result = await addCustomInstructions("", "", "/fake/path", "", {}) - expect(result).toBe("") + expect(result).toContain("Global Instructions:\n(No global instructions set)") + expect(result).toContain("Mode-specific Instructions:\n(No mode-specific instructions set)") + expect(result).toContain("USER'S CUSTOM INSTRUCTIONS") }) it("should handle missing mode-specific rules file", async () => { diff --git a/src/core/prompts/sections/custom-instructions.ts b/src/core/prompts/sections/custom-instructions.ts index 3c8558a57f..92e5e09bf0 100644 --- a/src/core/prompts/sections/custom-instructions.ts +++ b/src/core/prompts/sections/custom-instructions.ts @@ -253,13 +253,15 @@ export async function addCustomInstructions( } // Add global instructions first - if (typeof globalCustomInstructions === "string" && globalCustomInstructions.trim()) { - sections.push(`Global Instructions:\n${globalCustomInstructions.trim()}`) + if (typeof globalCustomInstructions === "string") { + const trimmed = globalCustomInstructions.trim() + sections.push(`Global Instructions:\n${trimmed || "(No global instructions set)"}`) } // Add mode-specific instructions after - if (typeof modeCustomInstructions === "string" && modeCustomInstructions.trim()) { - sections.push(`Mode-specific Instructions:\n${modeCustomInstructions.trim()}`) + if (typeof modeCustomInstructions === "string") { + const trimmed = modeCustomInstructions.trim() + sections.push(`Mode-specific Instructions:\n${trimmed || "(No mode-specific instructions set)"}`) } // Add rules - include both mode-specific and generic rules if they exist