diff --git a/apps/evo-world-clone/main.cpp b/apps/evo-world-clone/main.cpp index b985991..980684a 100644 --- a/apps/evo-world-clone/main.cpp +++ b/apps/evo-world-clone/main.cpp @@ -556,6 +556,15 @@ int finish_photosynthesis_opening(const Options& o, persistence::Postgres& db, std::uint64_t frame, const persistence::Sha256Digest& build, std::uint64_t light_pj) { const auto& key = o.source.key; + // A finished opening needs no lease: a rerun (every Argo sync's provision hook) runs + // while the region server holds it, and must report the region rather than fail. + if (const auto current = persistence::load_region_checkpoint(db, key, timeout); current) { + const auto manifest = persistence::decode_manifest(current->manifest); + if (manifest && manifest->profile == persistence::CheckpointProfile::cellular_lives_v1 && + manifest->frame == frame && + manifest->cellular_versions == persistence::cellular_v13_versions) + return 0; + } auto lease = persistence::acquire_region_lease(db, key, build, std::chrono::seconds{60}, timeout); if (!lease) { diff --git a/tests/region_store_tests.cpp b/tests/region_store_tests.cpp index ce62521..df85c5c 100644 --- a/tests/region_store_tests.cpp +++ b/tests/region_store_tests.cpp @@ -745,6 +745,11 @@ void cellular_v8_provisioning_declares_light() { auto next = CellularSessionBatchBuilder::create(*host->state(), host->committed()->head); CHECK(next && next->append(host->state()->tick() + 1, baseline, {})); CHECK(host->publish(next->batch(), next->actions(), next->mutation_actions())); + // Every Argo sync reruns the provision hook while the region server holds the lease. + const auto served = + provision_cellular(r, "9775", "cellular-v8", build, commit, "40,1,2000000,50000,20000,0,0", + code, "--motes", {"--light-pj", "40"}); + CHECK(code == 0 && has(served, "already-provisioned world=9775 region=1")); #endif }