fix(codex): verify existing shared queue without mutation

This commit is contained in:
Codex
2026-07-18 10:26:16 +08:00
parent 56827247f0
commit 6170627542
2 changed files with 11 additions and 3 deletions
@@ -168,10 +168,9 @@ def ensure_shared_directory(path: Path, *, group_writable: bool = False) -> None
reject_symlink_chain(path.parent)
mode = 0o2770 if group_writable else 0o2750
try:
os.lstat(path)
except FileNotFoundError:
path.mkdir(parents=True, mode=mode)
except FileExistsError:
pass
else:
os.chmod(path, mode)
reject_symlink_chain(path)
st = os.lstat(path)
+9
View File
@@ -16,6 +16,7 @@ from services.aios_orchestrator_gateway.dispatch import DispatchSink
from services.aios_orchestrator_gateway.errors import ConflictError, DispatchError, ValidationError
from services.aios_orchestrator_gateway.models import Decision, Event
from services.aios_orchestrator_gateway.service import Runtime
from services.aios_orchestrator_gateway.securefs import ensure_shared_directory
from services.aios_orchestrator_gateway.store import Store
from services.aios_orchestrator_gateway.sync import OpenClawSynchronizer, lifecycle_record
from scripts import report_orchestrator_event
@@ -402,6 +403,14 @@ class StoreTests(unittest.TestCase):
class DispatchTests(unittest.TestCase):
def test_existing_shared_directory_is_verified_without_mkdir(self):
with tempfile.TemporaryDirectory() as temp:
queue = Path(temp) / "queue"
queue.mkdir(mode=0o2750)
queue.chmod(0o2750)
with mock.patch.object(Path, "mkdir", side_effect=PermissionError("sandbox")):
ensure_shared_directory(queue)
def test_codex_dispatch_uses_watcher_command_schema_at_active_root(self):
with tempfile.TemporaryDirectory() as temp:
outbox = Path(temp) / "outbox"