Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
fix: preserve background operator in allowlist segments
chengyongrud5658dbc91db
diff --git a/nanobot/agent/tools/shell.py b/nanobot/agent/tools/shell.pyindex 565b38eb5..4950925ab 100644--- a/nanobot/agent/tools/shell.py+++ b/nanobot/agent/tools/shell.py@@ -882,6 +882,7 @@ class ExecTool(Tool):elif ch == "&" and not ((i > 0 and command[i - 1] in "<>") or command.startswith("&>", i)):+ current.append(ch)operator_len = 1elif ch in {";", "|"}:operator_len = 1diff --git a/tests/tools/test_exec_allow_patterns.py b/tests/tools/test_exec_allow_patterns.pyindex 12a35059f..0a10d5ec8 100644--- a/tests/tools/test_exec_allow_patterns.py+++ b/tests/tools/test_exec_allow_patterns.py@@ -76,6 +76,15 @@ def test_guard_allow_patterns_block_single_ampersand_chained_segment():assert "allowlist" in result.lower()+def test_guard_allow_patterns_preserve_trailing_background_operator():+ tool = ExecTool(allow_patterns=[r"echo\s+allowlisted"])++ result = tool._guard_command("echo allowlisted &", "/tmp")++ assert result is not None+ assert "allowlist" in result.lower()++def test_guard_allow_patterns_keep_fd_redirection_ampersand():tool = ExecTool(allow_patterns=[r"echo\s+allowlisted\s+2>&1"])