fix(prompts): remove stray tab before Tool Use Guidelines heading - #1440
Conversation
…o-Code-Org#1415) 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).
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (8)
📒 Files selected for processing (2)
Included review availability: Your plan provides up to 4 included reviews per hour; 0 remain after this review. 📜 Recent review details⏰ Context from checks skipped due to timeout. (7)
🧰 Additional context used📓 Path-based instructions (8)Treat model, provider, MCP, path, command, and tool data as untrusted. Check approval and allowlist bypasses, injection and traversal risks, secrets/PII exposure in logs, abort and stream behavior, retries, provider compatibility, and enfor...⚙️ CodeRabbit configuration file Files:
Require regression coverage at the lowest valid harness with behavior-focused assertions, including relevant negative, error, false/unset, and boundary cases. Check cleanup and deterministic async behavior and prefer shared typed test helpe...⚙️ CodeRabbit configuration file Files:
Check strict typing and exhaustive behavior across normal, boundary, error, cancellation, retry, and compatibility paths. Verify promises and errors are handled, existing helpers are reused, and new code introduces no `any`, unjustified dou...⚙️ CodeRabbit configuration file Files:
Verify extension/webview contracts, cancellation and error propagation, VS Code lifecycle correctness, and behavior under retries and partial failure. Check listeners, resources, and providers are disposed without stale state or duplicate w...⚙️ CodeRabbit configuration file Files:
Act as an adversarial second-opinion reviewer. Verify PR claims against implementation, contracts, and tests. Trace changed inputs through normal, boundary, error, cancellation, retry, and default paths and their consumers. Seek plausible c...⚙️ CodeRabbit configuration file Files:
Add focused tests for UI binding and save behavior, persistence or normalization, and the value returned by `getStateToPostToWebview()`, including true and false/unset cases when defaults could hide omissions.📄 CodeRabbit inference engine (AGENTS.md) Files:
Fix lint violations in new TypeScript code instead of suppressing them.📄 CodeRabbit inference engine (AGENTS.md) Files:
After editing a file, run ESLint with pruning and zero warnings for that relative file, and confirm its suppression count did not increase.📄 CodeRabbit inference engine (AGENTS.md) Files:
🔇 Additional comments (2)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe system prompt no longer inserts a leading tab before the Tool Use Guidelines heading. Tests verify the heading starts at column 0 and does not contain the stray tab. ChangesSystem prompt formatting
Estimated code review effort: 1 (Trivial) | ~5 minutes Merge Risk: ⚪ Minimal · up to This removes an unintended tab before the Tool Use Guidelines heading and updates regression coverage and snapshots; no actionable merge-blocking risk remains after normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 6 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (6 passed)
Full details: Regression EvidenceExplanation Focused coverage exists for the changed behavior. The diff changes the Full details: Trust And Persistence InvariantsExplanation PASS. The pull-request diff changes only prompt whitespace, regression assertions, and matching snapshot lines. The sole production change removes indentation before
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Some tools did not complete. Review the errors below. 🔧 ESLint
src/core/prompts/__tests__/system-prompt.spec.tsESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox. src/core/prompts/system.tsESLint skipped: the matched ESLint configuration already failed (missing-dependency). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Review processThanks for contributing. This comment tracks the review sequence and the next action.
Current step: CodeRabbit approved the latest commit. A maintainer must now review and approve it. |
Related GitHub Issue
Closes: #1415
Description
The system prompt template in
src/core/prompts/system.tsindented thegetToolUseGuidelinesSection()call with a leading tab, so every request sent a tab-prefixed# Tool Use Guidelinesheading while every other section (e.g.markdownFormattingSection(),getCapabilitiesSection()) starts at column 0 — a meaningless whitespace token shipped to the LLM on every prompt.src/core/prompts/system.ts— removes the stray tab from the template.src/core/prompts/__tests__/system-prompt.spec.ts— adds a regression assertion: the prompt must contain the column-0 heading ("\n# Tool Use Guidelines\n") and must not contain the tab-prefixed variant (the old assertion only checkedtoContain("Tool Use Guidelines"), which passes either way).-u; two more —with-computer-use-support.snapandwith-different-viewport-size.snap— are orphaned by earlier refactors but still git-tracked, so they were updated by hand to keep tracked artifacts consistent).Test Procedure
pnpm --filter zoo-code test core/prompts/__tests__/system-prompt.spec.ts core/prompts/__tests__/add-custom-instructions.spec.ts core/prompts/sections/__tests__/tool-use-guidelines.spec.ts→ 35/35 pass against the refreshed snapshots (run without-u).pnpm --dir src exec tsc --noEmit→ clean.pnpm --dir src exec eslint --max-warnings=0 core/prompts/system.ts core/prompts/__tests__/system-prompt.spec.ts→ clean.src/core/prompts/__tests__/__snapshots__for a tab before# Tool Use Guidelines→ no matches.Pre-Submission Checklist
Visual Snapshots
N/A — no rendered UI surface.
Videos (interaction / animation only)
N/A.
Documentation Updates
Additional Notes
The only behavioral change is the removed whitespace token in the system prompt; every snapshot diff is a single-line tab removal on the guidelines heading.
Get in Touch
easonLiangWorldedtech