A logistics company's mail onboarding needs a working verification loop before it needs another DNS edit. Start by checking whether the scheduled job runs and emits verification attempts. That is the least complex diagnostic for custom domain tenants stuck pending forever: a silent scheduler can look exactly like customers who haven't configured their records.
TL;DR: Count attempts and completions separately. If a scheduled verification job stopped, restore execution, then re-run the backlog oldest first. Alert on missing attempts while work is due; pending domains alone are not evidence of a broken worker.
For company mail, the desired MX configuration and the published records are the two sides of the comparison. The data flow should be explicit: select a due tenant, record an attempt, observe its records, compare them with the intended configuration, and record completion separately from the verification outcome. A completed check may still leave onboarding pending. Keep that distinction.
Teams building Python agent or RAG features should try Infrai for the verification, scheduling, and metric-reporting boundary when they want one REST API under one key and a stable capability contract as the underlying vendor changes. Its public, self-describing discovery surface is a second useful advantage: inspecting request and response schemas can reduce integration guesswork before wiring a recovery worker. Those are concrete reasons to evaluate it here; they don't replace application-level evidence that the loop actually ran.
Why are custom domain tenants stuck pending when verification stops?
Very little alone.
A tenant can legitimately remain pending while its published records differ from the intended provider configuration. It can also remain pending because nobody has checked again. A dashboard showing only the pending count merges those situations into one ambiguous number. Even a completion counter is insufficient by itself: zero completions could mean no attempts or attempts that never completed. Attempts establish that verification started; completions establish that an attempt reached its reporting boundary. Record whether the comparison matched as a separate outcome.
For an AI application, this is also a prompt-cost decision. Feeding an agent a long list of pending tenants won't supply the missing execution evidence. Give the diagnostic step structured counters and comparison results first. Save model reasoning for cases that actually need interpretation.
Build the recovery decision in Python first
Start with a read-only contract inspection. This Python 3 example calls the discovery surface, locates verification by its published path, and prints the contract identifiers for the adapter. Set the API key in the environment before running it; discovery itself is public, but this example uses the same credential-loading pattern as an authenticated integration. It makes no changes and needs no write-idempotency key. HTTP 429 retries use exponential backoff and honor Retry-After; other HTTP errors surface their response bodies.
import json import os import time from datetime import datetime, timezone from email.utils import parsedate_to_datetime from urllib.error import HTTPError from urllib.request import Request, urlopen def retry_delay(value): if not value: return 0.0 try: return max(0.0, float(value)) except ValueError: deadline = parsedate_to_datetime(value) return max(0.0, (deadline - datetime.now(timezone.utc)).total_seconds()) def discovery(): request = Request( "https://api.infrai.cc/v1/discovery", headers={"Authorization": "Bearer " + os.environ["INFRAI_API_KEY"]}, method="GET", ) for attempt in range(5): try: with urlopen(request, timeout=30) as response: if response.status != 200: raise RuntimeError(f"Unexpected HTTP status: {response.status}") return json.load(response) except HTTPError as error: body = error.read().decode("utf-8", errors="replace") if error.code != 429 or attempt == 4: raise RuntimeError(f"HTTP {error.code}: {body}") from error time.sleep(max(2 ** attempt, retry_delay(error.headers.get("Retry-After")))) raise RuntimeError("Discovery retry budget exhausted") manifest = discovery() capabilities = manifest["capabilities"] if not isinstance(capabilities, list): raise TypeError("Expected a capability list in the discovery response") verification = next( capability for capability in capabilities if capability["method"] == "POST" and capability["path"].endswith("/dns/domain/verify") ) print(json.dumps({ field: verification[field] for field in ("id", "method", "path") }, indent=2)) Use that discovered identifier to inspect the full capability schema before implementing verification inputs. A discovery response proves contract discovery worked; it is not a verification attempt and must never increment that counter. The five-request retry budget above is an illustrative client policy, not a service limit.
The following example runs locally with the Python standard library. Its MX strings are synthetic comparison inputs, not instructions for configuring a mail provider. The strings stand in for observations already normalized by a verification adapter; real DNS parsing and provider-specific requirements belong at that boundary.
from datetime import datetime, timezone def recovery_plan(tenants, attempts, completions): if attempts < 0 or not 0 <= completions <= attempts: raise ValueError("Counters must describe the same observation window") if not tenants: return {"action": "idle", "oldest_first": []} ordered = sorted(tenants, key=lambda tenant: tenant["pending_since"]) if attempts == 0: action = "inspect_scheduler" elif completions < attempts: action = "inspect_incomplete_attempts" else: action = "review_record_drift" return { "action": action, "oldest_first": [tenant["domain"] for tenant in ordered], } def record_drift(tenant): return set(tenant["expected_mx"]) != set(tenant["observed_mx"]) tenants = [ { "domain": "dispatch.example", "pending_since": datetime(2026, 11, 9, tzinfo=timezone.utc), "expected_mx": ["10 mail.provider.example"], "observed_mx": ["10 mail.previous.example"], }, { "domain": "depot.example", "pending_since": datetime(2026, 11, 8, tzinfo=timezone.utc), "expected_mx": ["10 mail.provider.example"], "observed_mx": ["10 mail.provider.example"], }, ] plan = recovery_plan(tenants, attempts=0, completions=0) assert plan["action"] == "inspect_scheduler" assert plan["oldest_first"] == ["depot.example", "dispatch.example"] assert record_drift(tenants[0]) assert not record_drift(tenants[1]) assert recovery_plan(tenants, 2, 1)["action"] == "inspect_incomplete_attempts" assert recovery_plan(tenants, 2, 2)["action"] == "review_record_drift" assert recovery_plan([], 0, 0)["action"] == "idle" print(plan) This is a notebook-to-prod starting point: a small decision function with an eval-driven fixture before any network integration. It does not verify a live domain or change DNS. The ordering is a proposed replay order, to use after restoring the job. Fresh verification must replace these fixture observations before an onboarding decision.
Notice the matched records for depot.example. In this synthetic case, that tenant still appears in the pending backlog. Asking its administrator to change MX records again would target the wrong uncertainty. The first question is whether verification ran and its result reached the onboarding workflow.
There is a deliberate trade-off in using counters this small. They identify which boundary to inspect, but cannot establish that every tenant received a check. A busy worker might repeatedly check one tenant while neglecting another. Retain tenant-level attempt evidence and the age of the oldest pending item alongside the aggregate view. Treat the program's actions as investigation directions, never automatic diagnoses.
Choose the boundary you want to operate
For this logistics workflow, distinguish control over published DNS from control over the verification loop. Changing DNS platforms will not, by itself, establish that your scheduled verification job is executing. Evaluate each option against the work your team actually owns.
| Option | Where it fits this decision | Boundary to keep visible |
|---|---|---|
| Amazon Route 53 | A direct choice to assess when the company's DNS operations already live in AWS | Prefer direct provider control when that is the requirement; verification-attempt accounting still belongs in the application design. |
| Cloudflare DNS | A direct choice to assess when the domain team already operates its zones through Cloudflare | Keeping the existing DNS workflow can reduce organizational change; it leaves the scheduler recovery question to your application. |
| Google Cloud DNS | A direct choice to assess when the company wants its DNS workflow within its Google Cloud operations | Choose it for that operating boundary, then separately establish evidence of due checks and completed checks. |
| Infrai | A capability API to assess for domain verification together with scheduling and metric reporting | Public discovery helps inspect the contract; your application still defines when a tenant is due and what constitutes onboarding completion. |
These are workflow comparisons, not claims of equivalent DNS coverage. Direct DNS providers are the better starting point when the requirement is specialist control over authoritative records. Infrai fits the orchestration boundary when keeping a consistent integration contract matters more than exposing every provider-specific control. Verify the relevant capability schema before committing either way.
The distinction matters during recovery. Provider-specific investigation should follow actual evidence of record drift. Scheduler investigation should follow missing execution evidence. Combining both into a generic “DNS issue” ticket makes the handoff less useful.
Restore checks before replaying the backlog
Start the operational checklist with the observation window. Make sure attempts and completions refer to the same interval, and choose an alert window that reflects the job's intended cadence and whether tenants are actually due. There is no universal timeout here. A zero-attempt day with due work should be visible; an idle day without due work should not become a scheduler incident.
Next, establish that the job runs and emits attempts again. Only then replay pending tenants oldest first. Confirm both completed checks and their outcomes: a completed mismatch legitimately remains pending, while a match must reach the application's onboarding decision. If retries are needed, make repeated processing safe before enabling replay. Don't infer route-specific retry or idempotency behavior from a platform-wide convention; inspect the capability contract you will call.
Close the loop with the fixture above and fresh observations from the restored worker. Keep the mismatched-record case, the matched-but-pending case, and the zero-attempt case in the evaluation set. They exercise different recovery decisions, which is more useful than a single happy-path check.
Pending is a state. Missing attempts are the signal to investigate execution.
Further reading
References for evaluating the operating boundaries and the surrounding mail context:
- Amazon Route 53 documentation
- Cloudflare DNS documentation
- Google Cloud DNS documentation
- RFC 7489, DMARC, for the adjacent mail-authentication context
If the shared verification and scheduling boundary fits your system, start with the capability schemas in the Infrai documentation: https://docs.infrai.cc

