Freeze offline cells, linger, suspend and resume them
Foundation / checks (ecs) (push) Successful in 2m15s
Foundation / checks (deploy) (push) Successful in 3m53s
Foundation / checks (tsan) (push) Successful in 9m46s
Foundation / checks (client) (push) Failing after 13m47s
Foundation / checks (network) (push) Successful in 19m5s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (checks) (push) Canceled after 19m34s
Foundation / checks (postgres) (push) Canceled after 19m28s

M11.7 (ADR-0128): a frozen step intent, set by the server for every owned life
whose account holds no session, leaves the cell unchanged but engulfable. Owner
format 6 / rules 5 track presence: lingering for 200 ticks, then suspended out of
the world without aging; an unfrozen intent resumes it in place or at the nearest
clear spot within three extents. Bundle v6, schema v38 and the cellular-v4
opening carry it. The server refuses an offline account's carried actions, ticks
while anyone lingers, and skips suspended cells in replication and perception.

Also fixes the TSan failure of CI run 374: the rules-4 owner test read the bud
through a reference into a replaced state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-14 07:50:45 -04:00
co-authored by Claude Opus 5.5
parent e71147f7a6
commit e74bdf286b
25 changed files with 741 additions and 69 deletions
@@ -26,7 +26,19 @@ inline constexpr std::uint32_t cellular_lives_engulf_rules = 3;
// life; rules 4 add funded budding of unowned wildlife on top of rules 3.
inline constexpr std::uint32_t cellular_lives_bud_format = 5;
inline constexpr std::uint32_t cellular_lives_bud_rules = 4;
// A bud's life, organism and event identity: 2^63 + region * 2^32 + sequence. A rules-4
// ADR-0128: format 6 adds each life's presence and freeze tick; rules 5 are rules 4 plus
// the offline freeze, linger, suspension and resume.
inline constexpr std::uint32_t cellular_lives_presence_format = 6;
inline constexpr std::uint32_t cellular_lives_presence_rules = 5;
// Trial values (ADR-0128): ticks a frozen life lingers in the world (10 s at 50 ms), and
// how many of its own extents away a resume may look for a clear spot.
inline constexpr std::uint64_t cellular_linger_ticks = 200;
inline constexpr std::uint32_t cellular_resume_extents = 3;
enum class CellularPresence : std::uint8_t {
active,
lingering,
suspended
}; // A bud's life, organism and event identity: 2^63 + region * 2^32 + sequence. A rules-4
// owner refuses an allocated identity at or above 2^63, so the namespaces never meet.
inline constexpr std::uint64_t cellular_bud_namespace = std::uint64_t{1} << 63U;
inline constexpr std::uint64_t cellular_bud_max_region = (std::uint64_t{1} << 31U) - 1;
@@ -60,6 +72,9 @@ struct CellularOwnedLife {
accounting::Inventory reserve{};
CellularMutationProgress mutation{};
std::uint64_t parent_life{}; // Format 5: the budding parent; zero for a founder.
// Format 6 (ADR-0128): presence and the tick its freeze began (zero while active).
CellularPresence presence{CellularPresence::active};
std::uint64_t frozen_since{};
auto operator<=>(const CellularOwnedLife&) const = default;
};
struct CellularOwnedCorpse {
@@ -119,12 +134,15 @@ struct CellularLifeTickFeedback {
std::uint64_t prey_life{};
std::optional<CellularBudResult> bud; // Rules 4, when this life asked to bud.
std::uint64_t bud_life{};
// Rules 5: presence after the tick, and whether a requested resume found no clear spot.
CellularPresence presence{CellularPresence::active};
bool resume_blocked{};
auto operator<=>(const CellularLifeTickFeedback&) const = default;
};
// Which owner version a new region starts on. Offers: format 2, rules 2 (the M11.3/11.4
// trial, upgraded by the no-tick migrations). Engulf: format 4, rules 3 (ADR-0124).
// Budding: format 5, rules 4 (ADR-0125).
enum class CellularLivesProfile : std::uint8_t { offers, engulf, budding };
// Budding: format 5, rules 4 (ADR-0125). Presence: format 6, rules 5 (ADR-0128).
enum class CellularLivesProfile : std::uint8_t { offers, engulf, budding, presence };
struct CellularLivesConfig {
biology::CellularArea area{};
std::uint64_t tick{};