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
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:
@@ -157,6 +157,8 @@ class CellularBridge {
|
||||
result.identity = {state.world(), state.frame()};
|
||||
result.organism_revision = tick;
|
||||
for (const auto& life : state.lives()) {
|
||||
if (life.presence == server::CellularPresence::suspended)
|
||||
continue; // Out of the world (ADR-0128).
|
||||
const auto voxel_x = life.position.x_um / 1'000'000;
|
||||
const auto voxel_y = life.position.y_um / 1'000'000;
|
||||
if (voxel_x >
|
||||
@@ -188,6 +190,8 @@ class CellularBridge {
|
||||
sessions_->replicate(tick, source);
|
||||
sessions_->clear_cellular_perceptions(tick);
|
||||
for (const auto& life : state.lives()) {
|
||||
if (life.presence == server::CellularPresence::suspended)
|
||||
continue;
|
||||
const auto perceived = state.perceive(life.identity.life);
|
||||
if (!perceived)
|
||||
continue;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -10,14 +10,15 @@
|
||||
// evo-world-clone check-store --world W --region R --pg-* ... --objects DIR
|
||||
// [--reserve-mib N]
|
||||
// evo-world-clone provision --world W --region R --opening
|
||||
// development-v1|primitive-v1|cellular-v1|cellular-v2|cellular-v3
|
||||
// development-v1|primitive-v1|cellular-v1|cellular-v2|cellular-v3|cellular-v4
|
||||
// --pg-* ... --objects DIR --build HEX [--commit HEX32] [--retain-build]
|
||||
// primitive-v1 also requires --frame N --source-id N, every --funding-*-* channel,
|
||||
// and one or more ordered --site X,Y values.
|
||||
// cellular-v1, cellular-v2 and cellular-v3 also require --width-um N --height-um N
|
||||
// cellular-v1 to cellular-v4 also require --width-um N --height-um N
|
||||
// --ambient-temperature-mk N and one or more ordered --patch X,Y,SOURCE,ENERGY,C,N,P,O values
|
||||
// plus a stable --commit HEX32. cellular-v2 is the same opening on rules 3 (ADR-0124:
|
||||
// engulfment, detritus); cellular-v3 is it on rules 4 (ADR-0125: budding wildlife).
|
||||
// engulfment, detritus); cellular-v3 is it on rules 4 (ADR-0125: budding wildlife);
|
||||
// cellular-v4 on rules 5 (ADR-0128: offline freeze and resume).
|
||||
// primitive-v1 and cellular-v1/v2/v3 accept --life-allocator-start N
|
||||
// (ADR-0123): the world's life-identity allocator is created once at the operator-audited
|
||||
// start N; a later run leaves it untouched and refuses one that is below N.
|
||||
@@ -273,7 +274,7 @@ std::optional<Options> parse(int argc, char** argv) {
|
||||
o.reserve_mib = *n;
|
||||
else if (o.command == "provision" && flag == "--opening" &&
|
||||
(value == "development-v1" || value == "primitive-v1" || value == "cellular-v1" ||
|
||||
value == "cellular-v2" || value == "cellular-v3"))
|
||||
value == "cellular-v2" || value == "cellular-v3" || value == "cellular-v4"))
|
||||
o.opening = value;
|
||||
else if (o.command == "provision" && flag == "--frame" && n)
|
||||
o.primitive_frame = n;
|
||||
@@ -347,7 +348,7 @@ std::optional<Options> parse(int argc, char** argv) {
|
||||
if (cellular_options)
|
||||
return std::nullopt;
|
||||
} else if (o.opening == "cellular-v1" || o.opening == "cellular-v2" ||
|
||||
o.opening == "cellular-v3") {
|
||||
o.opening == "cellular-v3" || o.opening == "cellular-v4") {
|
||||
const bool has_stock = std::ranges::any_of(o.cellular_patches, [](const auto& patch) {
|
||||
return patch.stock.energy.value != 0 ||
|
||||
std::ranges::any_of(patch.stock.matter,
|
||||
@@ -456,8 +457,8 @@ std::vector<std::uint8_t> probe_bytes() {
|
||||
|
||||
int provision(const Options& o) {
|
||||
const bool primitive = o.opening == "primitive-v1";
|
||||
const bool cellular =
|
||||
o.opening == "cellular-v1" || o.opening == "cellular-v2" || o.opening == "cellular-v3";
|
||||
const bool cellular = o.opening == "cellular-v1" || o.opening == "cellular-v2" ||
|
||||
o.opening == "cellular-v3" || o.opening == "cellular-v4";
|
||||
const auto primitive_frame = o.primitive_frame.value_or(0);
|
||||
if ((primitive || cellular) && primitive_frame == 0)
|
||||
return 2;
|
||||
@@ -560,7 +561,8 @@ int provision(const Options& o) {
|
||||
auto opening = server::CellularLives::create(
|
||||
*primitive_opening, std::move(*habitat),
|
||||
{{cellular_width_um, cellular_height_um}, 0, cellular_temperature_mk},
|
||||
o.opening == "cellular-v3" ? server::CellularLivesProfile::budding
|
||||
o.opening == "cellular-v4" ? server::CellularLivesProfile::presence
|
||||
: o.opening == "cellular-v3" ? server::CellularLivesProfile::budding
|
||||
: o.opening == "cellular-v2" ? server::CellularLivesProfile::engulf
|
||||
: server::CellularLivesProfile::offers);
|
||||
if (!opening) {
|
||||
|
||||
Reference in New Issue
Block a user