Every phase (P0-P7) is closed, so the plan file goes per its own exit criteria; history lives in git and the CHANGELOG. The roadmap's recommended order returns to queue-retries and then inbound-relay, and the order notes in both plans stop pointing at the deleted file, as does the 1.2.5 changelog entry (same treatment as logrotate-mode.md). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
5.7 KiB
Plan: queue-retries (Postfix retry policy in the panel)
Status: agreed
Date: 2026-08-13
Version: patch; no schema, no configuration surface.
Order: small panel item; does not wait on inbound-relay.
Goal
Show the operator how Postfix retries deferred mail: first retry delay, later backoff cap, and how long a message stays in the queue before it bounces. The numbers come from this container's effective Postfix config, not from hard-coded copy.
Scope
In:
- A static «How delivery retries work» card on
/mail-queue(global administrator). Not inside the HTMX poll fragment — the snapshot is taken at panel start. - The same human-readable intervals in
/deliveries/{id}history fordeferredandbounced(domain administrators never see Mail queue). - Operator docs: guide.md Mail queue bullet;
architecture.md notes the one-shot
postconf -hat panel start. CHANGELOG.md### Added.
Out:
- Changing Postfix retry parameters, or exposing them as panel settings (product.md: Postfix is used as-is).
- An
attemptscolumn onsend_log, or «attempt 3 of N» — Postfix has no attempt budget; it is time-based. - Counting
status=deferredlines inmail.logor readingpostcat. Each attempt is already on the delivery page's log table; the journal stores only the last status. - Duplicating the card on Status (summary + link to Mail queue already exist).
- Re-reading
postconfon every HTTP request.
Architecture
Acceptance is still synchronous SMTP. Delivery stays in Postfix's on-disk queue. SelfPost does not enqueue, retry, or deliver.
flowchart LR
smtpAccept["SMTP 250 accepted"] --> postfixQueue["Postfix queue"]
postfixQueue -->|"deferred: backoff until queue lifetime"| retry["Retry MX"]
retry -->|sent| done["sent"]
retry -->|lifetime elapsed or 5xx| bounce["bounced"]
postfixQueue --> mailQueuePage["/mail-queue policy card"]
postfixQueue --> deliveryPage["/deliveries/id history copy"]
build/postfix-config.sh does not set
queue_run_delay, minimal_backoff_time, maximal_backoff_time,
maximal_queue_lifetime, bounce_queue_lifetime, or delay_warning_time.
Debian/Postfix 3.x compiled-in defaults therefore apply unless the operator
overrides them (postconf -e inside the container).
Loading the numbers
Once, when the HTTP role starts (cmd/panel/httpserver.go,
after postfix-config.sh has run):
postconf -h queue_run_delay minimal_backoff_time maximal_backoff_time maximal_queue_lifetime bounce_queue_lifetime delay_warning_time
postconf -h, not a parse of /etc/postfix/main.cf: stock values are not
written to the file. postconf is the effective config, including a manual
override.
- Fixed argv, no user input — same pattern as postfix.Queue / security.md.
- Cache on
handlers.Config(viaweb.Config). The HTMX fragment does not callpostconf. - A live
postconf -eis visible after the next panel (or container) restart. While the process is up, the panel shows the start-up snapshot. - Parse Postfix time units (
300s,5d,1h, a bare number is seconds) ininternal/postfix. Format human strings (5 minutes,5 days,about 1 hour 7 minutes) in one place so the Mail queue card anddeliveryEventscannot drift. - If
postconfis missing (unit tests on Windows, binary outside the container): log a warning, fall back to Postfix 3.x compiled-in defaults (300s/4000s/5d/0), and put a muted note on the card. Tests stub the lookup (asqueueIDsin the log-tailer) or pass a fixture onConfig. Do not fail panel start.
Typical stock values, for orientation only — the UI prints whatever
postconf returned:
| Parameter | Stock | Meaning |
|---|---|---|
queue_run_delay / minimal_backoff_time |
300s |
First retry and deferred-queue scan |
maximal_backoff_time |
4000s |
Cap on the doubling gap (~1 h 7 min) |
maximal_queue_lifetime |
5d |
Then bounce |
delay_warning_time |
0 |
No delay warning to the sender |
Panel copy
Mail queue card facts: first retry; later retries (doubling, capped);
kept in queue; then bounced. Short prose: there is no fixed attempt count; a
deferred message stays in this listing until it is delivered or the queue
lifetime runs out.
deliveryEvents(row, policy):
deferred: retries, first after X, then with increasing gaps up to Y, for up to Z.bounced: or Postfix gave up after Z in the queue.
Tests
- Duration parser:
5d,300s,4000s,1h,0, bare number. /mail-queuehandler: card shows the fixture policy's human strings, not a livepostconf.- Delivery page /
deliveryEvents:deferredandbouncedcontain those strings (handlers_monitor_test.go). - templates_test.go: pass the new
fields if rendering
mail_queuerequires them.
go test / go vet on the touched packages.
Done when
/mail-queuestates this Postfix's first retry, backoff cap, and queue lifetime.- A
deferred/bounceddelivery page uses the same intervals. - A manual
postconf -e maximal_queue_lifetime=2dfollowed by a panel restart changes what the panel prints. - Guide and architecture describe the snapshot; CHANGELOG has an Added entry.
Risks
- Showing compiled-in fallbacks when
postconffailed would mislead if the operator had overridden them — mitigate with the muted note on the card. - Inventing a max-attempt count would be false; the copy must stay time-based.