# How long an application lives: its kind, its end or review date, the planned steps, notices and renewal

> Every application of an organization is created as one of the kinds its policy defines (`apps.kinds`): a kind that ends gets an end date, a reviewed kind gets a review date. Setting either plans the application's steps from the policy's `apps.endSteps` — notices 30, 7 and 1 days before the end, then its retirement — and an hourly sweep sends each notice once to the application's responsible owner and deputy; from the first notice the application's own users see a one-line notice in it with the day it ends. Renewing cancels the remaining steps and plans the new end's. At its end the sweep retires it: every address answers the retired page (status 410, and one stable `APPLICATION_RETIRED` error for REST and MCP), its data and backups are kept, and its Owner can bring it back within the policy's retired days.

<!-- id: project-app-lifecycle · area: project · stability: preview · html: https://osysharp.com/reference/project/app-lifecycle/ -->

## Summary        {#summary}
An application of an organization lives as long as its kind says. The organization's policy names its kinds
(`apps.kinds`); with no rule the starter kinds apply:

```text syntax
campaign: Campaign, ends 90/365; project: Project, ends 365/730; product: Product, reviewed 365
```

A **Campaign** ends 90 days after it is created unless you give another end, and never more than 365 days after. A
**Product** never ends without a person deciding: it gets a review date a year out, and is asked about then. The
default kind (when you name none) is the first reviewed kind, else the first.

Setting an end or a review date **plans the application's steps**, recorded on it: what happens, when, and who
decided it. Renewing re-plans them.

## Description    {#description}

