Skip to content

chore(optimizer): bundle Energyplan 0.6.0 - #1858

Merged
frahlg merged 2 commits into
masterfrom
chore/energyplan-0.6.0-bundle
Oct 25, 2026
Merged

frahlg merged 2 commits into
masterfrom
chore/energyplan-0.6.0-bundle

Conversation

@frahlg

@frahlg frahlg commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

Change

Moves optimizer/native/bundle to Energyplan 0.6.0 (v0.6.0-beta.1, source srcfl/energyplan e975bb9). The workers are for linux-arm64, linux-amd64 and darwin-arm64. The manifest, README version and the two tests that pin the version change. Licenses, notices and forecast schemas are unchanged.

The worker lists the hourly_import_caps handshake feature (srcfl/energyplan#78). Every clock hour's import stays under the owner's hourly limit in every solver path. A car goal the cap makes unreachable shows as shortfall. The house alone may exceed the cap only in an hour where every car is off. Without caps its replies are those of 0.5.2: 300/300 Core-shaped replies were byte-identical.

Pairs with #1835. Core sends the hours only to a worker that announces the feature, so this pin turns the cap on in the worker. Either PR is safe alone: #1835 without this pin keeps the cap in Core's own planner, and this pin without #1835 never receives caps.

Evidence

  • python3 optimizer/native/verify.py: verified 0.6.0, 3 platforms, darwin-arm64 handshake.
  • make native-solver-test: mpc, energyforecast, cmd/ftw pass.
  • go test ./internal/mpc/... ./cmd/ftw/...: pass.
  • Local merge with fix(mpc): the plan keeps each clock hour under the import ceiling #1835 0b50769 (293c35b1, not pushed): TestNativeEnergyplanTakesHourlyImportCaps now runs instead of skipping, and passes. go test ./internal/mpc/... ./cmd/ftw/... ./internal/control/... passes with the bundled worker.
  • Energyplan side: 22 local CI stages passed on e975bb9. With a 4.5 kW cap, 60/60 Core-shaped plans, 0 hours over the cap.
  • The rig run (s16, import ceiling, engine energyplan) on the merged pair is pending.

Budget overrun (pre-existing, not changed here)

The worker's solve_ms can end a few ms past time_limit_s. On the shared M5, runs that used the whole budget overran by p50 1–4 ms, p90 up to 20 ms, max 76 ms with caps (no caps: max 28 ms). Core does not reject on solve_ms. It waits for the reply until min(7 s, first slot left − 50 ms).

  • At the full 5 s budget there are about 2 s of slack, so a small overrun is harmless.
  • When the end of the first slot clips the budget, energyplanTimeBudget returns first slot left − 50 ms. That is exactly the call deadline. A worker that uses its whole budget then always replies late (solve tail, encoding, pipe). Core drops the reply, restarts the worker and uses its own plan.
    • This affects plans started in the last ~5 s of a quarter, about 0.5 % of random replans.
    • It already applies to every fleet request: demand charges, PV caps and large fleets. Caps put more requests on the fleet budget, and about 40 % of capped requests use their whole budget.

Fix: #1835 makes Core send the worker its call deadline less max(5 %, 30 ms) when the slot end clips the budget. Follow-up for Energyplan 0.6.0-beta.2: the worker keeps a small tail inside its own budget for the final replay and the reply, so a tight budget never ends late on a slower box.

Do not merge before #1835 is reviewed.

🤖 Generated with Claude Code

Bundle the worker from srcfl/energyplan e975bb9 (0.6.0, release
v0.6.0-beta.1) for linux-arm64, linux-amd64 and darwin-arm64. The worker
lists hourly_import_caps and keeps every clock hour under the owner's
hourly import limit; with #1835 Core sends it the hours. Without
caps its replies are those of 0.5.2. Licenses, notices and forecast
schemas are unchanged. Protocol v1 is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com>
@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-25T18:16:39.782641Z 8e66a6b 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.

@frahlg
frahlg merged commit e5edf34 into master Oct 25, 2026
22 checks passed
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