Skip to content

export: banked intelligence for the next Alexa subscription-staleness recurrence — matter.js report-routing defect (HAMH patch) + session-hygiene playbook #283

Description

@simons-plugins

Context

Recorded intelligence from the 2026-08-22 investigation of HAMH (riddix/home-assistant-matter-hub), banked as the standing playbook for the next recurrence of production Alexa subscription staleness (#143's unexplained residue: fresh pairings that enumerate then never send a single SubscribeRequest, and healthy subscriptions that collapse). Production is currently healthy (fabric 14, three clean bridge restarts on 2026-08-22), so nothing here should be built until the symptom reproduces.

Finding 1 — a real matter.js 0.17.x defect: subscription reports routed to the peer's newest session

HAMH carries a pnpm patch (patches/@matter__node@0.17.9.patch) to ServerSubscription#sendUpdateMessage. In stock matter.js, routine subscription sends (attribute updates and keepalives) arrive with session === undefined and are resolved via initiateExchange(peerAddress)SessionManager.maybeSessionFor(), which picks the peer session with the newest activeTimestamp — not the session that holds the subscription. When a controller piles up CASE sessions (HAMH #400 observed 160 on one flapping Echo), a subscription's DataReport can land on a session the controller isn't consuming: it MRP-acks the frame and discards it.

Signature produced: "delivered + ACKed, never rendered" — a second, distinct mechanism for that symptom (independent of the #276 occupancy-event gap; our event fix demonstrably worked through this same send path, so it was not our 08-22 bug).

Their patch pins each send to the subscription's own session, or skips if that session is dead.

Upstream status (checked 2026-08-22): apparently unreported. matter-js/matter.js has an adjacent fix — #4120 "prevent subscription activation on a closing session" (merged 2026-07-20) — but nothing covering update-send routing. Credit for the finding belongs to the HAMH maintainer.

Finding 2 — app-level session hygiene (no matter.js patching required)

HAMH's always-on machinery, all implementable at bridge-node level via public APIs (bridge.ts, session-rotation.ts, wedge-watchdog.ts):

Diagnostic to run first when staleness recurs

Count live CASE sessions per Echo peer (41869fbd537ef01 / 41869fd51d8b011) in the bridge log. Multiple piled sessions for a peer with a stale subscription → Finding 1 is in play; the superseded-session sweep is the minimal remedy and the upstream routing fix is the real one.

Explicitly NOT worth adopting (assessed)

  • Auto Force Sync: opt-in, 90s, diff-filtered re-push of missed HA→bridge updates only — it cannot refresh what a controller ignores, and their FAQ oversells it.
  • matter.js dependency patching: against this repo's stock-npm policy (hand-patch saga, 2026-08-20). The routing fix should arrive via an upstream matter.js release; consider filing it upstream (crediting HAMH's patch) rather than vendoring.

Also confirmed in passing

Alexa's event-vs-attribute consumption is per-cluster: it consumes attribute-only reports for measurement clusters (HAMH #400, temperature), events for occupancy (#276 here) and BooleanState sensors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions