M11-PT-001: log why a cellular tick cannot be built
Foundation / checks (network) (push) Canceled after 0s
Foundation / checks (postgres) (push) Canceled after 0s
Foundation / checks (tsan) (push) Canceled after 0s
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 5s
Foundation / checks (client) (push) Canceled after 5s
Foundation / checks (deploy) (push) Canceled after 5s
Foundation / checks (ecs) (push) Successful in 2m26s
Foundation / checks (network) (push) Canceled after 0s
Foundation / checks (postgres) (push) Canceled after 0s
Foundation / checks (tsan) (push) Canceled after 0s
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 5s
Foundation / checks (client) (push) Canceled after 5s
Foundation / checks (deploy) (push) Canceled after 5s
Foundation / checks (ecs) (push) Successful in 2m26s
A tick whose batch the builder refuses was dropped silently and retried every 50 ms,
so a region could stop advancing with nothing in its log: after a restart DEV region 6
stayed at tick 7144 while its owner was connected. The server now prints each distinct
refusal once ("cellular tick stalled tick=N at=create|append error=E") until a tick
builds again.
Also covers a founder that buds, is suspended while its wildlife bud lives on, and
resumes on its owner's return (rules 6); that path resumes correctly.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -86,6 +86,7 @@
|
|||||||
#include <string_view>
|
#include <string_view>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@@ -928,6 +929,17 @@ int serve_cellular(Options& o) {
|
|||||||
std::optional<server::HostPhase> phase;
|
std::optional<server::HostPhase> phase;
|
||||||
std::optional<std::chrono::steady_clock::time_point> next_tick;
|
std::optional<std::chrono::steady_clock::time_point> next_tick;
|
||||||
std::vector<network::CarriedAction> awaiting_outcomes;
|
std::vector<network::CarriedAction> awaiting_outcomes;
|
||||||
|
// A tick that cannot be built is retried every 50 ms; name each distinct cause once.
|
||||||
|
std::optional<std::pair<std::string_view, server::CellularSessionBatchError>> stalled;
|
||||||
|
const auto report_stall = [&](std::string_view where, server::CellularSessionBatchError error,
|
||||||
|
std::uint64_t tick) {
|
||||||
|
if (stalled && stalled->first == where && stalled->second == error)
|
||||||
|
return;
|
||||||
|
stalled.emplace(where, error);
|
||||||
|
std::printf("cellular tick stalled tick=%llu at=%.*s error=%u\n",
|
||||||
|
static_cast<unsigned long long>(tick), static_cast<int>(where.size()),
|
||||||
|
where.data(), static_cast<unsigned>(error));
|
||||||
|
};
|
||||||
const auto set_ready = [&](bool now) {
|
const auto set_ready = [&](bool now) {
|
||||||
if (ready != now) {
|
if (ready != now) {
|
||||||
ready = now;
|
ready = now;
|
||||||
@@ -1095,6 +1107,7 @@ int serve_cellular(Options& o) {
|
|||||||
auto builder =
|
auto builder =
|
||||||
server::CellularSessionBatchBuilder::create(*state, host.committed()->head);
|
server::CellularSessionBatchBuilder::create(*state, host.committed()->head);
|
||||||
if (!builder) {
|
if (!builder) {
|
||||||
|
report_stall("create", builder.error(), tick);
|
||||||
bridge->dropped(actions, true);
|
bridge->dropped(actions, true);
|
||||||
} else {
|
} else {
|
||||||
auto appended = builder->append_with_birth_refusals(
|
auto appended = builder->append_with_birth_refusals(
|
||||||
@@ -1116,8 +1129,10 @@ int serve_cellular(Options& o) {
|
|||||||
tick, baseline, actions, held_births, host.queued_mutations());
|
tick, baseline, actions, held_births, host.queued_mutations());
|
||||||
}
|
}
|
||||||
if (!appended) {
|
if (!appended) {
|
||||||
|
report_stall("append", appended.error(), tick);
|
||||||
bridge->dropped(actions, true);
|
bridge->dropped(actions, true);
|
||||||
} else {
|
} else {
|
||||||
|
stalled.reset();
|
||||||
awaiting_outcomes.insert(awaiting_outcomes.end(), actions.begin(),
|
awaiting_outcomes.insert(awaiting_outcomes.end(), actions.begin(),
|
||||||
actions.end());
|
actions.end());
|
||||||
auto published = host.publish(builder->batch(), builder->actions(),
|
auto published = host.publish(builder->batch(), builder->actions(),
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ spec:
|
|||||||
env:
|
env:
|
||||||
- {name: REGION_SESSION, value: "dev"}
|
- {name: REGION_SESSION, value: "dev"}
|
||||||
- {name: REGION_SESSION_LISTEN, value: "0.0.0.0:7400"}
|
- {name: REGION_SESSION_LISTEN, value: "0.0.0.0:7400"}
|
||||||
- {name: REGION_SESSION_WINDOW, value: "dev-20261016T144709-39441:1792172829"}
|
- {name: REGION_SESSION_WINDOW, value: "dev-20261016T153551-32866:1792175751"}
|
||||||
- {name: REGION_M10_MAX_GRANT_LIFETIME, value: "14400"}
|
- {name: REGION_M10_MAX_GRANT_LIFETIME, value: "14400"}
|
||||||
ports:
|
ports:
|
||||||
# QUIC (ADR-0090): UDP only; nothing listens on TCP 7400.
|
# QUIC (ADR-0090): UDP only; nothing listens on TCP 7400.
|
||||||
|
|||||||
@@ -942,6 +942,63 @@ void rules_five_owner_freezes_lingers_suspends_and_resumes() {
|
|||||||
resumed.position != parked.position && !owner->last_tick_feedback()[0].resume_blocked);
|
resumed.position != parked.position && !owner->last_tick_feedback()[0].resume_blocked);
|
||||||
CHECK(owner->current_total() == owner->opening_total());
|
CHECK(owner->current_total() == owner->opening_total());
|
||||||
}
|
}
|
||||||
|
// M11-PT-001: a founder buds, its owner leaves until it is suspended while the wildlife
|
||||||
|
// bud lives on, then returns. The first unfrozen tick must resume it, not fail the tick.
|
||||||
|
void suspended_parent_of_a_bud_resumes() {
|
||||||
|
auto primitive = PrimitiveLives::create({96, 1, 7, 17, founder_price(1), {{0, 0}}});
|
||||||
|
CHECK(primitive);
|
||||||
|
LifeRequest request{};
|
||||||
|
request.account.back() = 4;
|
||||||
|
request.action = 1;
|
||||||
|
CHECK((*primitive)->spawn(request, {1, 101, 201, 301, {1}}));
|
||||||
|
constexpr std::uint64_t rich = 10'000'000'000;
|
||||||
|
auto habitat = evo::biology::CellularHabitat::create(
|
||||||
|
{96, 1, 7, 3'000, 2'000, {{{0, 0}, 29, {{rich}, {{{rich}, {rich}, {rich}, {rich}}}}}}});
|
||||||
|
CHECK(habitat);
|
||||||
|
auto created =
|
||||||
|
CellularLives::create(**primitive, std::move(*habitat), {{3'000, 2'000}, 1, 293'150},
|
||||||
|
CellularLivesProfile::balance);
|
||||||
|
CHECK(created);
|
||||||
|
auto& owner = **created;
|
||||||
|
evo::biology::CellularStepIntent feed{};
|
||||||
|
feed.intake_target = evo::biology::CellularPatchAddress{0, 0};
|
||||||
|
evo::biology::CellularStepIntent bud{};
|
||||||
|
bud.bud = true;
|
||||||
|
evo::biology::CellularStepIntent frozen{};
|
||||||
|
frozen.frozen = true;
|
||||||
|
const auto with_wildlife = [&](CellularLifeIntent mine) {
|
||||||
|
std::vector<CellularLifeIntent> intents{mine};
|
||||||
|
if (const auto wild = wildlife_intents(owner, owner.tick() + 1); wild)
|
||||||
|
for (const auto& intent : *wild)
|
||||||
|
intents.push_back(intent);
|
||||||
|
else
|
||||||
|
throw std::runtime_error{"wildlife intents"};
|
||||||
|
std::ranges::sort(intents, {}, &CellularLifeIntent::life_id);
|
||||||
|
return intents;
|
||||||
|
};
|
||||||
|
for (std::size_t round = 0; round < 400 && owner.lives().size() == 1; ++round) {
|
||||||
|
for (int tick = 0; tick < 19; ++tick)
|
||||||
|
CHECK(owner.advance_tick(std::array{CellularLifeIntent{1, feed}}));
|
||||||
|
CHECK(owner.advance_tick(std::array{CellularLifeIntent{1, bud}}));
|
||||||
|
}
|
||||||
|
CHECK(owner.lives().size() == 2);
|
||||||
|
for (std::uint64_t tick = 0; tick <= cellular_linger_ticks + 1; ++tick) {
|
||||||
|
const auto stepped = owner.advance_tick(with_wildlife({1, frozen}));
|
||||||
|
if (!stepped)
|
||||||
|
std::fprintf(stderr, "linger tick %llu error %u\n",
|
||||||
|
static_cast<unsigned long long>(tick),
|
||||||
|
static_cast<unsigned>(stepped.error()));
|
||||||
|
CHECK(stepped.has_value());
|
||||||
|
}
|
||||||
|
CHECK(owner.lives()[0].presence == CellularPresence::suspended);
|
||||||
|
const auto resumed = owner.advance_tick(with_wildlife({1, {}}));
|
||||||
|
if (!resumed)
|
||||||
|
std::fprintf(stderr, "resume error %u\n", static_cast<unsigned>(resumed.error()));
|
||||||
|
CHECK(resumed && owner.lives()[0].presence == CellularPresence::active);
|
||||||
|
for (int tick = 0; tick < 20; ++tick)
|
||||||
|
CHECK(owner.advance_tick(with_wildlife({1, feed})));
|
||||||
|
CHECK(owner.current_total() == owner.opening_total());
|
||||||
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
@@ -954,6 +1011,7 @@ int main() {
|
|||||||
rules_four_owner_buds_wildlife();
|
rules_four_owner_buds_wildlife();
|
||||||
rules_five_owner_freezes_lingers_suspends_and_resumes();
|
rules_five_owner_freezes_lingers_suspends_and_resumes();
|
||||||
rules_six_found_cheaper_cells_with_finer_mutations();
|
rules_six_found_cheaper_cells_with_finer_mutations();
|
||||||
|
suspended_parent_of_a_bud_resumes();
|
||||||
std::puts(
|
std::puts(
|
||||||
"PASS cellular lives: feeding, tick ownership, terminal closure, rules 3, budding");
|
"PASS cellular lives: feeding, tick ownership, terminal closure, rules 3, budding");
|
||||||
} catch (const std::exception& error) {
|
} catch (const std::exception& error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user