Skip to content

Match planner admission and budgets to the selected engine - #1120

Merged
frahlg merged 1 commit into
masterfrom
fix/planner-admission-budget
Sep 7, 2026
Merged

Match planner admission and budgets to the selected engine#1120
frahlg merged 1 commit into
masterfrom
fix/planner-admission-budget

Conversation

@frahlg

@frahlg frahlg commented Sep 7, 2026

Copy link
Copy Markdown
Member

A site without a home battery could enter Core DP planning even when it explicitly selected Core or used the stable/development default. Core DP then rejected every replan. Planner construction and API diagnostics now use the same resolved engine and require positive battery capacity for Core DP. Energyplan still permits batteryless sites; beta defaults and explicit aliases retain their existing behavior.

Core already applies PV uncertainty once to a deterministic downside horizon before calling Energyplan. The dead uncertainty branch in the worker budget is removed, and the guide now describes the actual contract: 500 ms for small requests, 5 s for larger fleets or PV control, with a 7 s transport timeout. The native request test uses the real constructor and Service.Replan path to verify the downside values, zero additional scenarios/CVaR and the serialized budget. The worker source and compiled bundle are unchanged.

The existing restore/shadow regression also gets current 15-minute price fixtures. Its hourly fixture fell outside the service lookback after minute 15, causing a missing current action instead of testing execution permission. The live/shadow/archive/new-plan assertions remain intact.

Validation:

  • The admission regression failed before the fix through real buildMPC and both /api/mpc/plan and /api/mpc/diagnose. Targeted Go race tests now pass, including engine/platform defaults and Energyplan admission.
  • Real native process tests pass under race for the deterministic downside request, larger-fleet budget and full restore/shadow sequence.
  • Full make verify passes, including native planner/forecast integration, Go suites, compose/container/release checks, vet and build.

Addresses the two late findings on #1118: #1118 (comment) and #1118 (comment). Includes a patch changeset. Existing #1003, #1052, #826, #735 and #734 retain their unrelated entrypoint work; these changes are confined to planner admission and its diagnostic reason.


Note

Medium Risk
Changes who gets an MPC service at boot and what diagnose reports for batteryless sites; behavior is engine-dependent but covered by new admission and API tests.

Overview
Planner admission now keys off the same resolved engine for buildMPC and /api/mpc/diagnose. Sites with no home battery are rejected with no-battery-capacity when Core DP is selected (explicit core, stable, or dev default). Energyplan (explicit or beta default on supported platforms) still allows batteryless planning. Engine resolution moves to config.Planner.EngineForBuild so the CLI and API stay in sync.

Energyplan solve budget no longer treats PV uncertainty parameters as a reason to use the 5 s limit—Core already applies a single downside PV horizon before calling the worker, so only large models and PV curtailment bump the budget. Docs and integration tests reflect that contract (including serialized TimeLimitS and downside PV values).

A restore/shadow test fix seeds current 15-minute price slots so execution checks are not flaky outside the service lookback window.

Reviewed by Cursor Bugbot for commit a45fda4. Bugbot is set up for automated code reviews on this repo. Configure here.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 7, 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-09-07T21:35:53.875292Z a45fda4 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.

@cursor

cursor Bot commented Sep 7, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_698f4997-8f4c-4200-bfd7-d2ebda14b8ca)

@frahlg
frahlg merged commit becc906 into master Sep 7, 2026
17 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