From 7929dea2fc8a06d5f1ab719c4371d54dc8cf4c37 Mon Sep 17 00:00:00 2001 From: dingo Date: Fri, 16 Oct 2026 11:35:51 -0400 Subject: [PATCH] M11-PT-001: log why a cellular tick cannot be built 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 --- apps/evo-server/main.cpp | 15 +++++ .../region/dev-session-route/listener.yaml | 2 +- tests/cellular_lives_tests.cpp | 58 +++++++++++++++++++ 3 files changed, 74 insertions(+), 1 deletion(-) diff --git a/apps/evo-server/main.cpp b/apps/evo-server/main.cpp index 298864f..9f4a60b 100644 --- a/apps/evo-server/main.cpp +++ b/apps/evo-server/main.cpp @@ -86,6 +86,7 @@ #include #include #include +#include #include namespace { @@ -928,6 +929,17 @@ int serve_cellular(Options& o) { std::optional phase; std::optional next_tick; std::vector awaiting_outcomes; + // A tick that cannot be built is retried every 50 ms; name each distinct cause once. + std::optional> 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(tick), static_cast(where.size()), + where.data(), static_cast(error)); + }; const auto set_ready = [&](bool now) { if (ready != now) { ready = now; @@ -1095,6 +1107,7 @@ int serve_cellular(Options& o) { auto builder = server::CellularSessionBatchBuilder::create(*state, host.committed()->head); if (!builder) { + report_stall("create", builder.error(), tick); bridge->dropped(actions, true); } else { auto appended = builder->append_with_birth_refusals( @@ -1116,8 +1129,10 @@ int serve_cellular(Options& o) { tick, baseline, actions, held_births, host.queued_mutations()); } if (!appended) { + report_stall("append", appended.error(), tick); bridge->dropped(actions, true); } else { + stalled.reset(); awaiting_outcomes.insert(awaiting_outcomes.end(), actions.begin(), actions.end()); auto published = host.publish(builder->batch(), builder->actions(), diff --git a/deploy/kubernetes/region/dev-session-route/listener.yaml b/deploy/kubernetes/region/dev-session-route/listener.yaml index 31e40d5..9bc4f31 100644 --- a/deploy/kubernetes/region/dev-session-route/listener.yaml +++ b/deploy/kubernetes/region/dev-session-route/listener.yaml @@ -12,7 +12,7 @@ spec: env: - {name: REGION_SESSION, value: "dev"} - {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"} ports: # QUIC (ADR-0090): UDP only; nothing listens on TCP 7400. diff --git a/tests/cellular_lives_tests.cpp b/tests/cellular_lives_tests.cpp index a7f6724..f3f9c39 100644 --- a/tests/cellular_lives_tests.cpp +++ b/tests/cellular_lives_tests.cpp @@ -942,6 +942,63 @@ void rules_five_owner_freezes_lingers_suspends_and_resumes() { resumed.position != parked.position && !owner->last_tick_feedback()[0].resume_blocked); 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 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(tick), + static_cast(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(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 int main() { @@ -954,6 +1011,7 @@ int main() { rules_four_owner_buds_wildlife(); rules_five_owner_freezes_lingers_suspends_and_resumes(); rules_six_found_cheaper_cells_with_finer_mutations(); + suspended_parent_of_a_bud_resumes(); std::puts( "PASS cellular lives: feeding, tick ownership, terminal closure, rules 3, budding"); } catch (const std::exception& error) {