M11-PT-001: wildlife steering stays within the intent length limit
Foundation / checks (checks) (push) Successful in 45m24s
Foundation / checks (deploy) (push) Successful in 4m8s
Foundation / checks (ecs) (push) Successful in 2m18s
Foundation / checks (network) (push) Successful in 19m39s
Foundation / checks (postgres) (push) Successful in 44m48s
Foundation / checks (tsan) (push) Successful in 11m26s
Foundation / checks (client) (push) Successful in 17m4s
Foundation / postgres-tools (push) Successful in 21s
Foundation / server-image (push) Successful in 3m10s
Foundation / image (push) Successful in 3m18s

DEV region 6 stopped at tick 7144 (stall log: append error=13 lives=10, region_step).
The wildlife controller steered toward food by scaling the larger component to 1000, so
a diagonal heading such as {1000, 800} was longer than a cellular intent may be; the
owner refused it, failing the tick, and the deterministic controller asked again every
tick. Earlier tests only had buds already touching food, so none moved.

wildlife_toward scales each component by the exact length, truncates toward zero and
pulls in any rounding excess. A regression test reproduces the refusal and accepts the
steered intent; another checks length, direction and speed over a grid of offsets.
No history changes: the refused ticks were never committed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-16 15:05:28 -04:00
co-authored by Claude Opus 5.5
parent ac1b518ddd
commit 69b13d7325
5 changed files with 78 additions and 12 deletions
@@ -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-20261016T183327-26253:1792186407"} - {name: REGION_SESSION_WINDOW, value: "dev-20261016T190528-89670:1792188328"}
- {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.
@@ -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 This explains the reproduced case only. The first report predates d98d71e, and its
cause remains unconfirmed. 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 ## Retest backlog
| Local issue | Priority / scope | Acceptance evidence | | Local issue | Priority / scope | Acceptance evidence |
@@ -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::uint64_t wildlife_wander_interval_ticks = 40; // 2 s
inline constexpr std::int16_t wildlife_full_speed = 1'000; 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 // 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, // funds one, else steer to and feed from the nearest perceived patch holding energy,
// else wander. Owned lives are left to their players. // else wander. Owned lives are left to their players.
+21 -10
View File
@@ -4,6 +4,7 @@
#include <algorithm> #include <algorithm>
#include <array> #include <array>
#include <cmath>
#include <cstdlib> #include <cstdlib>
#include <optional> #include <optional>
@@ -19,21 +20,30 @@ std::uint64_t mix(std::uint64_t life, std::uint64_t phase) noexcept {
return value; 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<std::int16_t>(dx * wildlife_full_speed / larger),
static_cast<std::int16_t>(dy * wildlife_full_speed / larger)};
}
bool overlaps(std::uint64_t start, std::uint32_t extent, std::uint32_t patch) noexcept { 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 && return start < std::uint64_t{patch} + biology::cellular_patch_pitch_um &&
start + extent > patch; start + extent > patch;
} }
} // namespace } // 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<double>(dx), static_cast<double>(dy));
auto x = static_cast<std::int64_t>(static_cast<double>(dx) * wildlife_full_speed / length);
auto y = static_cast<std::int64_t>(static_cast<double>(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<std::int16_t>(x), static_cast<std::int16_t>(y)};
}
std::expected<std::vector<CellularLifeIntent>, CellularLivesError> std::expected<std::vector<CellularLifeIntent>, CellularLivesError>
wildlife_intents(const CellularLives& state, std::uint64_t tick) { wildlife_intents(const CellularLives& state, std::uint64_t tick) {
constexpr std::array<biology::CellularIntent, 8> wander{{{1'000, 0}, constexpr std::array<biology::CellularIntent, 8> wander{{{1'000, 0},
@@ -86,7 +96,8 @@ wildlife_intents(const CellularLives& state, std::uint64_t tick) {
intent.intake_target = nearest; intent.intake_target = nearest;
if (!overlaps(life.position.x_um, extent, nearest->x_um) || if (!overlaps(life.position.x_um, extent, nearest->x_um) ||
!overlaps(life.position.y_um, extent, nearest->y_um)) !overlaps(life.position.y_um, extent, nearest->y_um))
intent.movement = toward(std::int64_t{nearest->x_um} + half_pitch - centre_x, intent.movement =
wildlife_toward(std::int64_t{nearest->x_um} + half_pitch - centre_x,
std::int64_t{nearest->y_um} + half_pitch - centre_y); std::int64_t{nearest->y_um} + half_pitch - centre_y);
} else { } else {
intent.movement = intent.movement =
+34
View File
@@ -998,6 +998,39 @@ void suspended_parent_of_a_bud_resumes() {
for (int tick = 0; tick < 20; ++tick) for (int tick = 0; tick < 20; ++tick)
CHECK(owner.advance_tick(with_wildlife({1, feed}))); CHECK(owner.advance_tick(with_wildlife({1, feed})));
CHECK(owner.current_total() == owner.opening_total()); 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 } // namespace
@@ -1012,6 +1045,7 @@ int main() {
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(); suspended_parent_of_a_bud_resumes();
wildlife_steering_stays_within_the_intent_limit();
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) {