Files
aevolution/docs/adr/0127-cellular-permadeath-and-restart.md
T
dingo 817a830a8a
Foundation / checks (deploy) (push) Successful in 6s
Foundation / checks (ecs) (push) Successful in 2m23s
Foundation / checks (tsan) (push) Successful in 10m11s
Foundation / checks (client) (push) Failing after 14m26s
Foundation / checks (network) (push) Successful in 18m54s
Foundation / checks (checks) (push) Successful in 42m9s
Foundation / checks (postgres) (push) Successful in 43m51s
Foundation / postgres-tools (push) Skipped
Foundation / server-image (push) Skipped
Foundation / image (push) Skipped
ADR 0127
2026-10-15 09:32:51 -04:00

95 lines
4.6 KiB
Markdown

# ADR-0127: Cellular permadeath and restart
## Status
Accepted engineering contract for M11.6 (2026-10-14). Implements the absolute
permadeath requirement (PROJECT_VISION, ADR-0098) for cellular regions.
## Context
A cellular life dies by starvation or engulfment inside a replayed tick; the owner
removes it, records its death in the archive and keeps a corpse (ADR-0107,
ADR-0124). Nothing durable outside the checkpoint said the life had ended. Schema
v15 allowed one unrefused reservation per account (`one_reserved_life_per_account`),
and `primitive_life_bindings` held one published life per account, so a player
whose cell died could never start again: every new request was refused as
`existing_life`. In the M11.3 probe this showed up as players making a new account
after each death.
## Decision
### Death is terminal
- The owner never revives a life: recovery replays committed history, and a dead
identity can never appear again in a checkpoint (unique life identities, archive
death records, corpse retention).
- Corpses keep their records, and the archive keeps the organism's death; the dead
life's descendants (ADR-0125) are unaffected.
### Ending a life durably (schema v37)
- `life_reservations.ended_commit` marks a published life ended, once, by a commit
of the region that holds it. A trigger refuses changing or clearing it, or setting
it on an unpublished or refused reservation.
- `end_cellular_lives(world, region, holder, epoch, commit, identities)` is the
lease-fenced runtime call. It accepts at most 256 identities, ignores identities
that were never reserved (opening founders), treats repeats as no-ops, and refuses
a life of another region or a commit outside the region.
- The region host records endings right after the publication in which an owned
life disappeared, before the next session poll. On recovery it records every
founder corpse again, so an ending lost to a crash is restored. Failures are
retried on later steps and never block publication.
### Restart
- "One active life per account" replaces "one life per account": the unique index
becomes `one_active_life_per_account` (`rejection = 0 AND ended_commit IS NULL`),
the per-account uniqueness of published bindings is dropped, and
`reserve_primitive_life`, `primitive_life_owner` and the cellular birth publisher
consider only active lives.
- The next life is an ordinary new request: a primitive founder at a nursery site
with a new identity (ADR-0100). It inherits nothing from the dead life.
- While a life is active, a new request is still a permanent `existing_life`
refusal for that request id.
#### Birth refusal scheduling clarification (2026-10-15)
An expected nursery funding, placement, or existing-life refusal must not reject
the entire region tick. The scheduler's `append_with_birth_refusals` separates
these requests from accepted births, advances the ordinary tick, and returns
transient refusal reports. Strict `append` retains its all-or-nothing contract.
Malformed input or unexpected biological errors still reject the append.
After confirmed publication, the host removes refused requests from its spawn
queue and records the existing lease-fenced `reject_primitive_life` result. An
uncertain database answer stays unknown; a bounded transient cache withholds the
request from spawning while an exact request/query reconciles it, including after
account control takeover. After cache eviction or process recovery, the durable
reservation is checked again before any retry. No refusal is reported as final
until the store confirms it. A lost, unacknowledged report may be re-evaluated;
a durable refusal remains final for that request ID.
No nursery refill, alternate spawn rule, protocol/schema revision, simulation
version or replay format is introduced. Refused births are absent from the
committed trace; accepted births still use the existing publication transaction.
### Old sessions
- A carried action whose account has no living life, or that names a patch the life
cannot perceive, is refused on its own (`not_committed`); it no longer refuses the
whole tick for every player.
## Alternatives
- **Bind deaths inside the publication call:** rejected for now. The SQL cannot
replay the trace, so the death list would be the writer's claim either way; a
separate fenced call keeps publication unchanged and is idempotent.
- **Let any reservation start a new life:** rejected. Two concurrent lives for one
account would break control and routing.
## Consequences
Players can die and start again with the same account; history, corpses and
descendants remain. The death screen and restart flow in the client are the
maintainer's (client UI is deferred).