Conversation
sjorge
reviewed
Feb 21, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves Zigbee2MQTT startup/shutdown behavior when receiving signals by making startup abortable, hardening stop paths during partially completed startup, and optimizing passlist/blocklist handling.
Changes:
- Add
AbortController-based startup aborting and pass signal context intoController.stop(). - Harden shutdown paths to avoid errors when stop occurs mid-startup (Zigbee/MQTT/state/onEvent).
- Optimize passlist/blocklist processing on Zigbee startup and extend tests for aborted-startup scenarios.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
index.js |
Refactors startup script imports and adds JSDoc typing; passes signal into controller stop. |
lib/controller.ts |
Introduces abortable startup sequence and logs “Stopping …” with signal/code/restart context. |
lib/zigbee.ts |
Adds abort checks during Zigbee startup and optimizes passlist/blocklist removal behavior. |
lib/mqtt.ts |
Adds guard to avoid publishing offline state when MQTT client isn’t initialized. |
lib/state.ts |
Guards state cleanup logic during stop when Zigbee wasn’t fully started. |
lib/extension/onEvent.ts |
Guards stop-time onEvent calls when Zigbee wasn’t fully started. |
test/controller.test.ts |
Adds coverage for aborts during different startup phases; extends blocklist test. |
test/mocks/mqtt.ts |
Adds missing vi import for mock function usage. |
Koenkk
reviewed
Feb 21, 2026
795b9f9 to
b6a02ca
Compare
1e16c62 to
3c86769
Compare
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.
index.jsindex.jsstopStopping Zigbee2MQTT (restart=false, code=0, signal=SIGINT)startand various nested calls that are possibly "long-running"@Koenkk if you see a better way to do this... 😛
CC: @burmistrzak @sjorge @andrei-lazarov if you have some time to review this 😉
TODO: