diff --git a/deploy/kubernetes/region/dev-session-route/listener.yaml b/deploy/kubernetes/region/dev-session-route/listener.yaml index e04305c..5b1a7da 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-20261016T183327-26253:1792186407"} + - {name: REGION_SESSION_WINDOW, value: "dev-20261016T190528-89670:1792188328"} - {name: REGION_M10_MAX_GRANT_LIFETIME, value: "14400"} ports: # QUIC (ADR-0090): UDP only; nothing listens on TCP 7400. diff --git a/docs/playtests/2026-10-16_M11_9_SOLO_FEEDBACK.md b/docs/playtests/2026-10-16_M11_9_SOLO_FEEDBACK.md index 90d7edb..38b325f 100644 --- a/docs/playtests/2026-10-16_M11_9_SOLO_FEEDBACK.md +++ b/docs/playtests/2026-10-16_M11_9_SOLO_FEEDBACK.md @@ -82,6 +82,23 @@ lengths can never coincide, because 40 bytes is not a whole 48-byte patch. This explains the reproduced case only. The first report predates d98d71e, and its cause remains unconfirmed. +### Region 6 stall (2026-10-16) + +Region 6 stopped committing at tick 7144. It refused every later tick, and the +returning owner again saw "Existing cell is already bound" with no view. + +- **Evidence:** the stall log added in 44e748f printed `at=append error=13 lives=10`, + i.e. the region step refused the tick. +- **Cause:** the wildlife controller steered a bud toward food by scaling the larger + component to 1000. A diagonal intent such as `{1000, 800}` is longer than a cellular + intent may be. The owner refused it, and the deterministic controller asked again + every tick. +- **Why it slipped through:** the earlier tests only had buds that already touched + food, so they never moved. + +Steering now keeps the intent's length within the limit. A regression test reproduces +the refusal. No history changed, because the refused ticks were never committed. + ## Retest backlog | Local issue | Priority / scope | Acceptance evidence | diff --git a/include/evo/server/lifecycle/wildlife_controller.hpp b/include/evo/server/lifecycle/wildlife_controller.hpp index 36743a5..c27dd68 100644 --- a/include/evo/server/lifecycle/wildlife_controller.hpp +++ b/include/evo/server/lifecycle/wildlife_controller.hpp @@ -17,6 +17,10 @@ inline constexpr std::uint64_t wildlife_bud_interval_ticks = 20; // 1 s inline constexpr std::uint64_t wildlife_wander_interval_ticks = 40; // 2 s inline constexpr std::int16_t wildlife_full_speed = 1'000; +// Full speed toward (dx, dy): the intent's length is at most wildlife_full_speed, as a +// cellular intent requires (a longer one is refused and fails the whole tick). +[[nodiscard]] biology::CellularIntent wildlife_toward(std::int64_t dx, std::int64_t dy) noexcept; + // One intention per wildlife life (zero account), sorted by life id: bud when the reserve // funds one, else steer to and feed from the nearest perceived patch holding energy, // else wander. Owned lives are left to their players. diff --git a/src/server/lifecycle/wildlife_controller.cpp b/src/server/lifecycle/wildlife_controller.cpp index 02f25ea..d703505 100644 --- a/src/server/lifecycle/wildlife_controller.cpp +++ b/src/server/lifecycle/wildlife_controller.cpp @@ -4,6 +4,7 @@ #include #include +#include #include #include @@ -19,21 +20,30 @@ std::uint64_t mix(std::uint64_t life, std::uint64_t phase) noexcept { return value; } -// Full speed toward (dx, dy), keeping the larger component at the limit. -biology::CellularIntent toward(std::int64_t dx, std::int64_t dy) noexcept { - const auto larger = std::max(std::llabs(dx), std::llabs(dy)); - if (larger == 0) - return {}; - return {static_cast(dx * wildlife_full_speed / larger), - static_cast(dy * wildlife_full_speed / larger)}; -} - bool overlaps(std::uint64_t start, std::uint32_t extent, std::uint32_t patch) noexcept { return start < std::uint64_t{patch} + biology::cellular_patch_pitch_um && start + extent > patch; } } // namespace +// M11-PT-001: scaling the larger component to the limit made a diagonal intent longer +// than the limit; the owner refused it and every later tick of the region stalled. Each +// component is scaled by the exact length and truncated toward zero, then pulled in if +// rounding still leaves the intent a hair long. +biology::CellularIntent wildlife_toward(std::int64_t dx, std::int64_t dy) noexcept { + if (dx == 0 && dy == 0) + return {}; + const double length = std::hypot(static_cast(dx), static_cast(dy)); + auto x = static_cast(static_cast(dx) * wildlife_full_speed / length); + auto y = static_cast(static_cast(dy) * wildlife_full_speed / length); + constexpr std::int64_t limit = wildlife_full_speed; + while (x * x + y * y > limit * limit) { + auto& larger = std::llabs(x) >= std::llabs(y) ? x : y; + larger += larger > 0 ? -1 : 1; + } + return {static_cast(x), static_cast(y)}; +} + std::expected, CellularLivesError> wildlife_intents(const CellularLives& state, std::uint64_t tick) { constexpr std::array wander{{{1'000, 0}, @@ -86,8 +96,9 @@ wildlife_intents(const CellularLives& state, std::uint64_t tick) { intent.intake_target = nearest; if (!overlaps(life.position.x_um, extent, nearest->x_um) || !overlaps(life.position.y_um, extent, nearest->y_um)) - intent.movement = toward(std::int64_t{nearest->x_um} + half_pitch - centre_x, - std::int64_t{nearest->y_um} + half_pitch - centre_y); + intent.movement = + wildlife_toward(std::int64_t{nearest->x_um} + half_pitch - centre_x, + std::int64_t{nearest->y_um} + half_pitch - centre_y); } else { intent.movement = wander[mix(life.identity.life, tick / wildlife_wander_interval_ticks) % diff --git a/tests/cellular_lives_tests.cpp b/tests/cellular_lives_tests.cpp index f3f9c39..2dc527e 100644 --- a/tests/cellular_lives_tests.cpp +++ b/tests/cellular_lives_tests.cpp @@ -998,6 +998,39 @@ void suspended_parent_of_a_bud_resumes() { for (int tick = 0; tick < 20; ++tick) CHECK(owner.advance_tick(with_wildlife({1, feed}))); CHECK(owner.current_total() == owner.opening_total()); + + // M11-PT-001 (DEV region 6 stalled at tick 7144): a wildlife bud steering diagonally + // to food asked for {1000, 800}, longer than an intent may be; the owner refused it and + // so every later tick. Steering now keeps the length within the limit. + const auto bud_id = owner.lives()[1].identity.life; + evo::biology::CellularStepIntent too_long{}; + too_long.movement = {1'000, 800}; + CHECK(owner + .advance_tick( + std::array{CellularLifeIntent{1, feed}, CellularLifeIntent{bud_id, too_long}}) + .error() == CellularLivesError::region_step); + evo::biology::CellularStepIntent steered{}; + steered.movement = wildlife_toward(1'000, 800); + CHECK(owner.advance_tick( + std::array{CellularLifeIntent{1, feed}, CellularLifeIntent{bud_id, steered}})); +} +// Every steering direction is a valid intent: within the length limit, pointing at the +// target, and full speed along an axis. +void wildlife_steering_stays_within_the_intent_limit() { + constexpr std::int64_t limit = 1'000; + CHECK(wildlife_toward(0, 0) == evo::biology::CellularIntent{}); + CHECK(wildlife_toward(5'000, 0) == evo::biology::CellularIntent{1'000, 0}); + CHECK(wildlife_toward(0, -3) == evo::biology::CellularIntent{0, -1'000}); + for (const std::int64_t dx : + {-1'000'000LL, -9'000LL, -707LL, -1LL, 0LL, 1LL, 800LL, 1'000LL, 4'500LL, 1'000'000LL}) + for (const std::int64_t dy : {-1'000'000LL, -4'500LL, -800LL, -1LL, 0LL, 1LL, 707LL, + 1'000LL, 9'000LL, 1'000'000LL}) { + const auto intent = wildlife_toward(dx, dy); + const std::int64_t x = intent.x, y = intent.y; + CHECK(x * x + y * y <= limit * limit); + CHECK((dx == 0 && dy == 0) || x * x + y * y >= (limit - 2) * (limit - 2)); + CHECK((x == 0 || (x > 0) == (dx > 0)) && (y == 0 || (y > 0) == (dy > 0))); + } } } // namespace @@ -1012,6 +1045,7 @@ int main() { rules_five_owner_freezes_lingers_suspends_and_resumes(); rules_six_found_cheaper_cells_with_finer_mutations(); suspended_parent_of_a_bud_resumes(); + wildlife_steering_stays_within_the_intent_limit(); std::puts( "PASS cellular lives: feeding, tick ownership, terminal closure, rules 3, budding"); } catch (const std::exception& error) {