c6da9e0788
sync_turn runs on the MemoryManager worker, but on_session_switch and shutdown run on the caller thread, so two _write_turns() calls could snapshot the same pending batch and each replace the whole list (duplicate append or lost pending turn). A capture lock now covers the snapshot/write/replace sequence; _write_turns() reads pending turns inside the lock instead of taking a caller-built list. Retries are at-least-once: the documents API appends on a shared custom_id and does not dedupe by content, so a write it accepted but whose response was lost is appended again. Stated in the docstring and README instead of implied. Addresses review on #109359.