agent-zero
agent-zero copied to clipboard
Fix: normalize bytes/str handling in calculate_valid_match_lengths
Summary
- Normalize bytes/str and ignore_patterns types before regex matching in calculate_valid_match_lengths (python/helpers/strings.py).
- Replace mutable default list with None to avoid shared state.
Rationale
Prevents TypeError in re.match when bytes and str are mixed (e.g., shell_ssh.py uses bytes patterns). Ensures robust behavior across call sites.
Test plan
- Execute SSH shell flow that trims echoed commands (python/helpers/shell_ssh.py) and verify no exceptions and correct trimming.
- Run basic unit checks if available.
Affected files
- python/helpers/strings.py