@tdd_issue @tdd_issue_10496 Feature: AutoDebug node functions must not mutate state in-place As a LangGraph developer I want AutoDebug node functions to return new state dicts So that the LangGraph node contract is respected and state isolation is maintained Background: Given the auto debug state mutation module is imported Scenario: _analyze_error does not mutate the original state object Given an auto debug agent for mutation testing And an initial auto debug state for mutation testing When I call _analyze_error and capture the result Then the returned state should be a different object from the input state And the original state messages list should be unchanged Scenario: _analyze_error returns expected keys in partial state dict Given an auto debug agent for mutation testing And an initial auto debug state for mutation testing When I call _analyze_error and capture the result Then the returned state must contain key "messages" And the analyze_error update should contain non-empty LLM content Scenario: _generate_fix does not mutate the original state object Given an auto debug agent for mutation testing And a state with an error analysis for mutation testing When I call _generate_fix and capture the result Then the returned state should be a different object from the input state And the original state current_fix should be unchanged Scenario: _generate_fix returns expected keys in partial state dict Given an auto debug agent for mutation testing And a state with an error analysis for mutation testing When I call _generate_fix and capture the result Then the returned state must contain key "current_fix" And the generated fix should contain the LLM JSON content Scenario: _validate_fix does not mutate the original state object Given an auto debug agent for mutation testing And a state with a current fix for mutation testing When I call _validate_fix and capture the result Then the returned state should be a different object from the input state And the original state fix_validated should be unchanged Scenario: _validate_fix (invalid) returns expected keys in partial state dict Given an auto debug agent for mutation testing And a state with a current fix and invalid validation for mutation testing When I call _validate_fix and capture the result Then the returned state must contain key "fix_validated" And the returned state must contain key "attempted_fixes" And the invalid validation result should come from the LLM JSON content Scenario: _validate_fix with valid fix consumes LLM JSON content Given an auto debug agent for mutation testing And a state with a current fix for mutation testing When I call _validate_fix and capture the result Then the returned state must contain key "fix_validated" And the validation result should come from the LLM JSON content Scenario: _validate_fix with invalid fix does not mutate attempted_fixes in-place Given an auto debug agent for mutation testing And a state with a current fix and invalid validation for mutation testing When I call _validate_fix and capture the result Then the returned state should be a different object from the input state And the original state attempted_fixes list should be unchanged Scenario: _finalize does not mutate the original state object Given an auto debug agent for mutation testing And a state ready for finalization for mutation testing When I call _finalize and capture the result Then the returned state should be a different object from the input state And the original state result should be unchanged Scenario: _finalize returns expected keys in partial state dict Given an auto debug agent for mutation testing And a state ready for finalization for mutation testing When I call _finalize and capture the result Then the returned state must contain key "result"