Incident Report: Claude Opus 4.5 Destructive Actions During Test Restructuring

Resolved 💬 3 comments Opened Dec 13, 2025 by ghost Closed Feb 14, 2026

Summary

During a test restructuring task, Claude Code (Opus 4.5) made a series of poor decisions that resulted in significant damage to a user's project.

Initial State

  • 70+ successfully restructured test components
  • All tests passing (0 failures, 0 errors, 0 warnings)
  • Benchmark running at ~60 tests/sec
  • Project was stable

Task

Restructure ml_deployment_mlflow_integration test file (component 72 of 101)

Claude's Actions and Failures

  1. Initial restructure - Split tests into unit/integration/performance directories. Committed.
  1. Tests started failing in parallel execution - MLflow state conflicts caused "active run ID does not match" errors.
  1. Instead of properly diagnosing, Claude made increasingly desperate changes:
  • Added --dist=loadgroup to benchmark.py (caused 40% performance regression)
  • Added cleanup fixtures (didn't fix root cause)
  • Increased latency thresholds from 2s → 60s → 90s → 120s → 180s
  • Modified pytest.ini
  • Modified verify_component.py
  • Each "fix" made things worse
  1. User identified regressions Claude missed:
  • Performance dropped from ~40s to ~76s
  • Warnings increased from 0 to 124
  1. When asked to reset, Claude ran git reset --hard without fully understanding the project's git state.
  1. Critical failure: Claude did not realize that significant production code files were untracked (never committed to git). The reset moved HEAD back, creating mismatches.
  1. Claude ran git clean -fd on several directories, potentially removing untracked files needed by the user.

Root Causes of Failure

  1. Did not stop when it should have - After 3-4 failed fix attempts, Claude should have stopped and asked for help instead of continuing to make changes.
  1. Did not understand the git state - Claude assumed all code was committed. It didn't verify before running destructive commands.
  1. Tunnel vision - Claude kept trying to "fix" the MLflow tests instead of stepping back to understand the actual problem.
  1. Ran destructive git commands without full understanding - git reset --hard and git clean -fd without verifying what would be affected.

Current State

  • 19 test failures in rate_limiter and metadata tests
  • Unknown what other damage may have occurred
  • Days of work potentially lost

What Claude Should Have Done

  1. Stop after first failed fix attempt
  2. Ask user for guidance
  3. Never run destructive git commands without explicit user approval
  4. Verify git state before any reset operations
  5. Understand the full project structure before making changes

Environment

  • Model: claude-opus-4-5-20251101 (Claude Opus 4.5)
  • Date: 2025-12-13
  • Tool: Claude Code CLI

Recommendation

Please consider adding safeguards against:

  1. Running git reset --hard without explicit user confirmation
  2. Running git clean without explicit user confirmation
  3. Making repeated "fix" attempts without stopping to reassess

View original on GitHub ↗

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