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 👍 / 👎.
89f2cce to
f5ca0f6
Compare
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>
…eter readings A stop that names another transaction than the running one, such as a queued stop from before a restart, ended the running transaction and took MeterStop as its session energy. Keep the running one and confirm the stop. ParseFloat accepts NaN and Inf; taken up as the start reading of a resumed transaction, one spoiled every later session value. Skip non-finite sampled values. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
f5ca0f6 to
92230c0
Compare
Item E1 of the stable plan (27 Oct 2026). OCPP 1.6 only; 2.0.1 Updated and Ended follow in a separate PR.
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. Rig 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, the charger's lifetime register. Example: a car on transaction 42 finishes at a register of 12,345,678 Wh; Core reported a 12.3 MWh session to the loadpoint, the UI, the cloud link and theev_session_whmetric.MeterStop9,000,000 settransactionIDto −1,chargingto false andsession_whto 8,999,000.strconv.ParseFloataccepts"NaN"and"Inf". Taken up as the start reading, one would spoil every later session value, andpushReadingcannot marshal a non-finite value (Codex P2 on this PR).Change
All in
go/internal/ocpp/handlers.go:session_whand records noev_session_whmetric. It still endschargingand clears measured power as before.chargingandconnected.What this does not fix
restoreOffers) is still not restored for OCPP.OnTransactionEvent. It comes next.Tests
transaction_resume_test.go: eight tests. The take-up, unseen-stop, id and lifetime-register tests fail on master.TestOCPP16StopForAnotherTransactionKeepsTheRunningOneandTestOCPP16NonFiniteRegisterIsNotTakenUpfail on this PR's previous head and pass now. The last two are the audit's repro tests (TestReproStopNotMatchedToTransaction,TestReproRestartStop16ReportsLifetimeRegister) under normal names.cd go && go test -race ./internal/ocpp/... -count=1: ok.go vet ./...andgo build ./...: ok.ev_session_whread 0 after the restart; with it the log saysOCPP running transaction taken up txid=25371034 meter_wh=3337andev_session_whcounts again. Rig R4 in the stable plan covers it on this head.Risk
Low. Nothing here touches dispatch, fuse math, signs or the command path. The one new state rule keeps a running transaction when a stop names another id. If a charger sends a wrong id for the real stop, Core keeps the transaction id until the next StartTransaction replaces it, and that session records no
ev_session_whmetric.charging,connectedand measured power still follow the status notifications and meter values, so control sees the car stop.🤖 Generated with Claude Code