The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(tools): state the verified Windows mechanism for the mailbox chmod skip
unsupportedpastelsf9655b930452
diff --git a/tests/tools/test_bot_live_delivery_mailbox_dir.py b/tests/tools/test_bot_live_delivery_mailbox_dir.pyindex cefaf39c724..a064257efaf 100644--- a/tests/tools/test_bot_live_delivery_mailbox_dir.py+++ b/tests/tools/test_bot_live_delivery_mailbox_dir.py@@ -1,8 +1,9 @@"""The live-delivery mailbox lock dir (``tools.bot_live_delivery._locked``).-POSIX tightens the directory to 0700 on every entry. On Windows a chmod rewrites the NTFS ACL and-the owner then gets Permission denied opening ``.lock`` (the Telegram adapter crash-looped on it,-tracker #134889 W2), so the lock must stay re-enterable there.+POSIX tightens the directory to 0700 on every entry. On Windows the owner-only DACL comes from+``mkdir(mode=0o700)`` (CPython 3.13+) and chmod only toggles the read-only attribute, so the+Windows tests pin that the owner keeps re-entering the lock, including in a dir that the older+chmod-on-every-entry code created."""import stat@@ -27,3 +28,14 @@ def test_mailbox_lock_is_reenterable_on_windows(tmp_path):with _locked(tmp_path):pass(_root(tmp_path) / ".lock").open("a").close()++[email protected]("windows")+def test_mailbox_dir_chmodded_by_older_code_stays_lockable_on_windows(tmp_path):+ root = _root(tmp_path)+ root.parent.mkdir(parents=True)+ root.mkdir(mode=0o700)+ root.chmod(0o700) # what _locked did on every entry before it skipped chmod on Windows+ for _ in range(3):+ with _locked(tmp_path):+ passdiff --git a/tools/bot_live_delivery.py b/tools/bot_live_delivery.pyindex dd803f2cce6..f12e4d50cab 100644--- a/tools/bot_live_delivery.py+++ b/tools/bot_live_delivery.py@@ -122,8 +122,8 @@ def _locked(home: Path | str):root.parent.mkdir(parents=True, exist_ok=True)root.mkdir(mode=0o700, exist_ok=True)if os.name != "nt":- # NTFS has no POSIX mode: chmod rewrites the directory ACL, and the owner then gets- # Permission denied opening ``.lock`` below (the Telegram adapter crash-looped on it).+ # Windows chmod only sets or clears the read-only attribute, so it adds nothing there:+ # the owner-only DACL comes from mkdir's mode (CPython 3.13+) when it creates the dir.root.chmod(0o700)if created:# Only a fresh mailbox dir needs its parents durably linked; the live