open-swe/tests/test_local_integration.py
Ramon Nogueira ae04b72b41
feat: publish plans from sandbox files (#1635)
* feat: publish plans from sandbox files

Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>

* fix: avoid fixed plan filenames

Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>

* fix: virtualize local sandbox file paths

Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>

* fix: preserve plan_file_path across set_plan_status

set_plan_status was rewriting the content record with only markdown
and status, dropping plan_file_path. After a reject, the owner's
dashboard edit would mirror to a different file than the agent's
original, and the next save_plan could republish the stale file.
Preserve plan_file_path when updating status.

---------

Co-authored-by: Ramon Nogueira <270434257+ramon-langchain@users.noreply.github.com>
Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
2026-06-29 13:02:55 -07:00

32 lines
1.1 KiB
Python

import agent.integrations.local as local_mod
class _StubLocalShellBackend:
def __init__(self, *, root_dir, virtual_mode, inherit_env):
self.root_dir = root_dir
self.virtual_mode = virtual_mode
self.inherit_env = inherit_env
def test_create_local_sandbox_creates_missing_root_dir(monkeypatch, tmp_path):
root = tmp_path / "nested" / "openswe-sandbox"
monkeypatch.setenv("LOCAL_SANDBOX_ROOT_DIR", str(root))
monkeypatch.setattr(local_mod, "LocalShellBackend", _StubLocalShellBackend)
backend = local_mod.create_local_sandbox()
assert root.is_dir()
assert backend.root_dir == str(root)
assert backend.virtual_mode is True
assert backend.inherit_env is True
def test_create_local_sandbox_defaults_to_cwd(monkeypatch, tmp_path):
monkeypatch.delenv("LOCAL_SANDBOX_ROOT_DIR", raising=False)
monkeypatch.chdir(tmp_path)
monkeypatch.setattr(local_mod, "LocalShellBackend", _StubLocalShellBackend)
backend = local_mod.create_local_sandbox()
assert backend.root_dir == str(tmp_path)
assert backend.virtual_mode is True