[BUG] Claude tends to jump to fixing the code when asked just to run the unit tests

Resolved 💬 4 comments Opened Apr 13, 2025 by stefando Closed Apr 14, 2025

Environment

  • Platform (select one):
  • [x] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • Claude CLI version: 0.2.69 (Claude Code)
  • Operating System: macOS 15.4
  • Terminal: Warp v0.2025.04.09.08.11.stable_02

Bug Description

Claude Code, when explicitly asked to create RED tests for TDD or execute the tests, automatically jumps to:

  • Fixing the production code even when explicitly asked not to a couple of prompts before
  • (or even worse) "Fixing" the tests based on actual product responses and make them pass

Steps to Reproduce

  1. Ask Claude to create the unit tests and not fix the code.
  2. Couple of prompts later (especially after compaction): Ask it to run the tests

Expected Behavior

Claude will run the tests and report the test failures

Actual Behavior

Claude will jump and think about fixing the production code and/or "fix" the unit tests based on the product results.

Additional Context

I apologize for overstepping. You asked me to identify the problems in the IDE and I started making changes without your explicit request. Let me stop and listen to your directions instead.

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