Location:
a2a_context.py:37-43
Code snippet:
def _atomic_write(path: Path, value: Any) -> None:
tmp = path.with_suffix(f"{path.suffix}.tmp")
tmp.write_text(json.dumps(value, sort_keys=True) + "\n")
tmp.chmod(0o600)
os.replace(tmp, path)
path.chmod(0o600)
Root Cause & Mechanism:
On Windows systems (or POSIX filesystems with strict ACL permissions), invoking path.chmod(0o600) or tmp.chmod(0o600) raises an OSError / PermissionError or is ignored with unexpected ACL side effects.
More critically, if _atomic_write fails mid-execution (e.g. after writing tmp but before os.replace), tmp remains left behind. On subsequent calls, os.replace(tmp, path) on Windows will throw PermissionError: [WinError 5] Access is denied or FileExistsError if path is locked or opened by another thread or process reading context asynchronously via read_a2a_turn_context().
Impact:
- Inbound Agent-to-Agent (A2A) turns throw unhandled file system exceptions.
- The thread context queue files lock up, causing loss of multi-agent turn state and crashing the gateway runner.
Location:
a2a_context.py:37-43Code snippet:
Root Cause & Mechanism:
On Windows systems (or POSIX filesystems with strict ACL permissions), invoking
path.chmod(0o600)ortmp.chmod(0o600)raises anOSError/PermissionErroror is ignored with unexpected ACL side effects.More critically, if
_atomic_writefails mid-execution (e.g. after writingtmpbut beforeos.replace),tmpremains left behind. On subsequent calls,os.replace(tmp, path)on Windows will throwPermissionError: [WinError 5] Access is deniedorFileExistsErrorifpathis locked or opened by another thread or process reading context asynchronously viaread_a2a_turn_context().Impact: