mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-10 18:35:48 +08:00
Stop shell Excel builds, default write_file paths, and cap short-intent tool rounds.
Refuse openpyxl/pandas-to_excel via run_command, auto-write content-only files under tmp/, and limit WhatsApp ops short intents to 8 tool rounds by default. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
a5ebabbaae
commit
d8bc08ee0d
6 changed files with 162 additions and 13 deletions
|
|
@ -24,3 +24,18 @@ def test_run_command_accepts_cmd_alias(monkeypatch) -> None:
|
|||
out = spec.handler(filtered)
|
||||
assert out.get("ok") is True
|
||||
assert calls[0]["command"] == "echo hi"
|
||||
|
||||
|
||||
def test_run_command_blocks_openpyxl_xlsx() -> None:
|
||||
from runtime.tools.public.run_command_tool import _looks_like_xlsx_via_shell
|
||||
|
||||
assert _looks_like_xlsx_via_shell("python -c \"import openpyxl; wb=openpyxl.Workbook()\"")
|
||||
assert _looks_like_xlsx_via_shell("python -c \"df.to_excel('a.xlsx')\"")
|
||||
assert not _looks_like_xlsx_via_shell("echo hello")
|
||||
|
||||
spec = run_command_tool()
|
||||
out = spec.handler({"command": "python -c \"import openpyxl; openpyxl.Workbook()\""})
|
||||
assert out.get("ok") is False
|
||||
assert out.get("error_code") == "xlsx_via_shell_forbidden"
|
||||
assert out.get("retry_forbidden") is True
|
||||
assert "write_xlsx" in (out.get("fallback_tools") or [])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue