Skip to content

Revert "fix(drivers): restart a driver that stays offline (#1628)" - #1771

Merged
frahlg merged 1 commit into
masterfrom
revert-1628-driver-restart-watchdog
Oct 21, 2026
Merged

frahlg merged 1 commit into
masterfrom
revert-1628-driver-restart-watchdog

Conversation

@frahlg

@frahlg frahlg commented Oct 21, 2026

Copy link
Copy Markdown
Member

Reverts #1628 before the next beta. It has not shipped, so users see no change against v0.154.2-beta.1 and the PR carries no-changeset.

Why

Review of master since v0.154.2-beta.1 found three problems:

  • The offline alert never fires. restartLocked calls removeLocked, which calls telemetry.Store.Remove (registry.go:1236) and deletes the driver's health. The new record has no LastSuccess and no ticks, and the notifier skips such a driver as never started (notifications/service.go, "Cold start"). A device that stays down is restarted every few minutes and its owner is never told.
  • No limit on restarts. Backoff is 30 s, 1 min, 2 min, then every 5 min forever. An inverter that sleeps at night is torn down and started again all night. Each restart sends driver_default_mode to a dead device and clears its readings.
  • Repeated logins. A failed add of a cloud driver runs driver_init every 5 minutes, a lockout risk with bad credentials.

The review also found that a restart holds the driver's lifecycle gate for 15–45 s on a dead Modbus host, which stalls a Settings save, and a narrow race with driver repository activation.

What remains

The problem #1628 set out to fix is real: a Pixii stayed offline after a power outage because a driver that fails to start at boot is never retried. A follow-up PR will retry only that case (enabled, not running → retry add with backoff), without the stale-restart rules.

Test

make verify: 77 Go packages pass, build and vet clean. go test ./internal/api ./cmd/ftw pass.

🤖 Generated with Claude Code

This reverts commit b271a76.

#1628 has not shipped. Review found that it breaks the driver offline
alert and restarts sleeping devices without limit:

- A restart calls tel.Remove, which deletes the driver's health. The
  notifier skips a driver that has never succeeded, so the "driver
  offline" push never fires for a device that stays down.
- Backoff ends at every 5 minutes with no cap. An inverter that sleeps
  at night is torn down and started again all night, and each restart
  sends driver_default_mode to a dead device and clears its readings.
- A failed add of a cloud driver runs driver_init every 5 minutes.

The problem it set out to fix stays real: a driver that fails to start
at boot is never retried. A smaller change will retry only that case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@frahlg frahlg added the no-changeset PR intentionally exempt from the changeset requirement (dev tooling / non-shipping) label Oct 21, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 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-21T07:57:40.351560Z a75da93 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 5730b44 into master Oct 21, 2026
23 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changeset PR intentionally exempt from the changeset requirement (dev tooling / non-shipping)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant