Skip to content

fix(mails): end a mail the project's own SMTP refused for good - #14027

Merged
levivannoort merged 18 commits into
mainfrom
fix/mails-permanent-smtp-rejection
Oct 7, 2026
Merged

levivannoort merged 18 commits into
mainfrom
fix/mails-permanent-smtp-rejection

Conversation

@levivannoort

@levivannoort levivannoort commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

Summary

The SMTP adapter now reports whether a failure is permanent: Response rows gain a permanent key. When a project's own SMTP server refuses for good, the mails worker throws Utopia\Queue\PermanentFailure, so the message is dead-lettered on the first attempt instead of being retried.

Part of appwrite-labs/cloud#5815, tracked in appwrite-labs/cloud#6216.

Why

A 535, 550 or 554 from a project's own server gives every attempt the same answer. On a broker that retries, each attempt:

  • repeats a failed login from the shared egress IP, which a provider then throttles for every project sending through it, and
  • holds one of the consumer's ack slots through its backoff (staging's mails queue: maxAckPending=12, backoff 30/120/600s).

The adapter already knew the reply class, but flattened it into a string such as No SMTP host answered: host:587 (Authentication failed: 535 …). Rather than parse that text, the adapter now passes its own verdict:

  • Permanent: a 5xx reply, including one sent in place of the greeting; a login refused with a 5xx; a server that cannot carry the message.
  • Not permanent: a dropped connection, a timeout, a 4xx, a reply that breaks the protocol.
  • Several hosts: the list counts as permanent only when every host refused for good (NoHostAnswered, still a ConnectionException).

The worker acts on it only for the project's own SMTP. Appwrite's own provider refusing is an incident on our side, so it keeps its retries. Messages and codes (401/500) are unchanged.

Evidence (Appwrite Cloud worker-mails, 7 days, all production regions)

class count verdict
535 login refused, many providers ~900 permanent
535 Too many failed login requests from <egress IP> 1,869 permanent
the same throttle as 554 in place of the greeting 1,308 permanent
551 Spamhaus listing 49 permanent
550/553/530/525 (unverified domain, invalid recipient, sender rejected, …) 67 permanent
450/454/421 11 retry
DNS, timeouts, closed connections ~40 retry
Appwrite's own provider 46 retry

3,904 of the 4,142 failures in the busiest region came from one project: 714 bad-credential refusals, then 3,182 throttle refusals caused by its own repeated logins. The throttle names our shared egress IP.

Tests

  • packages/messaging SMTPRefusalTest: 17 tests running the real adapter against a real socket that sends production reply lines. With the adapter change reverted, the permanent cases fail. The conservative cases also pass: no login offered with no reply code behind it is retried, and several recipients refused together are not marked permanent.
  • No E2E test, deliberately. CE's E2E stack runs only Redis, which parks a PermanentFailure on the failed list like any other error (packages/queue/src/Broker/Redis.php:192-201). No test on that stack can tell a permanent failure from a retryable one; the difference only exists on NATS. So the one-line mapping in the worker (project SMTP plus permanent → PermanentFailure) has no automated coverage.
  • The worker unit tests this PR first added are removed, per AGENTS.md.
  • Pint, Rector (tests config) and PHPStan are clean on the changed files.

Not covered

  • The pooled keep-alive path (client() → dial()) uses the same classifier but has no test of its own.
  • When every recipient is refused, the verdict follows the first refusal. Mails have a single recipient, so this doesn't matter here.
  • An attachment over 25 MB still throws a plain exception that is retried.
  • The Messaging worker's text-based isRetryableError() could read permanent instead. That's a follow-up.
  • Nothing changes on Redis: a failed mail already stays on the failed list.

Follow-ups after review (2026-10-07)

  • SMTP client: falls back to HELO only when EHLO is refused with a 5xx. A 4xx, including a 421 that has already closed the session, now surfaces as a transient TransactionException instead of a LogicException from writing on a closed transport.
  • Adapter: treats CapabilityException (no STARTTLS when required, no SMTPUTF8, over the advertised SIZE) as permanent.
  • Notifications worker: now fails a send that nobody accepted. Before, it discarded the adapter's result and persisted a refused notification as sent. It ends a permanent project-SMTP refusal with PermanentFailure. In a fan-out, a retryable failure takes precedence over a permanent one.
  • No E2E coverage for the Notifications paths: a refused project SMTP, and a mixed fan-out with one recipient refused for good and another failing transiently. AGENTS.md keeps workers out of the unit suite, so the fan-out unit test was removed.
  • Decided: project SMTP retries transient failures and ends permanent ones. main's 4ab36cb364 ended every project-SMTP failure without a retry. This branch keeps that for refusals that can't change (5xx → PermanentFailure). An unreachable or busy server (connection refused, 421, 450, 454) stays retryable, so a one-time code isn't lost to a moment's outage. A failure the adapter throws is retryable too, since no server reply says it will repeat. MailsTest::testProjectSmtpFailureIsNotRetried is removed: it encoded the replaced behaviour, and AGENTS.md keeps workers out of the unit suite. The verdict is pinned in packages/messaging SMTPRefusalTest; the worker branch has no E2E coverage.
    Note for Redis deployments (corrected): on Redis, a retryable failure and a PermanentFailure both land on the queue's failed list (Broker\Redis::reject()), and failed payloads never expire. So every project-SMTP failure is kept there again, payload included (project SMTP password, mail body). On NATS, a transient project-SMTP failure is retried up to maxDeliver and holds an ack slot while it backs off. This is under review before merge.

The SMTP client knows whether a reply is 4xx or 5xx, but the adapter
flattened every failure into a string, so a caller could only guess from
the text whether sending again could go differently. Each result now says
so: a 5xx reply, a refused AUTH carrying one, or a server that cannot
carry the message is permanent; a dropped connection, a timeout, a 4xx or
a reply out of protocol is not. With several hosts it is permanent only
when every host refused for good.

The verdict is tested against the reply lines production servers sent,
spoken by a real socket in a child process.
A project's own server answering 5xx -- a 535 for stale credentials, a
550 for an unverified sender domain, a 554 in place of the greeting --
answers every attempt the same way. On a broker that retries, each retry
repeats the failed login from the shared egress IP and holds one of the
consumer's ack slots through its backoff. In fra1 one project's stale
MailerSend credentials drew 714 refusals in a week, and MailerSend then
answered 3,182 more of its sends with "Too many failed login requests
from" our egress address -- a throttle on the address, not the account,
so it reaches any project sending through MailerSend from there.

Such a failure now throws PermanentFailure, so it is dead-lettered at the
first attempt. 4xx replies, timeouts and unreachable hosts keep their
retries, and so does anything sent through Appwrite's own provider, where
a refusal is an incident on our side. On Redis nothing changes: a failed
mail already stayed on the failed list.
@ghost

ghost commented Sep 30, 2026 •

Copy link
Copy Markdown

🟢 Tier S · Ready to merge

The incremental changes resolve the outstanding finding and introduce no new defects.

The SMTP adapter exposes permanent-refusal verdicts, with recipient-specific replies and conservative aggregation across hosts. Mails and notifications end permanent project-SMTP refusals while retaining transient failures for retry; notifications also verify acceptance before persistence and prioritize retryable fan-out failures. SMTP client changes preserve recipient refusals across reset errors and restrict HELO fallback to permanent EHLO refusals.

Latest changes: The newest commit removes the two added project-SMTP worker unit tests and their unused imports, resolving the worker-test placement finding.

Verdict New comments Fixed Still open
✅ Approved 0 1 0
📂 Walkthrough · 13
File Change
packages/messaging/src/Adapter/Email/SMTP.php Classifies permanent SMTP failures and preserves recipient-specific verdicts.
packages/messaging/src/Adapter/Email/SMTP/NoHostAnswered.php Carries an aggregate permanent verdict for failed host attempts.
packages/messaging/src/Response.php Adds a default-false permanent flag to recipient results.
packages/messaging/tests/Adapter/Email/SMTPRefusalTest.php Tests refusal classification and recipient/host aggregation over SMTP sockets.
packages/messaging/tests/Support/ScriptedSmtpServer.php Manages the scripted SMTP subprocess and its lifecycle.
packages/messaging/tests/Support/smtp-server.php Serves scripted SMTP replies on a loopback socket.
packages/smtp/src/Client.php Preserves recipient refusals across reset errors and restricts HELO fallback.
packages/smtp/src/Exception/TransactionException.php Adds an optional recipient-to-reply map.
packages/smtp/tests/ClientTest.php Tests recipient refusals, reset failures, and transient EHLO replies.
packages/smtp/tests/Support/FakeTransport.php Models closed transport behavior and resets state on connection.
src/Appwrite/Platform/Workers/Mails.php Ends permanent project-SMTP refusals and propagates other failures for retry.
src/Appwrite/Platform/Workers/Notifications.php Checks acceptance before persistence, prioritizes retryable fan-out failures, and injects the webhook client.
tests/unit/Platform/Workers/MailsTest.php Removes project-SMTP worker unit coverage and its supporting imports.
✅ Fixed since the last review · 1
  • Keep worker coverage out of the unit suite · tests/unit/Platform/Workers/MailsTest.php:199

Reviewed the commits since 7160cca · Details · Comment @hansi-codes review to re-run, or mention @hansi-codes with a question.

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Tier A · Looks good to merge. Summary

@greptile-apps

greptile-apps Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Medium risk] Changes how mail send failures are classified and retried.

The PR is not yet safe to merge because an RSET refusal can turn a temporary recipient refusal into a permanent verdict.

Fix All in Claude CodeFindings

  1. P1 RSET refusal replaces recipient verdicts ▶
  2. P2 Assertion mirrors message construction ▶
Fix with agent prompt
### Issue 1
packages/messaging/src/Adapter/Email/SMTP.php:110
If every recipient is refused and the server then rejects `RSET` with a 5xx, `reset()` throws before the client can return the individual recipient replies. This fallback gives every recipient the RSET reply and marks them permanently refused, even if a recipient’s own RCPT reply was a temporary 4xx. Callers then receive the wrong retry verdict for that recipient.

### Issue 2
tests/unit/Platform/Workers/MailsTest.php:undefined-201
This assertion copies the worker’s full exception message, including its fixed prefix and the scripted server’s entire reply. The repository requires tests to assert observable behavior rather than mirror source-code details. Check the refusal and terminal outcome without pinning the assembled string; this requirement must be satisfied before merging.

```suggestion
        $this->assertStringContainsString('550 5.2.1 Not sending to previously bounced email', $failure->getMessage());
```

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

The PR adds per-recipient SMTP permanence verdicts and makes the mails worker stop retrying a project SMTP refusal classified as permanent.

  • The latest revision preserves individual replies when all recipients are refused and makes the HELO-fallback fixture exercise that path.
  • An RSET failure can still replace those individual replies with an incorrect permanent verdict.

Reviews (5) · Last reviewed commit: "fix(messaging): give every refused recip..."

@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → fix/mails-permanent-smtp-rejection (after).

Metric Before After Change
🚀 Requests/sec 196.39 204.73 ⚪ +4.2%
⏱️ Latency P50 89.57 ms 85.86 ms ⚪ -4.1%
⏱️ Latency P95 203.45 ms 194.4 ms ⚪ -4.4%
Per-scenario breakdown & investigation details

Metrics below reflect the current branch (after). Δ P95 compares against the base.

Scenario P50 (ms) P95 (ms) Requests RPS Δ P95 (ms)
API total 85.86 194.4 12,768 204.73 -9.05
Account 160.26 292.82 672 11.23 -28.39
TablesDB 84.02 160.13 6,944 112.84 -2.13
Storage 76.25 166.6 3,360 56.36 -2.03
Functions 118.18 229.82 1,792 30.79 -15.74

Top API waits (after)

API request Max wait (ms)
account.name.update 464.62
account.prefs.update 450.53
functions.create 406.6
functions.delete 398.78
functions.variables.create 340.64

Workers are covered end to end, not in the unit tier (AGENTS.md). The
permanence verdict stays covered where it is decided, in the messaging
package's SMTPRefusalTest. On the Redis broker the E2E stack runs, a terminal
verdict is deliberately parked like any failure, so no E2E test there can
observe it.
@levivannoort

Copy link
Copy Markdown
Member Author

Addressed the findings from the latest review summary in 3c4f43b:

  • Message-wide refusals (valid): when every recipient is refused, TransactionException now carries each recipient's own reply ($rejected, set by Client::sendRaw). The adapter gives each recipient its own verdict. A refusal of the message itself, such as a MAIL FROM or DATA reply, has no per-recipient map and holds for every recipient, so a 5xx there is permanent for all of them. New tests: testEveryRecipientRefusedKeepsItsOwnVerdict (a 550 and a 450 are marked permanent and retryable respectively) and testAMessageRefusedAsAWholeIsFinalForEveryRecipient. Both fail on the previous adapter. There's also a client test in packages/smtp for the per-recipient map.
  • HELO fallback case (valid): the 'no login offered' case now answers EHLO with 450 4.7.0, so the client really falls back to HELO. It ends with 'No shared mechanism. The server offers: none', which is retried.
  • Worker test tier and the message-constructing assertion: both are on MailsTest cases that were removed in b07a7b0.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

@levivannoort

Copy link
Copy Markdown
Member Author

@tenki-reviewer

@luxor-code-review

luxor-code-review Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Review complete. 🟠 1 high · 🟡 2 medium

💬 Inline comments (1)

  • 🟡 Treat CapabilityException as permanent in permanent() — SMTP.php:218
📍 Findings outside the diff (2) — 🟠 1 high · 🟡 1 medium — defects on lines GitHub can't attach comments to

🟠 High — HELO fallback runs on a session a 421 EHLO already discarded · Client.php:270–279 · unchanged line

// packages/smtp/src/Client.php
270	    private function hello(): void
271	    {
272	        try {
273	            $this->capabilities = Capabilities::fromReply($this->command("EHLO {$this->domain}", [250]));
274	        } catch (TransactionException) {
275	            // A server too old for ESMTP still has to answer HELO.
276	            $this->command("HELO {$this->domain}", [250]);
277	            $this->capabilities = Capabilities::none();
278	        }
279	    }

hello() catches TransactionException from EHLO and falls back to HELO without checking whether the session survived, but a 421 reply makes expect() call discard() before throwing (packages/smtp/src/Client.php:457-459). The subsequent command("HELO ...") then writes on the closed transport, whose guard throws a bare \LogicException('The transport is not connected') that is not an SmtpException, so it escapes every catch (SmtpException) in the adapter and worker. RFC 5321 requires a 421 at any point to end the session, so a busy server answering EHLO with 421 crashes the send instead of surfacing a retryable error.


🟡 Medium — Propagate PermanentFailure to the Notifications worker · src/Appwrite/Platform/Workers/Notifications.php

The new permanent-failure mechanism — read permanent from the adapter's Response results and throw Utopia\Queue\PermanentFailure so a permanently refused project SMTP send is not retried — is implemented only in src/Appwrite/Platform/Workers/Mails.php:252. src/Appwrite/Platform/Workers/Notifications.php:343-358 dials the project's SMTP through the same new SMTP(...) / $type === 'smtp' path but discards the send() result entirely and throws a plain retryable Exception. A project whose SMTP server answers 535/550/554 for good is still retried forever from the shared egress IP, the exact throttling and stale one-time-code problem this change fixes for Mails.

🧹 Nitpicks (2) — 🟢 2 low
  • 🟢 ScriptedSmtpServer constructor leaks the child process on startup failure (ScriptedSmtpServer.php:42) — If the server child fails to report a port (timeout or error output), the constructor throws at ScriptedSmtpServer.php:45-47 after proc_open() already succeeded.
  • 🟢 closedPort() releases the reserved port before use (ScriptedSmtpServer.php:73) — closedPort() at ScriptedSmtpServer.php:73-82 binds an ephemeral port only to learn the number, then fclose($socket) releases it; between that close and the test's connection attempt the OS may hand the port to another process.

The PR makes SMTP recipient refusals (5xx) terminate delivery with a PermanentFailure instead of looping in the queue. The smtp client now carries rejected recipients in TransactionException, the messaging adapter aggregates per-host permanence in NoHostAnswered, Response::addResult gains a permanent flag, and the Mails worker skips retries on permanent errors. A new SMTPRefusalTest plus a ScriptedSmtpServer subprocess harness exercises the refusal paths end to end.

