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(tui): key render cache by content string and return copies
Devin AI5c6cbe088485
diff --git a/strix/interface/tui/renderers/agent_message_renderer.py b/strix/interface/tui/renderers/agent_message_renderer.pyindex b96275a8..c4362804 100644--- a/strix/interface/tui/renderers/agent_message_renderer.py+++ b/strix/interface/tui/renderers/agent_message_renderer.py@@ -161,7 +161,7 @@ def _process_inline_formatting(line: str) -> Text:class AgentMessageRenderer:- _cache: ClassVar[dict[int, Text]] = {}+ _cache: ClassVar[dict[str, Text]] = {}@classmethoddef render_simple(cls, content: str) -> Text:@@ -170,12 +170,11 @@ class AgentMessageRenderer:cleaned = _BLANK_LINE_RUNS.sub("\n\n", content).strip()if not cleaned:return Text()- cache_key = hash(cleaned)- cached = cls._cache.get(cache_key)+ cached = cls._cache.get(cleaned)if cached is not None:return cached.copy()rendered = _apply_markdown_styles(cleaned)if len(cls._cache) > 100:cls._cache.clear()- cls._cache[cache_key] = rendered- return rendered+ cls._cache[cleaned] = rendered+ return rendered.copy()diff --git a/strix/interface/tui/renderers/shell_renderer.py b/strix/interface/tui/renderers/shell_renderer.pyindex 131bd6cd..22a6ec13 100644--- a/strix/interface/tui/renderers/shell_renderer.py+++ b/strix/interface/tui/renderers/shell_renderer.py@@ -71,7 +71,7 @@ def _truncate_line(line: str) -> str:def _clean_output(output: str) -> str:- cleaned = Text.from_ansi(output).plain.translate(_CONTROL_BYTES_TO_DROP)+ cleaned: str = Text.from_ansi(output).plain.translate(_CONTROL_BYTES_TO_DROP)for pattern in STRIP_PATTERNS:cleaned = re.sub(pattern, "", cleaned, flags=re.MULTILINE)