From 53ddbc0f609de783d3e69214d11a73dea2afded8 Mon Sep 17 00:00:00 2001 From: alexpolo1 Date: Thu, 3 Sep 2026 21:49:55 +0200 Subject: [PATCH] fix(baal_xp): keep the leech cycling when a profile [routes] section exists Two config-layer gaps stopped the leech from ever completing a cycle: - _do_runs built 'run_baal_xp' from routes.get('run_baal_xp'), which raised KeyError when the key was absent (a profile-level [routes] section that lists only its own runs, e.g. paladalla's run_pindle/run_trav/run_diablo, does not define it). The exception escaped the Bot constructor and took the whole bot down at startup. Now .get(key, False). - _baal_xp_rearm only re-set the _do_runs flag. on_maintenance re-reads Config().routes for its 'any run left?' check, so the leech fell through to end_game after every cycle and the controller created a brand new game purely to leave it again. Re-arm Config().routes too. The matching run_baal_xp=1 entry (deliberately NOT in order= - the leech is self-contained and must not sit between real runs) goes in the gitignored profile ini. Co-Authored-By: Claude Opus 5 --- src/bot.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/bot.py b/src/bot.py index c51f300..9aea698 100644 --- a/src/bot.py +++ b/src/bot.py @@ -123,7 +123,7 @@ class Bot: self._do_runs = { "run_level": Config().routes.get("run_level"), "run_cold_plains": Config().routes.get("run_cold_plains"), - "run_baal_xp": Config().routes.get("run_baal_xp") and Config().baal_xp.get("enabled", False), + "run_baal_xp": Config().routes.get("run_baal_xp", False) and Config().baal_xp.get("enabled", False), "run_trav": Config().routes.get("run_trav"), "run_pindle": Config().routes.get("run_pindle"), "run_shenk": Config().routes.get("run_eldritch") or Config().routes.get("run_eldritch_shenk"), @@ -1266,6 +1266,11 @@ class Bot: self._baal_xp_fails = 0 return self._do_runs["run_baal_xp"] = True + # Re-arm the route in the config layer too: on_maintenance re-reads + # Config().routes for its "any run left?" check, and a profile-level + # [routes] section that lacks run_baal_xp would otherwise read False + # there and send the bot to end_game instead of the next leech cycle. + Config().routes["run_baal_xp"] = True def _baal_xp_only(self) -> bool: """True when baal_xp is the only route configured."""