### Who may do what   {#who}
| | who | never |
|---|---|---|
| create an application as a kind, with an end within what the kind allows | whoever manages applications in the organization | — |
| renew it (one click: the kind's default lifetime again, never past its most) or move its end within the most | the application's Owner, or an Owner or Admin of its organization | an app Admin or Developer; a machine |
| let it live past its kind's most (an exception, recorded on the application with its reason) | an Owner or Admin of its organization, or a platform operator | the application's Owner; a machine |
| write a planned step — make, change, cancel or mark one done | the platform only (the planner and the sweep), or a platform operator | any person, any machine |
| retire an application | the platform only (the sweep, at its end) | any person, any machine |
| bring a retired application back, with a reason, within its window | the application's Owner, an Owner or Admin of its organization, or a platform operator | an app Admin or Developer; a machine |

People change the **end**; the plan follows. Reading the plan is reading the application: its team and the people who
manage applications in its organization see it.

### What is planned   {#planned}
From the organization's `apps.endSteps` (starter: `notices 30/7/1; read-only 0; retired 30`):

| the application | its steps |
|---|---|
| ends (an end date is set) | a **notice** at 09:00 UTC for each notice day before the end; a **read-only** step when the rule has read-only days; its **retirement** on the end date |
| is reviewed (a review date is set) | one **review notice** at 09:00 UTC on the review date: still needed? renew it, or set an end |

A notice day already past when the plan is made (an end set 20 days out, with a 30-day notice) becomes **one** notice,
sent at once — everyone hears at least once — beside the notices still ahead.

The plan is made whenever an end or a review date is set: at creation (by every door — Admin's console, `osyrin app
create`, `osy compile` of a new application on a single server, an import), on renewal, and when an exception is
granted. If an end is changed some other way, the hourly sweep finds that the plan no longer matches and re-plans it,
and it only ever runs a step planned for the end (or review date) the application has now — so a notice about an old
end is never sent, however many plans wait. The platform's own applications and the release canaries are never
planned: marking an application a canary, or deleting it, cancels its open steps, and the sweep runs no step of either.

### The notices   {#notices}
Each notice goes to the application's **responsible owner** and its **deputy**, each once, by email — and to the
organization's own notification channels — under its **Application lifecycle** notice settings: an organization that
chose that nobody receives them gets none. A notice says when the application ends, what happens then (it is due to be
retired; its data is kept for the policy's retired days), and links its page in Admin and its Backups page, where a copy
of its data can be downloaded.

Each step a pass runs is saved as soon as it is done, so a pass that stops halfway keeps who was emailed, and runs
again sending nobody anything twice: each recipient is recorded as emailed, and the send carries an idempotency key.
When one recipient's mail fails, the next pass emails that one only. A notice with nobody to email (the organization
chose nobody, or the application has no responsible owner or deputy with an address) is done at once, and says so.

### What the application's users see   {#users-see}
The platform does not hold the addresses of an application's own users, so it tells them in the application itself.
From the due time of the application's **first notice** (the 30-day one under the starter steps; the one sent at
once when the end is closer than that) until its end, every page of the application shows one quiet line above
its content:

```text syntax
This application ends on 22 Nov 2026.
```

From the end on, while it is still served, the line reads `This application ended on 22 Nov 2026.` — also when no
notice came before it (a policy with no notice days, an end set for today). Nobody writes
anything for this, and the application's code does not take part: the platform's page shell draws it, on a zone and
on a single server alike.

| the application | its users see |
|---|---|
| ends, before its first notice | nothing |
| ends, from its first notice to its end | *This application ends on …* |
| past its end, until the sweep retires it (within the hour) | *This application ended on …* |
| retired | the retired page instead of the application ([below](#retired)) |
| renewed, so its new first notice is still ahead | nothing again, until that notice |
| is reviewed (no end), or is never planned (the platform's own, a canary) before its end | nothing |

The line names **only the day**: no person, organization, kind or reason, and it links nowhere — anyone who can open
the application's pages sees it, an anonymous visitor of a public application included. It sits above the
application in the page's flow, so it moves the application's content down by its own height and covers none of it
— except a header the application pins to the window itself (`position: fixed` at the top), which is drawn over
whatever is first in the page, the line included. Its **OK** hides it until the browser tab is closed; once the end
has passed it is shown again.

The line follows the plan, not the end: when an end is changed without a re-plan (a direct write of the date), the
line keeps the old first notice's time until the hourly sweep re-plans it, within the hour.

### When a step fails   {#failures}
A step that cannot be done — the mail provider refuses a recipient — is tried again on each of the next three passes.
After the fourth it is marked **failed**: the platform's operators get an alert (*An application's planned lifecycle
step failed*), the responsible owner is told, and **no later step of that plan runs** until the application is
re-planned (renew it, or change its end).

When the organization's `apps.endSteps` in force cannot be read, an application whose plan no longer matches its dates
is not re-planned on the starter values: it waits, and its old steps are not run. Each pass counts one attempt on the
step it would run next (failed after the fourth, as above, and the responsible owner told), the operators get one
alert for the organization, and the waiting applications go behind the others, so they never hold up a plan that can
be made.

### Retired   {#retired}
At its end the hourly sweep runs the application's retirement. From that pass on:

- **It is not served.** Every address of every environment — its own host, `{slug}--{environment}`, a custom domain —
  answers instead with the **retired page**, status **410**, on every node and zone alike (a zone learns it from its
  snapshot). The application's code does not run.
- **Nothing runs for it.** On a zone, its environments get **no runtime**: the zone's agent is handed none of them, so
  a runtime that served only this application is drained and removed, and the zone's **gateway** answers its addresses
  itself — the same page, the same error body, the same redirects — with nothing behind it. Brought back, its runtime
  starts again from cold (seconds to a minute); a request meanwhile is held and then answered with the usual
  "starting up" 503 and a `Retry-After`.
- **REST, MCP and every other API call** get the same status and one stable body, the error shape every endpoint
  answers with:

  ```json title="any API call to a retired application" syntax
  { "error": { "code": "APPLICATION_RETIRED", "message": "Spring sale is no longer available. It closed on 22 Nov 2026.",
    "retiredOn": "2026-11-22", "contact": "Ask the Acme service desk" } }
  ```

  `contact` is there only when the organization wrote a contact line.
- **Its background work waits.** Its schedules, workflow starts, timers and other background tasks do not run while it
  is retired — on a zone the task dispatcher keeps them queued itself, no attempt spent, since there is no runtime to
  deliver them to — and none is lost: brought back, a schedule that came due meanwhile runs **once** — the occurrences it
  slept through are counted on its occurrence log (`ScheduleOccurrenceRecord.CoalescedCount`), as after any outage —
  a timer due meanwhile fires, and a start waiting starts, within a quarter of an hour. A zone runtime that has just
  started and has no snapshot from its agent yet cannot tell which applications are retired, so it runs no
  application's background work either until the snapshot comes; those tasks are asked again within half a minute.
- **A backup is taken** as it is retired, kept for as long as it can be brought back — so the window has a fresh copy
  whatever the plan's own backups do meanwhile.
- **Its owners and team are told, once**: its responsible owner, its deputy and everyone on its team get one notice
  that says it was retired, when and why, and how to bring it back, and until when (unless the organization chose
  that nobody hears Application lifecycle notices).
- **It is not deployed to, and no platform release moves it.** A deploy or a platform-release move asked for it is
  refused, whoever asks, saying it is retired and to bring it back first. The platform's own rollouts leave it out too:
  a patch or minor release is not followed for it, a grace window of a release waits — no reminder, no forced move at
  its deadline, never taken offline for it — and a canary, a rehearsal or a preview passes it by. Brought back, the
  next hourly release sweep moves it like any other application: a patch at once, a window whose deadline passed
  meanwhile by its forced move.
  Its deploy tokens cover nothing while it is retired — they are not revoked, so the same token works again once it
  is brought back.
- **Its data is kept, untouched.** Its databases, its environments and its backups stay as they are, and the backups go
  on by their schedule, until the application is deleted. A certificate's renewal challenge still passes, and its custom domains do what was chosen for them (below, *Its custom domains after the end*).
- **It holds no app slot** of its organization.
- **The record says who decided and why**: the retirement is kept on the application with the person who set the end
  (or the policy), the end it retired at, and how long it is kept.

The retired page is plain and speaks to a visitor: **This site is closed.** over one line, *Spring sale is no longer
available. It closed on 22 Nov 2026.* — the application's **name** and the day it **closed** — then the organization's **contact line**
— the words its Owner wrote under *Contact line for retired applications* on the organization's settings, shown as
written, and nothing when it wrote none (it never names a person unless the organization put one there) — and, for
the people who work on it, a link to its page in Admin to ask for it back. It names no owner, reason or kind. It
follows the browser's light or dark setting and fits a phone.

### Bringing it back   {#bring-back}
While the policy keeps it (`retired N` days of `apps.endSteps`; 30 under the starter steps), the application's
**Owner**, an **Owner or Admin of its organization**, or a platform operator brings it back — with **Bring back…** on
its page in Admin, or `BringBackApplication(applicationId, reason)` — never an app Admin or Developer, never a machine.
The reason is kept with its retirement. It needs a free app slot, as creating an application does: the organization's
applications are counted whoever asks, including the ones the person bringing it back cannot see. It is served again at once, on the
version it had, and its steps are planned again:

| when it comes back | its new end |
|---|---|
| an end still ahead (an exception was granted while it was retired) | that end |
| a kind that ends | the kind's default lifetime from today, never past the latest its kind allowed |
| already at the latest its kind allowed | refused: an Owner or Admin of the organization grants an exception first (`GrantLifetimeException`), then it can come back |
| a reviewed application | reviewed again from today |

After the window it cannot be brought back this way; ask a platform operator.

### Going live at a date   {#go-live}
A campaign set up in advance opens at its **go-live** (`SetApplicationGoLive(applicationId, goLiveAt)`, to the minute, UTC;
its Owner, an Owner or Admin of its organization, or an operator — never an app Admin or Developer, never a machine).
Until that minute:

- **Every address answers a visitor with the coming-soon page**: status **503** with `Retry-After` counting down to
  the go-live, never indexed, naming the application and when it opens. An API call gets one stable body,
  `{"error": {"code": "APPLICATION_NOT_LIVE", "message": "…", "goLiveAt": "2027-06-01T09:00:00Z"}}`.
- **Its team sees the application.** A person on its team (an active member of any role), a manager of its
  organization's applications, or an operator asks for a **team pass** (`OpenAppBeforeGoLive(applicationId)`): a
  link to `/.osyrin/team-pass#…` on the application's address. The pass is in the link's **fragment**, which a browser
  never sends to a server, so it is in no request line, proxy or access log. That path answers a small page (never
  stored or indexed; it needs JavaScript) that reads the pass, clears it from the address bar, sends it to the same
  address in a same-origin `POST`, and opens `/`. An accepted pass is kept in an HttpOnly cookie on that one address
  until the go-live: `__Host-osyrin-team-pass` over https (Secure, `Path=/`, no `Domain`), `osyrin-team-pass` on
  plain http in local development. A pass in a query string is never accepted, and a cross-site `POST` is refused.
  The pass lets its holder see the application and nothing else — it signs nobody in. Only its SHA-256 is stored
  and sent to the zone.
- **A pass works only while its holder is on the team**, by the same rule that let them take it. When they are
  removed from the application, leave the organization or lose the right to manage its applications, a zone refuses
  the pass from its next snapshot and a single node from the next request. **Moving or clearing the go-live**
  (`SetApplicationGoLive`) cancels every team pass of the application: the team asks for new ones.
- **One live pass per person.** Taking a new pass replaces the person's earlier pass for that application, so an
  older link stops working once a newer one is taken. Two requests for a pass at the same moment leave one: the
  second is refused with "You were just given a pass for this application: open it again to get a new one."
- **Its certificate is issued as usual**: a renewal or issuing challenge passes.

In Admin, the application's page has a **Lifetime** panel: its kind, its end (or review) and its go-live. Whoever may set the
go-live sees **Set go-live…** (a day and a time, UTC), **Move go-live…** and **Clear go-live…** (which asks first: the application
opens to everyone at once); a person on its team sees **Open before go-live**, which shows the team-pass link once, to copy. Each
control is offered only to whoever its function lets through, and a refusal is shown in the dialog that asked.

At the go-live minute everyone gets it: every runtime compares its own clock with the go-live, so it opens on the
minute, not on the next sweep. The hourly sweep then runs the **Go live** step (recorded in its plan beside the
end's steps) and lets the team passes go. Renewing or changing the end leaves the go-live planned; clearing the
go-live (`null`) opens it now.

### Its custom domains after the end   {#domains}
Each of an application's custom domains does one of three things once the application ends, chosen per domain at
setup or any time before the end (`SetDomainAfterEnd(domainId, afterEnd, redirectUrl, permanent, handOverToPlacementId)`,
by whoever manages the domain), and shown beside the domain on the application's **Domains** tab (its *After the end* column). Its
managers change it with **After the end…** in the domain's detail, while the application has not ended: a dialog that chooses the
retired page, a redirect (the address, and *Permanent (301)* or not: 302) or a hand-over, offering only the environments the
function accepts. A reader who may not see the application it is handed over to reads *Handed over to another application*.

| after the end | what the name does |
|---|---|
| **Retired page** (the default) | answers the retired page, like every other address of the application |
| **Redirect** | answers **301** (or **302**) to the one URL the organization set — exactly that URL: nothing of the request (path, query) is added. An absolute `https://` or `http://` address, with no user name or password, and not the name itself |
| **Hand over** | moves, at the end, to an environment of **another application of the same organization in the same zone** (the person choosing manages both) — in the commit that retires the first, still verified and with the same certificate, so the name is never unserved |

A hand-over whose target is gone, has ended, or is served in another zone by the end keeps the name on the retired
application (the retired page) and says why in the domain's story. Once the application has ended, the choice is no
longer changed.

**Certificates keep renewing** while the application is retired and while a name redirects: its names stay in its
zone's snapshot (answered by the zone's gateway, which renews what it answers) and on the platform's front door.

**After the application is deleted**, a name keeps answering what was chosen for it — the retired page or the redirect
— for as long as the organization keeps it on the platform. That is every name that was **verified** and chose the
retired page or a redirect, of an application that had **ended** (it was retired when it was deleted). The name is
released (another application may add it, except under a domain the organization verified — below), and the zone that
served it goes on answering it, its certificate kept and renewed, until the first of:

| what ends it | how |
|---|---|
| the organization **lets it go** | `LetGoOfReleasedDomain(releasedId)` — by someone who manages the organization's applications, or a platform operator; nobody else sees the name. The zone stops answering it on its next snapshot and its certificate is removed by the platform's certificate sweep |
| a domain of that name **verifies** again | an application of the organization (or, outside a verified domain, of anyone) proves the name: it is that application's now. A live name is always served before a kept one |
| the application is **restored** | its names are added back (unverified), as for any restore |
| the organization is **deleted** | an organization's deletion ends every name it kept, including names of applications it deleted earlier. Nothing of a deleted organization is answered, and its certificates are removed |

While the organization is **suspended**, its kept names are not answered either. They come back when an operator
resumes it. Their certificates are kept meanwhile, as a suspended application's are.

An application deleted while it was still served, and every application of an organization that is deleted, release
their names whole: nothing answers them after.

**No takeover.** A name under a domain an organization verified by DNS (its sign-in domains, `OrgVerifiedDomain`)
can only ever be attached by that organization — while an application holds it, and after that application is
deleted and the name released. Such a name needs no TXT record of its own: the organization's verification proves
it, and the record pointing the name at the platform is still needed.

### What is not run yet   {#not-yet}
The read-only step waits for the runtime to refuse writes: it is planned and recorded on the application, and the
sweep does not run it. Deleting a retired application after its window is a later step: until then a retired
application is kept, whatever its window says. A deleted application's kept names are let go with the function above;
no page lists them yet.

### Renewing and exceptions   {#renew}
`RenewApplication` (the application's page in Admin) gives a kind that ends its default lifetime again from its end
(or from today, when that has passed), never past the latest end its kind allowed when it was created; a reviewed
application is reviewed again from today. At the most, renewing is refused and says that an Owner or Admin of the
organization can grant an exception (`GrantLifetimeException`). Either one cancels the open steps and plans the new
end's; a notice already sent stays sent.

A rule in force that cannot be read refuses a creation, a renewal and an exception, naming the key, and never falls
back to the starter values.

## See also       {#see-also}
- [Your organization's policy: what each kind of rule affects, what its refusal says, and how to ask](https://osysharp.com/reference/project/organization-policy/) — `apps.kinds` and `apps.endSteps`, with every other rule an organization can set
