The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(gateway): keep mailbox recovery alive after chmod denial
KoNit-K75098f1846fc
diff --git a/tests/tools/test_bot_live_owner_delivery.py b/tests/tools/test_bot_live_owner_delivery.pyindex ed58d07cdfe..c7f96eeb121 100644--- a/tests/tools/test_bot_live_owner_delivery.py+++ b/tests/tools/test_bot_live_owner_delivery.py@@ -63,6 +63,21 @@ def test_same_envelope_id_admits_once_and_conflicts_on_changed_payload(tmp_path,assert path.stat().st_mode & 0o077 == 0+def test_mailbox_lock_continues_when_directory_hardening_is_denied(tmp_path, monkeypatch, caplog):+ """An inherited Windows ACL may deny chmod without making the mailbox unusable."""+ real_chmod = Path.chmod++ def deny_mailbox_chmod(path, mode, *, follow_symlinks=True):+ if path == tmp_path / "runtime" / mailbox.DELIVERY_DIR_NAME:+ raise PermissionError("[WinError 5] Access is denied")+ return real_chmod(path, mode, follow_symlinks=follow_symlinks)++ monkeypatch.setattr(Path, "chmod", deny_mailbox_chmod)+ with mailbox._locked(tmp_path) as root:+ assert root == tmp_path / "runtime" / mailbox.DELIVERY_DIR_NAME+ assert "could not harden mailbox directory" in caplog.text++def test_cancel_queued_delivery_cancels_only_an_unadmitted_receipt(tmp_path, monkeypatch):"""main's cancel fence on the owner seam: a legacy unadmitted queued receipt is cancelledonce (idempotent); an authority admission is never cancelled from the mailbox."""diff --git a/tools/bot_live_delivery.py b/tools/bot_live_delivery.pyindex ad57c89fb1a..4e077fbe8b8 100644--- a/tools/bot_live_delivery.py+++ b/tools/bot_live_delivery.py@@ -121,7 +121,12 @@ def _locked(home: Path | str):created = not root.is_dir()root.parent.mkdir(parents=True, exist_ok=True)root.mkdir(mode=0o700, exist_ok=True)- root.chmod(0o700)+ try:+ root.chmod(0o700)+ except OSError as exc:+ # A foreign Windows ACL can deny WRITE_DAC even when this process can+ # still use the existing mailbox. Hardening must not abort recovery.+ log.warning("bot_live_delivery: could not harden mailbox directory %s (%s)", root, exc)if created:# Only a fresh mailbox dir needs its parents durably linked; the live# poller re-enters this lock twice a second per profile, and two