Skip to content

fix: Ignore a response that has no pending request - #254

Merged
RobinBol merged 2 commits into
masterfrom
fix/ignore-unmatched-responses
Oct 23, 2026
Merged

RobinBol merged 2 commits into
masterfrom
fix/ignore-unmatched-responses

Conversation

@RobinBol

Copy link
Copy Markdown
Collaborator

When a device sends the same response twice, the first copy resolves the pending request and the second finds no pending request and no handler. It was then logged as unknown_command_received and answered with an error Default Response (FAILURE, and UNSUP_COMMAND since v3.9.0), although the device sent a valid response. Now a response (or Default Response) without a pending request is ignored with a debug log. Unknown non-response commands still get an error Default Response.

Fixes #209

Some devices send the same response twice. The second copy found no
pending request and no handler, so it was logged as an unknown command
and answered with an error Default Response, although the device sent a
valid response. Ignore responses without a pending request with a debug
log instead.

Fixes #209
@RobinBol RobinBol self-assigned this Oct 23, 2026
@RobinBol
RobinBol requested a balanced review from Copilot October 23, 2026 11:06
@github-actions github-actions Bot added the fix Bug fix, release notes: Fixes label Oct 23, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The narrowly scoped fix preserves existing command handling and includes regression coverage for the reported duplicate-response behavior.

No open issues 🎉

What changed in this PR

Fixes #209 by ignoring recognized responses with no pending request instead of treating them as unknown commands and sending an error Default Response.

Changes:

  • Adds a debug-logged fallback for unmatched responses and Default Responses, preserving existing handler dispatch and unknown-command errors.
  • Adds a regression test confirming that a duplicate Read Attributes Response does not trigger an error reply.
File Description
test/​testClusterResponseTimeout.js Tests successful response delivery and suppression of an error reply for a duplicate.
lib/​Cluster.js Ignores recognized responses that reach the unhandled-command fallback.

Review effort: Balanced

Only responses without a pending request are ignored; a server-to-client
request the cluster has no handler for must still be answered with
UNSUP_COMMAND.
@RobinBol
RobinBol marked this pull request as ready for review October 23, 2026 11:26
@RobinBol
RobinBol merged commit 2dabf65 into master Oct 23, 2026
2 checks passed
@RobinBol
RobinBol deleted the fix/ignore-unmatched-responses branch October 23, 2026 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Bug fix, release notes: Fixes

Development

Successfully merging this pull request may close these issues.

Bug: readAttributesStructured.response frames logged as unknown_command_received after being handled correctly

2 participants