Repository navigation
fix(forecast): keep learning when an update moves the driver scripts - #1492
Merged
Merged
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
The learning revision hashed each measurement driver's resolved Lua path. On a native install that path is the release's own directory, so every update produced a new revision and started the PV and load models over, even with byte-identical scripts. The home box saw 25 resets in 9 days. Hash the configured path (drivers/<name>.lua) instead and keep the script content digest, so a real measurement change still resets. A site whose scripts did not move (Docker, Home Assistant) keeps the learning ID it accepted under the old policy; a native site starts over once more, as every update did before. Fixes #1488 Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Fredrik Ahlgren <[email protected]>
With a relative drivers directory the resolved path stays relative, so Core cannot read the script and hashes "unavailable". Hashing only the configured path then gave two directories with different measurement code the same learning revision. Keep the resolved path for any driver without a content digest, so a different script still resets learning. Found by a local Codex review. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Fredrik Ahlgren <[email protected]>
frahlg
force-pushed
the
1488-learning-revision
branch
from
October 1, 2026 17:51
6a19d50 to
1a40291
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On a native install every Core update restarts the PV and load models. The learning revision hashes each measurement driver's resolved Lua path, and that path lives in the release's own folder (
/opt/ftw-native/releases/<version>/drivers/…). A new release means a new path, a new revision and a reset, even when the script is byte-identical.Home box, 22 Sep–1 Oct: 25 learning revisions in 9 days; the longest stable stretch was 53.7 h. Energyplan's load model needs two days to leave cold start and eight to be ready, so it never got there, and Core used the legacy load twin for 81 % of forecast points.
Change
forecastStaticRevisionhashes each driver as configured (drivers/<name>.lua) and keeps the script content digest. A real script change still resets learning; a moved script does not.Configurerecognises learning IDs accepted under the old resolved-path policy (both the beta.4 measurement-driver form and the beta.3 all-driver form) and carries them over.What a site sees on this update
Tests
TestForecastLearningSurvivesReleaseDirectoryMove: the same scripts in a new release folder keep the revision; changed script content changes it.TestForecastLearningIDCarriesAcrossPortablePathPolicy: a learning ID accepted under the old policy carries over when the paths did not move.make verifyclean.Fixes #1488. One of four forecast fixes found while evaluating #1482, with #1489, #1490 and #1491. They touch nearby code in
go/cmd/ftw/forecast_site.go; merge order #1488 → #1489 → #1490.🤖 Generated with Claude Code