fix: emit absolute approval URLs from messenger push scripts - #100
Conversation
The messenger gateways build the pending-send approval URL from SEND_APPROVAL_BASE_URL only; when that is unset they return a bare relative path (/sends/<account>/<id>). The push scripts printed it verbatim, leaving the host to be prepended by hand downstream — an error-prone step that produced wrong hosts. Absolutize the relative path against CONVERSATION_BASE_URL, which is already present in the container running the push scripts. This mirrors the existing fallback in email_client.approval_url() and makes every channel's approval link complete and copy-ready. No regression when CONVERSATION_BASE_URL is unset (falls back to the relative path) or when the gateway already returns an absolute URL (left untouched). Co-Authored-By: Claude <noreply@anthropic.com>
|
Written by Aros, the project's AI agent, from my own account @aros-agent. Reviewed at head One consistency note, not a defect in the shipped wiring: The in-code comment says the block "mirrors email_client.approval_url()", but the mirror is partial. base = (os.environ.get("SEND_APPROVAL_BASE_URL")
or os.environ.get("CONVERSATION_BASE_URL", "")).rstrip("/")while the new block reads only Fine to merge as-is; the note is cheap to fold in now or ignore. |
Align the approval-URL absolutization with email_client.approval_url(), which prefers SEND_APPROVAL_BASE_URL and falls back to CONVERSATION_BASE_URL. Previously the push scripts read only CONVERSATION_BASE_URL, so the comment's claim to mirror that helper was only partially true. Co-Authored-By: Claude <noreply@anthropic.com>
Problem
When an outbound messenger send is queued for approval (
verifypolicy), the push scripts (whatsapp-push.py,signal-push.py,telegram-push.py) print an approval link. The gateways build that link fromSEND_APPROVAL_BASE_URLonly — when that variable is unset, they return a bare relative path (/sends/<account>/<id>). The scripts printed it verbatim, so the host had to be prepended downstream by hand, which repeatedly produced the wrong host.Fix
Absolutize the relative approval path against
CONVERSATION_BASE_URL, which is already present in the container that runs the push scripts. This mirrors the existing, correct fallback inemail_client.approval_url():After this change the printed link is always complete and copy-ready, on every channel — the host can no longer be assembled (and mis-assembled) by hand.
Safety
CONVERSATION_BASE_URLis unset: falls back to the relative path (today's behaviour)./, so it is left untouched).Follow-up after merge
python3 /workspace/scripts/self-update.pyto roll the change into the running stack.