Approval Path floods the error log for sites that no longer exist

Description

Background

When an Atlassian Cloud site is deleted, renamed or lets its trial expire, Atlassian does not notify us: there is no uninstall event for a whole site disappearing. Our installation record therefore survives in our database and every later attempt to reach that site fails permanently. Our apps detect the situation reliably (the site's public identity endpoint answers "not found"), but most code paths treated it as an unexpected internal failure rather than the expected, permanent condition it is.

Who is affected

Support, on-call and engineering directly; customers indirectly through slower incident response.

What happened

Background jobs kept processing the orphaned installation record. The expiration job runs every minute, the reminder job every five minutes. Each attempt failed identically and was recorded as an error with a full stack trace: about 1700 error entries per day per removed site, indefinitely. Anyone who reached the app for such a site got a generic error page with a random code instead of "this site is no longer available".

Business impact

  • Alert fatigue: the noise competes with real incidents in the same log and in alerting, so genuine failures take longer to spot.

  • Support and engineering cost: each occurrence looks like an application fault.

  • Wasted compute: work that can never succeed was retried every minute.

What done looks like

  • A removed site produces a single informational line naming the product and the site, with no stack trace, at most once per job run, and the job continues with the remaining sites.

  • No code path classifies this condition as an error or a warning.

  • Users and API clients get an explicit "site not available" response instead of a generic failure.

  • Notifications that fail for this reason are not retried.

Change

  • A site that does not answer at its stored URL is logged once a day per job and host, as one INFO line "Site does not answer at its stored URL (removed or renamed): ..." naming the job, product, site and host, with no stack trace. The job carries on with the other sites. This covers the expiration job, the automatic reminder job (which now stops that site's sweep after the first failure), the custom field push, the pending approver reconciliation and queued issue update webhooks (not retried).

  • No code path logs a removed site as ERROR or WARN: those jobs, notification preparation and delivery, the Web API, Slack buttons, step-action links from emails and the global error page.

  • Users who open a link outside the product (email decision links, the approval page outside Jira and Confluence) see "This site is no longer available." (HTTP 410) instead of the generic error page with a code. Web API clients get 410 with the same message. Email decision links and Slack buttons answer that the decision cannot be recorded because the site is no longer available.

  • Notifications that fail for this reason are marked failed without retry, without fallback delivery and without an instance error.

  • The existing helper MissingTenantInfoException.isCausedBy (forge-remote) recognises the condition, including when wrapped by asynchronous execution. No shared library, schema or manifest changes.

Decisions

  • INFO once a day per host per job instead of once per run (about 3 lines a day per removed site instead of about 1700).

  • HTTP 410 Gone for the Web API and pages, so a removed site is not confused with "approval not found" (404).

  • Hosts are not disabled automatically: a renamed site also answers "not found" at its old address while the installation is alive, which is why the log line says "removed or renamed". Forge installations are already uninstalled 7 days after their system token stops refreshing.

  • Requests coming from inside a live Jira or Confluence (app loading, signed in-app requests) keep the generic error message: there the condition means the stored site URL is out of date (renamed site), so the app logs a WARN once a day naming the stored and the live URL, and nothing per request. Keeping a renamed site working (cloud id from the client key, refreshing the stored URL) is AP-2547.

Fixes included

  1. Host migrations after an app upgrade ran with the old site URL instead of the URL from the upgrade event.

  2. A removed site was read as "approval not found" or "user does not exist on this site" by Web API decisions and permission checks.

  3. The custom field push warned on every retry and evicted the cached field ids for a removed site.

Not covered: the stuck AI prompt step cleanup (every 5 minutes) still logs a WARN for a stuck prompt step on a removed site.

Manual tester notes

A removed site cannot be reproduced on QA, so these are regression checks only.

  • Open Approval Path on a Jira work item and in the app settings: both load normally.

  • Start an approval with an email approver step and approve from the link in the email: the decision is recorded and the confirmation page shows.

  • Approve from the Approve button on a Slack approval message: the decision is recorded and Slack shows the confirmation.

  • Submit a decision through the Web API with an API key: the decision is recorded.

  • Start an approval and check that the approver notification arrives (Jira notification or email), and that an automatic reminder still arrives when reminders are enabled.

  • Edit a field of a Jira work item that has an approval with a dynamic step: the step updates as before.

Before release

  • After deploy, check the production logs: the errors "Failed to process expirations for host" and "Failed to process reminders for host" for removed sites are replaced by daily INFO lines "Site does not answer at its stored URL (removed or renamed): ... skipped Jira site ...".

  • Any WARN from StaleSiteUrls points to a renamed site whose stored URL is out of date (see AP-2547).