Skip to content

fix(mpc): drop the fuse-saturation replan; Core replans name their cause - #1824

Merged
frahlg merged 3 commits into
masterfrom
fix/fuse-replan-reason
Oct 25, 2026
Merged

frahlg merged 3 commits into
masterfrom
fix/fuse-replan-reason

Conversation

@frahlg

@frahlg frahlg commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

Update: the fuse-saturation replan is removed (3e5856c)

Fredrik decided (25 Oct 2026) to remove the trigger rather than rename it. While the car wants more than the fuse allows, the rising edge fired again after each 60 s cooldown, about six times an hour on a charging night. The new plan cannot end the overage, which live dispatch already holds, so the replan protected nothing. The block in go/cmd/ftw/main.go and its state (prevFuseSaturated, lastFuseReplan, fuseReplanCooldown) are gone; ctrl.FuseSaturated still feeds the feedback it fed before. The startup replan keeps startup, and "manual" now means only the Replan button. The changeset says so.

Problem

On 25 Oct 2026 the home box (v0.155.1-beta.1) logged three replans with reason=manual, at 02:35:08, 02:36:20 and 02:37:23 CET. Nobody asked for them. Each one came about one second after Core's own fuse trigger:

02:35:07.046 fuse-saturated → MPC replan triggered
02:35:08.247 mpc: replanned decision_id=dd75946d… reason=manual
02:36:19.046 fuse-saturated → MPC replan triggered
02:36:20.315 mpc: replanned decision_id=26ff3b27… reason=manual
02:37:22.020 fuse-saturated → MPC replan triggered
02:37:23.272 mpc: replanned decision_id=211e9196… reason=manual

The Easee car was charging; at 02:35:03 the fuse clamp cut it from 10 350 W to 9 660 W. The journal shows no API, app, relay, cloud, agent or loadpoint goal event between 02:30 and 02:40. In the past week all 54 manual replans on the box followed this trigger. The clock change did not cause it: the same pattern ran at 02:45–02:52 CEST on 19 Oct.

Cause

The fuse trigger in go/cmd/ftw/main.go calls mpcSvc.Replan(ctx), and Replan labels its plan manual (go/internal/mpc/service.go). The startup replan does the same. The Plan page then shows "replanned 1m ago (manual)", and the plan history and the support report give a manual trigger.

Change

  • The fuse trigger passes fuse_saturated. The startup replan passes startup.
  • Replan keeps manual for POST /api/mpc/replan and tests. Its comment now says so.
  • TestCoreReplansNameTheirCause reads go/cmd/ftw and fails on any .Replan( call there. On master it fails on main.go:1901 and main.go:3262; on this branch it passes.

Core replans at the same moments as before. Only the label changes. No web code changes; the Plan page prints the new reason as it prints the others (missing_plan_retry, loadpoint_ev_stopped).

Left as is

While the car wants more than the fuse allows, the flag rises again after the 60 s cooldown, and Core replans again. The new plan does not end the overage, so a charging night gives a few of these an hour (six between 02:00 and 03:00 CET). Dispatch already holds the fuse, so the replan carries no safety duty. Whether to keep it is a separate decision.

Evidence

  • go vet ./internal/... ./cmd/ftw/...: clean.
  • go test ./internal/... ./cmd/ftw/... with drivers fetched: all pass except internal/energyreport and internal/statsrelay, which fail the same way on clean master on this laptop and pass in master CI.

🤖 Generated with Claude Code

The fuse trigger and the startup replan called mpc.Service.Replan, which
labels its plan "manual". On the home box on 25 Oct 2026 that put three
"manual" replans at 02:35, 02:36 and 02:37 CET, each one second after
"fuse-saturated → MPC replan triggered", with nobody at the box. All 54
"manual" replans there in the past week followed that trigger.

The two callers now pass "fuse_saturated" and "startup". Replan keeps
"manual" for POST /api/mpc/replan and tests. A test in cmd/ftw fails on
any .Replan( call there, so the next trigger has to name its cause.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-25T08:01:39.232199Z d57b902 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

When the joint allocator held the battery or an EV under the fuse, Core
started a new plan on the rising edge, at most once a minute. The new
plan could not end the overage, which live dispatch already holds, so a
charging night got several replans an hour with nothing to gain. Fredrik
asked to remove it (25 Oct 2026). The startup replan keeps its own
reason; "manual" is the Replan button only.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@frahlg frahlg changed the title fix(mpc): a plan Core makes by itself no longer says manual fix(mpc): drop the fuse-saturation replan; Core replans name their cause Oct 25, 2026
@frahlg
frahlg merged commit 11f83b2 into master Oct 25, 2026
23 checks passed
@frahlg
frahlg deleted the fix/fuse-replan-reason branch November 11, 2026 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant