Skip to content

fix(certificates): retry every provider failure once DNS has passed - #14117

Merged
HarshMN2345 merged 1 commit into
mainfrom
claude/certificate-retry-transient
Oct 5, 2026
Merged

HarshMN2345 merged 1 commit into
mainfrom
claude/certificate-retry-transient

Conversation

@HarshMN2345

@HarshMN2345 HarshMN2345 commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

What does this PR do?

Follow-up to #14009. That PR keeps a delayed provider's failures retryable for up to five attempts, but the flag that makes them retryable was only raised once the provider had returned an order. Three paths still failed the rule on a single transient error:

  • Every requeued job. It opens with isRenewRequired(), which for Fastly calls the API. One 5xx there moved the rule to unverified and mailed the security address, with no attempt kept.
  • Forced jobs (skipRenewCheck, used by the ssl task and the main domain's automatic certificate). The flag was raised only after issueCertificate(), so an error inside it was terminal.
  • A manual retry after five failed attempts. The retry endpoint reset only the certificate's logs, so the next failure counted as attempt six and was terminal at once.

This PR raises the flag for delayed providers as soon as DNS has passed (or was skipped), before any provider call. Instant providers (Let's Encrypt, Cloudflare) and DNS failures stay terminal, as on main. The retry endpoint now also resets the certificate's attempts, the same way enabling a webhook resets its own (Webhooks/Http/Webhooks/Update.php).

Test Plan

No new automated test. Workers are covered through e2e, and e2e only runs Let's Encrypt, which is instant, so it never takes this path. The existing CertificatesDomainValidationTest cases keep their asserted outcomes; I traced each one through the new flow.

Locally: php -l and Pint on both files. PHPStan and unit tests run in CI.

To verify on an environment with a delayed provider:

  1. Make the provider API fail once while a rule waits on an issuance, for example by blocking its host for one interval tick. The rule stays on generating and its certificate shows attempts: 1, with no mail sent.
  2. Restore access. The next tick verifies the rule once the provider reports the certificate issued.
  3. Let a rule fail five times, then press retry. It gets five more attempts.

Related PRs and Issues

Checklist

  • Have you read the Contributing Guidelines on issues?
  • If the PR includes a change to an API's metadata (desc, label, params, etc.), does it also include updated API specs and example docs?

Generated by Claude Code

The retry flag was only raised once the provider had returned an order,
so the renew check that opens every requeued job, and every forced job,
still failed the rule on a single transient provider error. Raise it for
delayed providers as soon as DNS has passed. Instant providers and DNS
failures stay terminal, as before.

A manual retry now also resets the certificate's attempts, as enabling a
webhook does, so it gets the full five attempts again.
@ghost

ghost commented Oct 5, 2026 •

Copy link
Copy Markdown

🟢 Tier S · Ready to merge

No additional concrete defects were found in the changed code after checking provider implementations and the surrounding retry flow.

The worker now marks delayed-provider failures as retryable immediately after DNS validation passes or is skipped, including renewal checks and forced issuance. Manual retries also reset the associated certificate’s attempt counter along with its logs.

Verdict New comments Fixed Still open
✅ Approved 0 0 0
📂 Walkthrough · 2
File Change
src/Appwrite/Platform/Workers/Certificates.php Moves delayed-provider retry eligibility ahead of renewal and issuance calls.
src/Appwrite/Platform/Modules/Proxy/Http/Rules/Status/Update.php Resets certificate attempts when manually retrying rule verification.

Reviewed 304cf08 · 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

@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → claude/certificate-retry-transient (after).

Metric Before After Change
🚀 Requests/sec 191.45 209.28 🟢 +9.3%
⏱️ Latency P50 90.54 ms 83.22 ms 🟢 -8.1%
⏱️ Latency P95 211.16 ms 191 ms 🟢 -9.5%
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 83.22 191 13,053 209.28 -20.16
Account 153.08 287.75 687 11.42 -34.14
TablesDB 80.31 151.61 7,099 116.1 -18.31
Storage 77.48 170.78 3,435 57.91 -5.73
Functions 116.5 228.79 1,832 31.63 -33.33

Top API waits (after)

API request Max wait (ms)
account.name.update 447.73
functions.create 391.98
functions.variables.update 387.89
tablesdb.rows.get 381.23
functions.variables.create 360.59

@HarshMN2345
HarshMN2345 force-pushed the claude/certificate-retry-transient branch from 63fe8a3 to 304cf08 Compare October 5, 2026 08:04

Copy link
Copy Markdown
Member Author

Tests / E2E / PostgreSQL (dedicated) / Teams failed on 304cf08 with POST /v1/teams → 403 "This self-hosted instance already has an organization" (Teams/Http/Teams/Create.php:91). This isn't caused by this PR: it doesn't touch Teams, the same check passed on main (f198599), and it also passed on 63fe8a3, which has the identical tree (this branch was only re-committed to change commit metadata). I'll re-run the failed job once when the workflow run finishes; GitHub refuses the re-run while other jobs are still running.


Generated by Claude Code

@HarshMN2345
HarshMN2345 merged commit 6d9ff31 into main Oct 5, 2026
95 of 96 checks passed
abnegate added a commit that referenced this pull request Oct 5, 2026
Merges main a2cca78 (#14009, #14106, #14117, #14115, #14119, #14114,
#14101, #14125, #14129, #14127) so cloud#5410 can require a train head
that contains main at or after 0ed7232.

Conflicts: none.

Database 8.0 port: none needed. Main's new code only uses Document
getAttribute/setAttribute and Query::equal/lessThan/orderAsc/limit
(Tasks/Interval.php), all unchanged in database 8.0; no removed
Database::* constants, config collections, or model magic reads.
composer.json and composer.lock are untouched by main, so the train's
database and migration pins stay as they are.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

1 participant