Fix cp_psql.sh for rootless Docker without psql
`tools/cp_psql.sh` falls back to `docker run --network host postgres:18 psql` when no psql client is installed. Runner nodes use ROOTLESS Docker, where host networking is the rootless namespace and not the host. The container then cannot reach the SSM port-forward bound on the host's 127.0.0.1, and every call fails with `connection to server at "127.0.0.1", port N failed: Connection refused`, even though the forward log shows the session open. Seen on 2026-11-03 by task 13065 on a dev runner node.
Requirements:
- When `psql` is missing, make cp_psql.sh work on a rootless-Docker node. For example, use a python3/psycopg fallback that reads the libpq env vars the script already exports (psycopg 3 is installed for the runner user). Or detect rootless Docker and refuse with a clear message that names the fix.
- Keep the read-only `cp_readonly` path and keep secrets out of argv, as the script does today.
Out of scope: changing the IAM role, the bastion route or the break-glass path.
Done means: on a node where `docker info` reports rootless and `command -v psql` is empty, `tools/cp_psql.sh dev -c 'select 1'` prints 1.
Outcome
cp_psql.sh now falls back to a psycopg psql stand-in (tools/cp_psql_client.py) in this netns, not a host-network container; Done-means verified live on a rootless node (prints 1). Quick gate green; PR #7848 queued to the merge lane.
Artifacts
Activity
- Created
- Run
- Runner started
- Runner ended (done)