Repository navigation
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 89f2cceea6
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| s.transactionID = txID | ||
| s.sessionStartMeterWh = meterWh |
There was a problem hiding this comment.
Reject non-finite readings before adopting a transaction
If the first energy register received after restart contains "NaN" or "Inf", strconv.ParseFloat accepts it without an error, and this assignment permanently stores a non-finite session baseline. Every subsequent valid reading then produces non-finite session energy, and pushReading cannot marshal its telemetry payload because JSON rejects these values. Unlike a bad sample during an ordinarily started transaction, later valid samples cannot recover this session. Check that the converted meter reading is finite before adopting the transaction so a later valid reading can establish its baseline.
Useful? React with 👍 / 👎.
A charger keeps its transaction while Core restarts and keeps naming it in MeterValues. Core started every charger with no transaction, so session energy stayed at 0 until unplug and the stop reported the lifetime meter total. Take the transaction up from its first meter value, count energy from that reading, and start transaction ids from the clock so a restart does not hand out an id a charger still holds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
89f2cce to
f5ca0f6
Compare
Draft for the next beta (owner's scope decision, 21 Oct 2026). Do not merge before that beta is cut.
Problem
Core restarts on every update. An OCPP 1.6 charger keeps its transaction through the restart and goes on naming it in MeterValues. Core started every charger with no transaction (
transactionID−1) and handed out ids from 1 again. For a session that spans a restart:session_whstayed at 0 until unplug, becauseOnMeterValuescounts energy only while a transaction is known. The rig shows it: s7-25 with fix(loadpoint): Charge now keeps charging after a restart #1778 ended withev_session_wh0 while the car drew 11 kW.MeterStop − 0, which is the charger's lifetime meter total. The simulator starts its meter at 0, which hides this; a real charger reports its lifetime register.Change
All in
go/internal/ocpp/handlers.go:session_whto 0 while the car is plugged in.session_whas it was and records noev_session_whmetric.OCPP 2.0.1 is unchanged. It has the same gap in
OnTransactionEvent(Updated with no known transaction).What this does not fix
delivered_wh_sessionstill restarts near 0.restoreOffers) is still not restored for OCPP. It needssession_whthat has not gone back. After a restart Core also sends its first command about 1 s after the charger reconnects, before the first MeterValues (8 s later in the rig, often a minute on real chargers). A fix needs the start reading kept in state.db and a first command that waits for a reading or asks for one.Evidence
transaction_resume_test.go: three tests fail on master and pass here (taking up the transaction, the stop of an unseen transaction, ids after a restart). One more guards the late meter value, and one checks the id start.make verifypasses.make verifypass again there.ev_session_wh4038 before the stop, 0 for the rest of the run;OCPP running transaction taken up txid=25371034 meter_wh=3337;ev_session_whcounts again, 607 Wh after 150 s. The charger's MeterValues name the same id throughout.fuse_limitin every sample) instead of 11 kW. An earlier run on fc621be + fix(loadpoint): Charge now keeps charging after a restart #1778 released after ~30 s; master has fix(control): count EV raises per phase until the charger can apply them #1776 since then.🤖 Generated with Claude Code