Files Change
packages/smtp/src/Client.php, Exception/TransactionException.php Thrown transaction exceptions now expose rejected recipients for classification.
packages/messaging/src/Adapter/Email/SMTP.php, SMTP/NoHostAnswered.php Classifies failures as permanent and aggregates verdicts across candidate hosts.
packages/messaging/src/Response.php addResult/details accept a permanent flag surfaced to workers.
src/Appwrite/Platform/Workers/Mails.php Honors permanent results to stop retrying hopeless deliveries.
packages/messaging/tests/*, packages/smtp/tests/* New refusal tests with a scripted SMTP server harness.
src/Appwrite/Platform/Workers/Notifications.php (unchanged) Suggested follow-up: apply the same permanent-failure handling there.

Reviewed commit: 5a53276

@luxor-code-review luxor-code-review Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expand to see previous review

This PR adds permanent-failure detection to the SMTP messaging adapter, propagating it through Response details and the Mails worker so refused messages are no longer retried forever, with a scripted SMTP test harness.

Key findings

  • 🟠 HELO fallback runs on a session a 421 EHLO already discarded — Client.php:270
  • 🟡 Treat CapabilityException as permanent in permanent() — SMTP.php:218
  • 🟡 Propagate PermanentFailure to the Notifications worker — Notifications.php

A 4xx to EHLO is a busy or closing server, not one without ESMTP, and a
421 has already ended the session: HELO was written on the closed
transport, which throws a LogicException no SmtpException catch sees.
The fake transport now refuses reads and writes after close(), as Native
and Swoole do, which is what let this pass unnoticed.
No STARTTLS when it is required, no SMTPUTF8 for a non-ASCII address, a
message over the advertised SIZE: none can change on a retry, now that a
HELO session only follows a server that does not speak ESMTP at all.
…for good

The adapter records refusals in its result instead of throwing, and the
worker discarded that result, so a refused notification was persisted as
sent and never retried. As in the mails worker: a project's own server
that refused permanently ends with PermanentFailure, anything else is
retried.
@levivannoort

levivannoort commented Oct 7, 2026 •

Copy link
Copy Markdown
Member Author

@tenki-reviewer thanks. Each finding is addressed below.

🟠 HELO fallback on a session a 421 EHLO discarded: valid, fixed in e6b12c7.

  • The fix: Client::hello() falls back to HELO only when EHLO is refused with a 5xx (RFC 5321 §4.1.4: a server without ESMTP). A 4xx is now rethrown as the transient TransactionException it is. That covers 421, which expect() has already answered by discarding the session.
  • Why no test caught it: FakeTransport accepted writes after close(), while Native and Swoole throw LogicException('The transport is not connected'). The fake now does the same.
  • New tests:
    • ClientTest::testA421ToEhloEndsTheSessionInsteadOfFallingBackToHelo and testATemporaryRefusalOfEhloIsNotTakenForAServerWithoutEsmtp: no HELO is written, and the error is transient.
    • SMTPRefusalTest: closing at EHLO (a real socket and the real Native transport) and EHLO refused for now. The second replaces the old no login offered case, which recorded the 4xx→HELO behaviour.
  • Seen red: with the old hello(), the 421 cases fail with exactly the LogicException you described.

🟡 CapabilityException should be permanent: valid, fixed in 5b3981c. Answered on the inline thread. It's sound only together with the HELO fix, which is why both are in this round.

🟡 Notifications worker: valid, and worse than described. Fixed in 6eaefcb. The SMTP adapter records a refusal in its result rather than throwing, and Notifications::dispatchEmail() discarded that result. So a refused notification wasn't retried forever: it was persisted as sent and never retried at all. It now matches the Mails worker:

  • deliveredTo === 0 from a project's own SMTP with a permanent refusal → PermanentFailure;
  • any other undelivered send → a retryable exception.

CE doesn't unit-test workers, and no E2E reaches a refusing project SMTP for notifications, so this path is covered by the adapter tests only.

🟢 Nitpicks

  • ScriptedSmtpServer leaks the child on startup failure: fixed in 4d46ad2. The constructor closes the pipes and terminates the process before throwing, since the destructor never runs for a constructor that threw.
  • closedPort() race: acknowledged, not changed. Another process would have to bind that exact ephemeral port between the fclose() and the connect, and that case would fail as a refused connection, which is the outcome the test asserts.

Checks:

  • Tests: packages/smtp 198 tests pass; packages/messaging 126 tests pass, all 19 in SMTPRefusalTest.
  • PHPStan: clean at each package's own level (smtp max, messaging 6) and on Notifications.php.
  • Pint: passes on every changed file.

@luxor-code-review

luxor-code-review Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Review complete. No blocking issues — approved ✅; 3 nitpicks below.

🧹 Nitpicks (3) — 🟢 3 low
  • 🟢 Stale @return shape on Response::toArray() (Response.php) — The results entries gained the fixed permanent key and were re-typed to array{recipient, status, error, permanent} on the class property and getDetails(), but toArray()'s @return still claims array<array<string, mixed>>.
  • 🟢 closedPort() frees the port before the client dials it (ScriptedSmtpServer.php:79) — closedPort() binds a listener, reads the port, and closes the socket before returning (packages/messaging/tests/Support/ScriptedSmtpServer.php:81-90), so the port is unowned between the reservation and the adapter's connect.
  • 🟢 Failure paths record divergent spans in the two workers (Mails.php:238) — The two new zero-delivery failure paths are parallel implementations but instrument differently: Mails.php records only Span::add('mail.status', 'failure') with no error span (src/Appwrite/Platform/Workers/Mails.php:239), while Notifications.php records only Span::add('email.error', $error) with no status marker (src/Appwrite/Platform/Workers/Notifications.php:365).

This change distinguishes permanent (5xx) from transient (4xx/connection-drop) SMTP failures end to end, letting workers throw PermanentFailure only for truly permanent refusals.

Files Change
packages/smtp/src/Client.php, packages/smtp/src/Exception/TransactionException.php Captures per-recipient replies on transaction failures, treats EHLO 4xx as non-fallback (no HELO retry), and discards sessions whose reset() fails.
packages/messaging/src/Adapter/Email/SMTP.php, .../NoHostAnswered.php, packages/messaging/src/Response.php Aggregates host outcomes into a permanent flag on NoHostAnswered and threads it through Response::addResult() results.
src/Appwrite/Platform/Workers/Mails.php, src/Appwrite/Platform/Workers/Notifications.php Consume the permanent flag to raise PermanentFailure vs retryable exceptions, with dedicated zero-delivery failure paths.
packages/messaging/tests/Support/*, packages/messaging/tests/Adapter/Email/SMTPRefusalTest.php, packages/smtp/tests/* New scripted in-process SMTP server, fake transport, and refusal/permanence tests covering the new failure paths.

Overall the implementation is logically consistent; the verified findings are low-severity polish items (stale @return doc, a test port-selection race, and divergent span instrumentation between the two workers).

Reviewed commit: 6eaefcb

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Tier B · 1 blocking finding to address. Summary

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown

Security rules

No new WARNING or ERROR findings from security rules.

32 existing findings tracked in .semgrep/baseline.json
  • php.appwrite.guest-write-without-abuse-limit (17)
  • php.appwrite.permissive-write-permission (8)
  • php.appwrite.secret-compare-timing (5)
  • php.appwrite.weak-secret-env-default (2)

Posted by Checks / Rules. Re-runs update this comment in place. Rule details and baseline: .semgrep/README.md.

…n a fan-out

action() kept only the first failure, so a permanent refusal for one
recipient dead-lettered a message that another recipient's transient
failure still needed retried.

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Tier A · Looks good to merge. Summary

AGENTS.md keeps workers out of the unit suite. The precedence rule is
covered by review and documented as an E2E gap in the PR.
…refused for good

Reconciles main's 4ab36cb, which ended every project-SMTP failure,
with this change's split: a 5xx refusal ends the job with
PermanentFailure, while an unreachable or busy server stays retryable so
a one-time code is not lost to a moment's outage. The test for an
unreachable project server now asserts the retry, and a scripted 535
asserts the end.

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Tier A · Looks good to merge. Summary

…suite

AGENTS.md keeps workers out of the unit suite. The retry-or-end verdict is
pinned where it is decided, in packages/messaging's SMTPRefusalTest over a
real socket; main's testProjectSmtpFailureIsNotRetried encoded the
behaviour this change replaces.

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Tier S · Looks good to merge. Summary

@levivannoort
levivannoort merged commit 8e05a8b into main Oct 7, 2026
57 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants