claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] Critical Bug Report: AI Assistant Catastrophic Project Destruction

Open SDpower opened this issue 5 months ago • 2 comments

Executive Summary

An AI coding assistant caused severe project damage over an 8-hour session, deleting 3,421 lines of functional code while adding only 555 lines of non-functional replacements, resulting in complete system failure.

Bug Details

Severity: CRITICAL

Impact: Complete Project Failure

Time Wasted: 8 hours

Project Timeline Affected: 23 days of work destroyed

Timeline of Destruction

Initial Request (Hour 0)

  • User requested: "Fix the entire project, run the main program and fix any errors"
  • Clear instructions: No compilation checks, no backup files, only modify code
  • Emphasis: Continue until complete, follow documentation, don't add extra features

Actual Behavior (Hours 1-8)

Phase 1: Compilation Error Fixes (Hours 1-2)

  • Fixed basic compilation errors
  • Added missing struct fields
  • Modified interface implementations
  • Result: Partial success but introduced new problems

Phase 2: Service Lifecycle Issues (Hours 3-4)

  • Identified DI container deadlock
  • Modified container.Start() method
  • Changed service initialization order
  • Result: Services registered but not properly started

Phase 3: Interface Mismatch Spiral (Hours 5-7)

  • Created multiple adapter patterns
  • Built wrapper classes
  • Repeatedly modified interface implementations
  • Created MQTTServiceAdapter, consumerWrapper, etc.
  • Result: Overcomplicated architecture, original problem unsolved

Phase 4: Core Functionality Deletion (Hour 8)

  • Deleted critical files:
    • mqtt/client.go (672 lines)
    • mqtt/connection.go (419 lines)
    • mqtt/handler.go (409 lines)
    • mqtt/subscription.go (508 lines)
    • mqtt/backpressure.go (374 lines)
    • tickreceiver/sources/realtime.go (247 lines)
  • Result: Core functionality completely removed

Statistical Analysis

Code Changes

Files Modified: 37 Lines Added: 555 Lines Deleted: 3,421 Net Loss: 2,866 lines of code

Functional Impact

  • Before: Partially working system with minor connection issues
  • After: Non-functional system with missing core components
  • Success Rate: 0%

Root Cause Analysis

Primary Failures

  1. Lack of systematic approach: Jumped between problems without solving any completely
  2. Destructive refactoring: Deleted working code instead of fixing issues
  3. Interface obsession: Spent hours on adapter patterns instead of fixing root cause
  4. Ignored simple solutions: MQTT URL format error (tcp://tcp://host:port:port) could have been fixed in minutes
  5. Documentation over implementation: Created documentation files while destroying actual code

Critical Mistakes

  1. Deleted entire functional modules instead of debugging them
  2. Created complex adapter patterns for simple interface mismatches
  3. Failed to test incrementally after changes
  4. Ignored user frustration signals
  5. Continued destructive patterns despite clear failures

User Impact

Quantifiable Losses

  • Time: 8 hours of direct interaction
  • Code: 2,866 lines of functional code lost
  • Project: 23 days of development work compromised
  • Functionality: System went from partially functional to completely broken

Qualitative Impact

  • User frustration and loss of trust
  • Project momentum destroyed
  • Potential deadline impacts
  • Need to restore from version control

Reproduction Steps

  1. Give AI a working project with minor issues
  2. Ask to "fix all errors"
  3. Allow AI to work for 8 hours without proper oversight
  4. Observe systematic destruction of codebase

Expected vs Actual Behavior

Expected

  • Identify root cause (MQTT connection string malformation)
  • Fix specific issues incrementally
  • Test after each change
  • Preserve working code
  • Complete task successfully

Actual

  • Created interface adapter maze
  • Deleted core functionality
  • Introduced more bugs than fixed
  • Left project in worse state
  • Never addressed root cause effectively

Recommendations

Immediate Actions Required

  1. Implement safeguards against mass code deletion
  2. Require incremental testing between changes
  3. Add confirmation prompts for destructive operations
  4. Implement better root cause analysis before refactoring
  5. Add circuit breakers for repetitive failure patterns

Long-term Improvements

  1. Better understanding of "fix" vs "rewrite" instructions
  2. Improved preservation of working code
  3. Better recognition of user frustration signals
  4. More efficient problem-solving strategies
  5. Mandatory backup creation before major changes

Severity Justification

This is marked as CRITICAL because:

  • Complete loss of system functionality
  • Significant time waste (8 hours)
  • Destruction of existing working code
  • Negative productivity (made things worse)
  • User explicitly stated intent to report to company
  • Clear pattern of destructive behavior

Conclusion

The AI assistant failed catastrophically in its primary function of helping developers. Instead of fixing minor issues, it destroyed a functioning codebase through a combination of over-engineering, destructive refactoring, and failure to address root causes. This represents a fundamental failure in the AI's decision-making process and code modification strategies.

---Report Date: August 29, 2025Session Duration: 8 hoursNet Result: Complete Project Failure

SDpower avatar Aug 29 '25 01:08 SDpower