Skip to content

Commit a1cc065

Browse files
easonLiangWorldedtecheasonliang28easonLiangWorldedtech
authored
fix(prompts): remove stray tab before Tool Use Guidelines heading (#1415) (#1440)
The system prompt template indented getToolUseGuidelinesSection() with a leading tab, so every request sent a tab-prefixed "# Tool Use Guidelines" heading instead of the column-0 heading used by every other section. Drop the tab, pin the heading position with a regression assertion, and refresh the six file snapshots that embedded the old prompt (two of them orphaned by earlier refactors but still tracked). Co-authored-by: Eason Liang <[email protected]> Co-authored-by: easonLiangWorldedtech <[email protected]>
1 parent 31c4a64 commit a1cc065

10 files changed

Lines changed: 14 additions & 9 deletions

‎src/core/prompts/__tests__/__snapshots__/add-custom-instructions/architect-mode-prompt.snap‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/core/prompts/__tests__/__snapshots__/add-custom-instructions/ask-mode-prompt.snap‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/core/prompts/__tests__/__snapshots__/add-custom-instructions/no-mcp-servers.snap‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/core/prompts/__tests__/__snapshots__/system-prompt/consistent-system-prompt.snap‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/core/prompts/__tests__/__snapshots__/system-prompt/with-computer-use-support.snap‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/core/prompts/__tests__/__snapshots__/system-prompt/with-different-viewport-size.snap‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/core/prompts/__tests__/__snapshots__/system-prompt/with-mcp-hub-provided.snap‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/core/prompts/__tests__/__snapshots__/system-prompt/with-undefined-mcp-hub.snap‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/core/prompts/__tests__/system-prompt.spec.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,11 @@ describe("SYSTEM_PROMPT", () => {
561561
// Should contain Tool Use Guidelines section
562562
expect(prompt).toContain("Tool Use Guidelines")
563563

564+
// The guidelines heading must start at column 0. A stray leading tab
565+
// (#1415) would otherwise be sent to the model with every request.
566+
expect(prompt).toContain("\n# Tool Use Guidelines\n")
567+
expect(prompt).not.toContain("\t# Tool Use Guidelines")
568+
564569
// Should NOT contain a tool catalog / XML examples
565570
expect(prompt).not.toContain("# Tools")
566571
expect(prompt).not.toContain("## read_file")

‎src/core/prompts/system.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ ${markdownFormattingSection()}
108108
109109
${getSharedToolUseSection()}${toolsCatalog}
110110
111-
${getToolUseGuidelinesSection(policy)}
111+
${getToolUseGuidelinesSection(policy)}
112112
113113
${getCapabilitiesSection(policy)}
114114

0 commit comments

Comments
 (0)