MAINT-24: keep the refusal probe beside a maintenance charge
checks / unit (pull_request) Failing after 45m44s
infra-pin / fresh (pull_request) Successful in 2s

The mode trade still lets a SAFETY-73 probe (PROBE_W alone) go on while a pack
is in its maintenance CHARGE phase; test_opt20.py g7 pins it. ch_ch_maint
digest moved (B no longer grid-charges beside A's charge).

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
glenn schrooyen
2026-11-12 07:33:04 +01:00
co-authored by Claude
parent 54a738dd87
commit 0f5e513f1d
4 changed files with 28 additions and 7 deletions
+7 -2
View File
@@ -199,7 +199,8 @@ def decide(runs, now, packs, *, charge_ok, sell_ok, trade_why, price_now,
charge from the grid (why "cycle"). `wait` ("wait" or "settle", the
why) says no charge may start yet (SAFETY-135). `maint_charging` says a
battery is in its maintenance CHARGE phase: no grid charge for the others
either, same why (MAINT-24, DECISIONS/MAINT-24-charge-first.md).
either, same why, but a refusal probe goes on (MAINT-24,
DECISIONS/MAINT-24-charge-first.md).
"""
plan_on = runs is not None and runs.on
in_cheap = plan_on and runs.cheap.holds(now) and runs.charge_useful()
@@ -209,8 +210,12 @@ def decide(runs, now, packs, *, charge_ok, sell_ok, trade_why, price_now,
why = None
ch = chargers(packs, ceiling_pct, done_charge, targets, probe=True) \
if in_cheap else []
if ch and (draining or maint_charging):
if ch and draining:
ch, why = [], "cycle"
elif ch and maint_charging:
# MAINT-24: a refusal probe (PROBE_W alone, OPT-20) may go on.
ch = [p for p in ch if p.refused < 0]
why = None if ch else "cycle"
charging = False
if ch:
need = 0.0 if charging_now else START_W