Skip to content

fix(mpc): keep current weather input - #897

Merged
frahlg merged 1 commit into
masterfrom
agent/mpc-current-weather-input
Aug 11, 2026
Merged

frahlg merged 1 commit into
masterfrom
agent/mpc-current-weather-input

Conversation

@frahlg

@frahlg frahlg commented Aug 11, 2026

Copy link
Copy Markdown
Member

What changed

  • Load the preceding weather hour when building an MPC plan, so an hourly row that covers the current 15-minute price slot remains available.
  • Use the same weather overlap window when the twin-drift check resamples the active plan.
  • Stop cached PV estimates from carrying backward into slots before forecast coverage.
  • Stop cloud fallback from skipping past the nearest row when that row has no cloud value.

Why

The planner loaded prices and weather with the same 15-minute lookback. Hourly weather rows often start more than 15 minutes before now, so the row covering the current slot was dropped while the current price slot stayed in the plan. The PV twin could then use a later horizon row, and the drift check could compare against a different weather row from the one used to build the plan.

This could produce a wrong first-slot PV input and false twin-drift replans.

Impact

The current MPC slot and its drift check now use the same covering hourly weather row. No database, API, optimizer protocol, or configuration format changes.

Part of #885.

Verification

  • make verify-all passed, including 134 optimizer tests, all Go packages, Core↔Optimizer contract tests, Compose migration, full-stack e2e, vet, builds, and Linux/Windows cross-builds.
  • Four focused regression tests passed 100 times.
  • The same four tests passed 20 times with the race detector.
  • Full go test -race ./internal/mpc and go vet ./internal/mpc passed during review.
  • Two independent reviews found no remaining P0–P3 issues.
  • All 22 open PRs and their review threads were checked; none touch these files.

@frahlg
frahlg marked this pull request as ready for review August 11, 2026 10:12
@frahlg
frahlg merged commit 6947210 into master Aug 11, 2026
14 checks passed
@frahlg
frahlg deleted the agent/mpc-current-weather-input branch August 17, 2026 18:18
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