Repository navigation
fix(drivers): give slow cloud drivers time, hand devices back on removal - #2079
Merged
Merged
Conversation
A Zaptec Cloud command that took longer than 5 s failed, and the safe default then paused the charger at 0 A. A driver can now ask for up to 30 s per call with host.set_command_timeout_s; the control tick still waits only its short deadline and the call finishes in the driver's queue. Removing or disabling a driver calls its optional driver_release instead of driver_default_mode, so a charger goes back to the owner's own current rather than staying at FTW's 0 A. Restarts, shutdown and stale readings keep the safe default. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis 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. |
Move the pin to srcfl/device-drivers@28c771fd (#279). zaptec_cloud 0.3.0 uses host.set_command_timeout_s and driver_release from this PR. The pin also carries the easee_cloud fixes merged since e7b94b11 (#183, #227, #194, #236, #200), whose Core side (#2050, #2062) is already on master. Tell the stopped instance's default apart from a replacement's startup default in TestOtherStopsKeepTheSafeDefault (review finding). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The first field test of Zaptec control (v0.167.0-beta.1, Zaptec Go, 20 A fuse, one-phase cars) could not charge. Two of the causes sit in Core's driver host:
restoreAfterCommandthen randriver_default_mode, which for a charger is 0 A and a pause. Lifecycle calls (driver_default_mode,driver_cleanup) had a fixed 5 s inLuaDriver.call, whatever the caller allowed.driver_default_mode. For Zaptec that storesmaxChargeCurrent = 0on the charger. The owner found "Max Current lower than Min Current" in the Zaptec portal; neither the Zaptec app nor their other load balancer could start the charger until they fixed it by hand.Change
host.set_command_timeout_s(seconds): a driver asks for up to 30 s per call fromdriver_init. It sets the least run time for commands, the startup default, recovery and watchdog defaults, the shutdown default and cleanup. Callers keep their own deadlines, so the control tick never waits longer; the call finishes in the driver's actor, and only a call that runs out of the driver's own time counts as failed.driver_release():Reloadcalls it instead ofdriver_default_modewhen a driver has left the config or been disabled. A driver without it is stopped with its default, as before. A restart, a config change, shutdown and a stale reading keepdriver_default_mode. A refused release keeps the name's recovery gate, as a refused default does.docs/writing-a-driver.mddocuments both; patch changeset.Paired with srcfl/device-drivers#279 (zaptec_cloud 0.3.0), which uses both. The second commit moves the driver pin to srcfl/device-drivers@28c771fd (#279 merged): zaptec_cloud 0.3.0, plus the easee_cloud fixes merged since e7b94b11 (#183, #227, #194, #236, #200), whose Core side (#2050, #2062) is already on master.
Tests
On this machine:
make verifypassed. Newregistry_release_test.go: removal and disable call release and not the default; shutdown, restart and config change call the default and not release; a driver without release gets its default; a refused release keeps the gate;set_command_timeout_sbounds (default, 12 s, cap 30 s, floor, negative refused); and a 6.5 s command with a 500 ms caller deadline finishes without the safe default when the driver declared 15 s, and trips it when it did not.🤖 Generated with Claude Code