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
+33 -7
View File
@@ -1021,14 +1021,15 @@ int serve_cellular(Options& o) {
const auto* state = host.state();
bool player_present = false;
// ADR-0128: a lingering life keeps the region ticking until its linger completes.
bool lingering_present = false;
if (status.ready && state) {
for (const auto& life : state->lives()) {
network::AccountId account;
account.bytes = life.account;
if (bridge->sessions().holder(account)) {
player_present = true;
break;
}
player_present = player_present || bridge->sessions().holder(account);
lingering_present =
lingering_present || life.presence == server::CellularPresence::lingering;
}
}
// A queued birth publishes only while its account holds a session here: the
@@ -1044,7 +1045,7 @@ int serve_cellular(Options& o) {
held_births.push_back(birth);
}
const bool birth_waiting = !held_births.empty();
if (status.ready && state && (player_present || birth_waiting)) {
if (status.ready && state && (player_present || birth_waiting || lingering_present)) {
const auto now = std::chrono::steady_clock::now();
if (!next_tick)
next_tick = now + std::chrono::milliseconds{50};
@@ -1052,8 +1053,23 @@ int serve_cellular(Options& o) {
const auto tick = state->tick() + 1;
std::vector<server::CellularLifeIntent> baseline;
baseline.reserve(state->lives().size());
for (const auto& life : state->lives())
baseline.push_back({life.identity.life, {}});
// ADR-0128: an owned life whose account holds no session here is frozen
// (rules 5); the trace records the boundary, and its carried actions are
// refused below.
const bool presence_rules =
state->rules_version() >= server::cellular_lives_presence_rules;
std::vector<server::LifeAccount> offline;
for (const auto& life : state->lives()) {
server::CellularLifeIntent intent{life.identity.life, {}};
network::AccountId account;
account.bytes = life.account;
if (presence_rules && life.account != server::LifeAccount{} &&
!bridge->sessions().holder(account)) {
intent.intent.frozen = true;
offline.push_back(life.account);
}
baseline.push_back(intent);
}
std::ranges::sort(baseline, {}, &server::CellularLifeIntent::life_id);
// ADR-0125: wildlife follow the deterministic controller; its intentions
// ride the trace like a player's, and the owner validates them.
@@ -1066,6 +1082,16 @@ int serve_cellular(Options& o) {
}
}
auto actions = bridge->carry(tick);
if (!offline.empty()) {
std::vector<network::CarriedAction> departed;
std::erase_if(actions, [&](const network::CarriedAction& action) {
if (std::ranges::find(offline, action.account.bytes) == offline.end())
return false;
departed.push_back(action);
return true;
});
bridge->dropped(departed, true);
}
auto builder =
server::CellularSessionBatchBuilder::create(*state, host.committed()->head);
if (!builder) {