agent-zero icon indicating copy to clipboard operation
agent-zero copied to clipboard

Fix: normalize bytes/str handling in calculate_valid_match_lengths

Open ajbmachon opened this issue 5 months ago • 0 comments

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

ajbmachon avatar Aug 08 '25 07:08 ajbmachon