From 18bef06cef3383865c572d08307221b534f053e7 Mon Sep 17 00:00:00 2001 From: acamilo Date: Wed, 30 Sep 2026 23:28:44 +0000 Subject: [PATCH] infra: catch protection in the recovery ladder is 2 hours, not 6 (operator decision) --- infra/bin/fly-loop-recover | 2 +- infra/docs/loop-recovery.md | 2 +- infra/tests/test_loop_recover.py | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/infra/bin/fly-loop-recover b/infra/bin/fly-loop-recover index 0469442..a528cad 100755 --- a/infra/bin/fly-loop-recover +++ b/infra/bin/fly-loop-recover @@ -33,7 +33,7 @@ HOLD = 3 * 3600 # restart-only spacing while the reset budget is spent DAY = 24 * 3600 MAX_RESETS = 2 # milestone resets per DAY AGAIN = 12 * 3600 # after this long the last reset's archive may be restored again (row 70) -PROTECT = 6 * 3600 # a species owned this recently is not reset away (row 70) +PROTECT = 2 * 3600 # a species owned this recently is not reset away (row 70) VETO_LIMIT = 3 # model vetoes of one step before it goes ahead anyway MODEL_BUDGET = 90 # seconds across all models in one decision VERIFY_TIMEOUT = 240 diff --git a/infra/docs/loop-recovery.md b/infra/docs/loop-recovery.md index 523bf75..64788bf 100644 --- a/infra/docs/loop-recovery.md +++ b/infra/docs/loop-recovery.md @@ -23,7 +23,7 @@ a ladder one step per trap that outlives the previous step: a new rung, a species owned for the first time, a map entered for the first time, or a trainer or badge beaten. The run pays each of these once, so a ring cannot earn them twice. A trap that follows real progress is a new trap, and it starts again from a restart. -- **Protected catches:** a milestone reset never erases a species owned in the last six hours +- **Protected catches:** a milestone reset never erases a species owned in the last two hours (`PROTECT`, from `window.progress.species`). Within that window the step is a restart, spaced by the hold like a spent budget, and `history.jsonl` records a `protect` event. A reset turned into a restart this way does not climb the ladder: the level keeps its slot and the reset comes, at the diff --git a/infra/tests/test_loop_recover.py b/infra/tests/test_loop_recover.py index c61ffdd..cd072f0 100644 --- a/infra/tests/test_loop_recover.py +++ b/infra/tests/test_loop_recover.py @@ -135,7 +135,7 @@ class RecoveryTests(unittest.TestCase): self.assertEqual(self.acts, [("reset", 11)]) def test_a_species_owned_recently_is_never_reset_away(self): - owned = T0 - recover.HOLD - 600 + owned = T0 - 1200 recover.write_json(recover.STATE, {"level": 2, "bestRank": 12, "resets": [], "actedAt": T0 - recover.HOLD - 300, "speciesAt": owned}) self.assertIn("flysim restarted", self.confirm(T0)) @@ -411,9 +411,9 @@ class ClosedLoopTests(unittest.TestCase): self.assertTrue(len(resets) >= 3, acts) gaps = [b[0] - a[0] for a, b in zip(resets, resets[1:])] self.assertTrue(all(g <= 25 for g in gaps), acts) - # the first step is a restart; the catch stays protected for 6 h + # the first step is a restart; the catch stays protected for 2 h self.assertEqual(acts[0][1], "restart") - self.assertTrue(all(a[0] >= 6 - 0.2 for a in resets[:1]), acts) + self.assertTrue(all(a[0] >= 2 - 0.2 for a in resets[:1]), acts) def test_the_held_reset_is_the_rung_12_one_not_a_deeper_rung(self): acts = self.simulate({11: self.R11, 12: self.R12, 10: self.R10, 9: self.R10}, 24, species_before=6) @@ -423,7 +423,7 @@ class ClosedLoopTests(unittest.TestCase): clean = dict(self.R12, trap=None) acts = self.simulate({11: self.R11, 12: clean, 10: self.R10, 9: self.R10}, 24, species_before=6) self.assertEqual([a[1:] for a in acts if a[1] == "reset"], [("reset", 12)], acts) - self.assertEqual(len(acts), 3, acts) + self.assertEqual(len(acts), 2, acts) def test_without_a_catch_the_ladder_resets_early(self): acts = self.simulate({11: self.R11, 12: self.R12, 10: self.R10, 9: self.R10}, 24) @@ -437,7 +437,7 @@ class ClosedLoopTests(unittest.TestCase): acts = self.simulate({11: clean11, 12: late12, 10: self.R10, 9: self.R10}, 96) resets = [a for a in acts if a[1] == "reset"] self.assertEqual([a[2] for a in resets], [12, 11], acts) - self.assertLessEqual(resets[-1][0], 8, acts) + self.assertLessEqual(resets[-1][0], 7, acts) # 6.83 h with the 2 h protection (was 2.08 h in v0.7.0) self.assertLess([a[2] for a in resets].count(12), 2, acts)