fix(agents/graphs/auto_debug): return update dicts from node functions instead of mutating state in-place #10740

Closed
HAL9000 wants to merge 1 commits from fix/issue-10496-auto-debug-state-mutation into main

1 Commits

Author SHA1 Message Date
HAL9000 22076b7cef fix(agents/graphs/auto_debug): return update dicts from node functions instead of mutating state in-place
CI / push-validation (pull_request) Successful in 37s
CI / helm (pull_request) Successful in 42s
CI / lint (pull_request) Failing after 1m0s
CI / build (pull_request) Successful in 57s
CI / quality (pull_request) Successful in 1m24s
CI / security (pull_request) Successful in 1m37s
CI / typecheck (pull_request) Successful in 1m40s
CI / coverage (pull_request) Has been skipped
CI / e2e_tests (pull_request) Successful in 3m23s
CI / integration_tests (pull_request) Failing after 3m42s
CI / unit_tests (pull_request) Failing after 4m38s
CI / docker (pull_request) Has been skipped
CI / status-check (pull_request) Failing after 3s
Node functions _analyze_error, _generate_fix, _validate_fix, and _finalize
previously mutated the input state dict in-place and returned the full state
object, violating the LangGraph node contract which requires returning only
a dict of state updates (changed keys).

This fix updates all four node functions to return new partial state dicts
containing only the changed keys, consistent with the correct pattern already
used in context_analysis.py and plan_generation.py.

Changes:
- _analyze_error: returns {"messages": [*existing, new_message]}
- _generate_fix: returns {"current_fix": fix_data}
- _validate_fix: returns {"fix_validated": is_valid} plus "attempted_fixes" when invalid
- _finalize: returns {"result": {...}}
- All four functions now have return type dict[str, Any] instead of AutoDebugState
- Added TDD BDD tests verifying no in-place mutation occurs

ISSUES CLOSED: #10496
2026-04-19 09:33:09 +00:00