Open-source AI penetration testing tool to find and fix your app’s vulnerabilities.
Python agentsai-hackingai-penetration-testingai-pentestingai-securityartificial-intelligencebug-bountycode-qualityctf-toolscybersecuritycybersecurity-toolsethical-hackinghackingllm-securityoffensive-securitypenetration-testingpentesting-toolsred-teamingsecuritysecurity-automation
fix(agents): the non-TTY note goes into the Output section so renderers keep stripping the metadata block
Ahmed Allam2b98deb3d250
diff --git a/strix/agents/factory.py b/strix/agents/factory.pyindex 8e3790e5..217b077f 100644--- a/strix/agents/factory.py+++ b/strix/agents/factory.py@@ -458,6 +458,7 @@ _RUNNING_NON_TTY_NOTICE = ()_PROCESS_RUNNING_RE = re.compile(r"^Process running with session ID \d+$", re.MULTILINE)+_OUTPUT_HEADER_RE = re.compile(r"^Output:\n", re.MULTILINE)def _annotate_running_non_tty(parsed: dict[str, Any], result: Any) -> Any:@@ -473,7 +474,10 @@ def _annotate_running_non_tty(parsed: dict[str, Any], result: Any) -> Any:f"Note: yield_time_ms={int(requested)} was capped at {PTY_YIELD_TIME_MS_MAX} "f"({_EXEC_YIELD_CAP_S} s). " + notice.removeprefix("Note: "))- return f"{result[: match.end()]}\n{notice}{result[match.end() :]}"+ header = _OUTPUT_HEADER_RE.search(result, match.end())+ if header is None:+ return f"{result}\n{notice}"+ return f"{result[: header.end()]}{notice}\n{result[header.end() :]}"def _wrap_exec_command(tool: FunctionTool) -> FunctionTool:diff --git a/tests/test_agent_factory_shell.py b/tests/test_agent_factory_shell.pyindex a663c9a5..6536bd6b 100644--- a/tests/test_agent_factory_shell.py+++ b/tests/test_agent_factory_shell.py@@ -115,10 +115,10 @@ async def test_wrap_exec_command_flags_a_running_non_tty_process() -> None:assert result == ("Chunk ID: abc123\nWall time: 30.0012 seconds\n"- "Process running with session ID 7\n"+ "Process running with session ID 7\nOutput:\n""Note: yield_time_ms=90000 was capped at 30000 (30 s). this non-TTY process cannot be ""polled and its later output is lost. Rerun it in the background "- "(`cmd > /tmp/out.log 2>&1 &`, then read the log) or with tty=true.\nOutput:\n"+ "(`cmd > /tmp/out.log 2>&1 &`, then read the log) or with tty=true.\n")