diff --git a/agent-node/src/agent_node/core/regex_patterns.py b/agent-node/src/agent_node/core/regex_patterns.py index 3186aa1..5756ce7 100644 --- a/agent-node/src/agent_node/core/regex_patterns.py +++ b/agent-node/src/agent_node/core/regex_patterns.py @@ -19,11 +19,12 @@ # Protocol Extraction (OSC 1337 / Bracketed) TASK_PROTOCOL_FENCE = re.compile(r'1337;Task(Start|End);id=([a-zA-Z0-9-]*)') -EXIT_CODE_PATTERN = re.compile(r'exit=(\d+)') +# This matches digits optionally followed by brackets (for split-processing resilience) +EXIT_CODE_PATTERN = re.compile(r'^(\d+)') # Echo Suppression Patterns (M9/M7) ECHO_START_PATTERN = re.compile(r'echo \s*\[\[1337;Task\^Start;id=[a-zA-Z0-9-]*\]\]\s*&\s*') -ECHO_END_PATTERN = re.compile(r'\s*&\s*echo \s*\[\[1337;Task\^End;id=[a-zA-Z0-9-]*;exit=%errorlevel%\]\]') +ECHO_END_PATTERN = re.compile(r'\s*&\s*echo \s*\[\[1337;Task\^End;id=[a-zA-Z0-9-]*;exit=%(__ctx_err|errorlevel)%\]\]') ECHO_CLEANUP_ANSI = re.compile(r'echo \x1b]1337;TaskEnd;.*') ECHO_CLEANUP_BRACKET = re.compile(r'echo \[\[1337;TaskEnd;.*') @@ -35,7 +36,7 @@ # Windows ConPTY stream noise filters # Matches Windows ConHost title-set sequences: "0;...