The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix: recognise discourse-marker lead-ins before a leaked shell-JSON call
teknium1cdac150ec3a6
diff --git a/agent/codex_responses_adapter.py b/agent/codex_responses_adapter.pyindex d28d401cbd3..a23d2a8ed1b 100644--- a/agent/codex_responses_adapter.py+++ b/agent/codex_responses_adapter.py@@ -67,7 +67,8 @@ _SHELL_JSON_LEAK_PATTERN = re.compile()_ACTION_VERBS = r"creat(?:e|ing)|writ(?:e|ing)|runn?(?:ing)?|execut(?:e|ing)|check(?:ing)?|verif(?:y|ying)|updat(?:e|ing)|install(?:ing)?|edit(?:ing)?|mak(?:e|ing)"_SHELL_JSON_LEAK_LEADIN_PATTERN = re.compile(- rf"^(?:sure,\s*)?(?:now\s+)?(?:let\s+me\s+|i(?:'|’)?ll\s+|i\s+will\s+|i(?:'|’)?m\s+|i\s+am\s+)?(?:{_ACTION_VERBS})\b",+ rf"^(?:(?:next|first|then|okay|ok|alright)\b[\s,—–-]*)?(?:sure,\s*)?(?:now\s+)?"+ rf"(?:let\s+me\s+|i(?:'|’)?ll\s+|i\s+will\s+|i(?:'|’)?m\s+|i\s+am\s+)?(?:{_ACTION_VERBS})\b",re.IGNORECASE,)diff --git a/tests/agent/test_codex_responses_adapter.py b/tests/agent/test_codex_responses_adapter.pyindex add8e68596e..1f773efc353 100644--- a/tests/agent/test_codex_responses_adapter.py+++ b/tests/agent/test_codex_responses_adapter.py@@ -837,6 +837,8 @@ def _final_text_response(text):@pytest.mark.parametrize("text", ['Creating the PowerShell script now.\n{"cmd": "mkdir -p /c/Temp && cat > /c/Temp/x.ps1 <<\'EOF\'"}','Sure, let me run the tests.\n{"cmd": "pytest -q", "workdir": "/repo", "timeout": 120}',+ 'Next, I\'ll create the script.\n{"cmd": "cat > x.sh"}',+ 'Okay — running the tests.\n{"cmd": "pytest -q"}',"Calling tool now to=functions.terminal {\"command\": \"ls\"}",])def test_normalize_codex_response_treats_leaked_tool_call_text_as_incomplete(text):