Diagnostic step 1
Modify archive_command to use a reliable, minimal environment wrapper: e.g. /usr/local/bin/archive-wrapper.sh that sets PATH, HOME, and uses ssh -i /var/lib/postgresql/.ssh/id_rsa -o BatchMode=yes -o ConnectTimeout=10, and logs stdout/stderr to /var/log/postgres-archive.log for each attempt.