delete stale worktrees and branches, then look at #1397
Assistant
I'll start by checking for relevant skills, then handle both tasks.
Assistant
Four [gone] branches. Before force-removing worktrees, let me check for uncommitted work in each.
Assistant
All clean — no uncommitted or unpushed work. Proceeding with cleanup.
Assistant
The skill's pattern assumed [gone], but git branch -vv actually renders it as : gone]. Fixing the pattern:
Assistant
Cleanup done: 4 stale branches deleted, 3 worktrees removed (lcm-cov, lcm-1398, lcm-1399). Two active worktrees remain (lcm-1279, lcm-props).
★ Insight ─────────────────────────────────────
The skill's grep pattern \[gone\] didn't match anything — git branch -vv actually formats it as [origin/branch: gone], so the bracket wraps the whole upstream clause. Worth fixing in the skill if this recurs.
Checking git status --short and git log @{u}.. in each worktree beforegit worktree remove --force is the safety net the skill omits — force removal discards uncommitted work silently.
─────────────────────────────────────────────────
Now #1397. Note that fix/1397-uc-occupied-slot-unreadable was one of the deleted branches, so there's history here.
Assistant
The reporter uploaded the Z-Wave JS device diagnostics today — that's the exact file needed to settle the ambiguity. Let me gather context and invoke the debugging skill.
Assistant
This is a live bug diagnosis with a decisive new data point. Invoking the debugging skill before drawing conclusions.
Assistant
Now Phase 1 — evidence. The decisive field is userIdStatus[5] in the freshly-uploaded Z-Wave JS device diagnostics.
Assistant
Kwikset HC620, firmware 7.21.0, driver 15.24.2 — confirming the hardware guess. Now the decisive field:
Assistant
userIdStatus[5] = 0 — that's Available. This is the decisive datum, and it settles the question the other way from what PR #1408 fixed. Let me verify the surrounding context before concluding.
Assistant
Legacy User Code CC lock (no User Credential CC). Two things stand out. Let me confirm the CC version and then read the current code path.
Assistant
Got it — removing the remaining two worktrees. Checking for uncommitted work first, and keeping the branches (they're still live on the remote).
Assistant
Both clean and fully pushed — safe to remove.
Assistant
Worktree cleanup complete — only the main repo remains, both live branches preserved.
Now back to #1397. The new diagnostics settle it — and they rule out the mechanism 4.4.2 fixed. Let me verify against the code.
Assistant
_overlay_uc_occupancy gates on in_use is not True — with userIdStatus[5]=0 (Available), it skips. PR #1408 provably cannot fire for this reporter, which matches their report. But line 938 in that same file names something important — let me pull the thread.
Assistant
Line 424 flags a driver-version threshold — and this reporter is on 15.24.2, below it. Let me read that.
Assistant
Now I have a coherent hypothesis forming. Two claims need verification before I assert anything — per the layer-tracing rule, let me check the driver source and LCM's refresh path.
Assistant
Line 284 uses get_all_credentials_cached() but line 1073 uses fresh get_all_credentials(). Which one the post-OPTIMISTIC confirmation read takes is now the pivotal question.
Assistant
#getAllCredentials_UC genuinely queries the device (api.get(...)), so the value DB reflects what the lock actually reported. That kills the "stale driver cache" theory. Let me check the remaining device-side facts.
Assistant
Let me confirm the suspension mechanics so I can describe the fix precisely.
Assistant
I have the answer. Let me record it in memory first — the prior note explicitly said not to re-assert the mechanism without this exact file, and it now resolves the other way.
Assistant
Both tasks done. Here's what I found.
Worktree & branch cleanup
Removed 5 worktrees and 4 stale branches. Only the main repo remains; test/property-codec-coverage and feat/credential-length-capabilities branches are preserved (still live on the remote, checkout-able in main). Also pulled main to 1c26f5c6.
★ Insight ─────────────────────────────────────
The skill's grep '\[gone\]' matched nothing — git branch -vv renders it as [origin/branch: gone], so the bracket wraps the whole upstream clause, not the word. The correct pattern is ': gone\]'.
Worth checking git status --short + git log @{u}.. per worktree before worktree remove --force; the skill's one-liner force-removes unconditionally.
─────────────────────────────────────────────────
#1397 — the new diagnostics settle it, and not in favor of 4.4.2
The reporter uploaded the Z-Wave JS device diagnostics today. That file contains the one field the whole diagnosis hinged on, and it resolves to the branch that 4.4.2 does not fix.
Front Door Lock — Kwikset HC620, fw 7.21.0, User Code CC v2 (no User Credential CC), driver 15.24.2:
slot
userIdStatus
userCode
1–4
1 Enabled
present
5
0 Available
''
7
0 Available
present ← phantom, same family as #1307
6, 8–10, 44–46, 51–53, 170–172
0 Available
''
The lock itself reports slot 5 as empty. This isn't driver-cache staleness — I traced #getAllCredentials_UC (AccessControl.ts:1858) and it's a real device read (api.get(userId, true)), so the value DB holds what the lock actually answered.
Three consequences:
4.4.2 provably cannot help them._overlay_uc_occupancy (providers/zwave_js.py:366) does . Here is , so the empty→unreadable upgrade never runs. That exactly matches "I still see the same error."
Assistant
What would you like to clarify?
To help frame it, the open points I'm aware of on my side are:
How certain the diagnosis is. The userIdStatus[5] = Available reading is solid — it's a device read, not a cache artifact. What's not established is why the write doesn't land. I have no debug logs, so "driver returns ERROR_UNKNOWN → OPTIMISTIC" is inferred from the loop's shape (per your earlier trace, only the OPTIMISTIC path can loop), not directly observed.
Whether the reporter's PIN actually works. The entire "code is on the lock but unreadable" framing rests on "it does work" in the original report, which may just mean the slot works in LCM's UI. This materially changes which fix is right.
Whether driver 15.24.2 is the whole story. They're below both the 15.24.3 and 15.25.2 thresholds the provider already documents. It's plausible an upgrade alone resolves it, which would make any LCM-side fix a robustness improvement rather than the actual repair.
Happy to go deeper on any of these, or to reframe the fix options entirely if you're seeing a different angle.
User
is the fix that we are suggesting for older drivers? would updating to a newer version of zwave-js resolve the issue for the u
Assistant
Good question — and I shouldn't answer it from the release notes alone. Let me trace what actually changed in the driver's User Code write path between their version and current.
Assistant
#8884 — "handle obfuscated codes when verifying User Code changes" is exactly the ERROR_UNKNOWN producer, and it landed after their version. Let me read it.
Assistant
Critical detail: that leniency is gated on version === 1, and this is a v2 lock. Let me check the remaining two candidates and whether supervision is even in play.
Assistant
Supervision CC (0x6C) is absent from this lock. That's decisive — let me confirm what the driver does without it.
Assistant
No — and now I can say that with the full chain verified, not inferred.
Upgrading will not fix it
This lock does not support Supervision CC (0x6C is absent from its 21 command classes). That routes the driver into the read-back verification branch of setCredential (AccessControl.ts:666):
js
const result = await api.set(userId, status, codeData);
if (result == undefined) { // ← no supervision, always taken
const verified = await api.get(userId);
succeeded = verified?.userIdStatus === status // status = Enabled
&& userCodeReadBackConfirmsSet(codeData, verified?.userCode, api.version);
}
...
return succeeded ? {...OK} : { credential: SetCredentialResult.Error_Unknown };
The lock answers that read-back with userIdStatus = Available. So succeeded = false → Error_Unknown → HA's credential_rejected_unknown → LCM's WriteResult.OPTIMISTIC → pending → hard refresh still empty → breaker.
That's the whole loop, confirmed from device diagnostics through driver source to LCM — the debug logs you asked for are no longer needed to establish the mechanism.
Now, each 15.24.3→15.25.2 fix against this lock:
Upstream fix
Applies here?
#8884 obfuscated read-back
No — gated on version === 1; this is UC v2. And it only relaxes the code comparison, never the userIdStatus comparison, which is the half that's failing.
#8927 supervised-write cache sync
No — requires Supervision, which this lock lacks.
#8879 UC/U3C interop dispatch
No — lock advertises no User Credential CC at all.
#8866 delete clears cached slots
No — not the failing operation.
The failing predicate verified?.userIdStatus === status is byte-identical in 15.24.2 and current 15.25.3.
I should correct my earlier framing: I flagged "they're below both driver thresholds, worth updating first." That's fine hygiene but it is a lead on this bug, and I shouldn't have left it looking like one.
User
don't we clear the slot when the circuit breaker trips? so we may not know
Assistant
Good catch — let me check rather than assume, because if we clear on suspend that changes both the test I proposed and possibly the diagnostics reading.
Assistant
_suspend_slot itself doesn't touch the lock — it only sets state and raises a repair issue. But let me check the sibling _disable_slot path above it, which is the one that might clear.
Assistant
Exactly one clear call — line 465, in the normal sync path when the slot is inactive. So the question becomes which path fires at sync.py:779 (the line in their traceback), and whether it flips the slot off.
Assistant
Your instinct is right that it matters, but the code says otherwise — and the distinction is worth pinning down.
Suspension does not clear the slot._suspend_slot (sync.py:505) only sets SyncState.SUSPENDED, records _code_suspend_target, and raises a repair issue. It issues no lock write at all. The breaker path at sync.py:783-801 calls exactly that and returns.
There is only one clear call in the whole sync module — sync.py:465 — and it fires when active_state != STATE_ON, i.e. the slot is inactive. That's the path _disable_slot reaches indirectly: it flips the slot's switch off, and the next tick converges by clearing the code. But _disable_slot is a different failure class from the breaker trip, and the reporter's log line is unambiguously the breaker one ("Sync attempts exceeded ... suspending slot").
So for slot 5: the last thing LCM did was a set, three times, then it stopped. It never cleared. The userIdStatus = Available in the diagnostics is therefore the lock's own answer, not LCM's cleanup.
★ Insight ─────────────────────────────────────
The suspend/disable split is doing real work here: suspend is "stop touching it, leave the lock as-is," disable is "this slot shouldn't hold a code," and only the latter is destructive. If they'd been collapsed into one, this diagnosis would genuinely have been unrecoverable — the evidence would have been erased by the error handler.
That also means suspension is non-destructive by design, which is why "change the PIN to re-arm" works as a recovery instruction.
─────────────────────────────────────────────────
That said, your underlying worry still lands for a different reason: "does the PIN work?" relies on the reporter's recollection, and they may have toggled the slot off/on since (which would have cleared it). So here's a test that doesn't depend on memory or on LCM at all:
Have them set a throwaway code on slot 5 directly via the zwave_js.set_lock_usercode service, then re-download the Z-Wave JS device diagnostics and check userIdStatus[5].
Still Available → the lock refuses to report slot 5, independent of LCM and independent of the unified API. Fix = tolerate the unconfirmable slot.
Now Enabled → the lock reports fine on the legacy property-set path, and the failure is specific to the unified access_control write/verify path. Fix = different, and considerably more interesting.
That's a cleaner discriminator than the keypad question, and it costs them one service call plus one file. Want me to draft the reply around that instead?
User
looks like the PIN works
Assistant
That settles it: the lock accepts codes it refuses to report. So the fix is to stop a permanently-unconfirmable slot from marching to suspension. Let me ground the design in the actual lifecycle code.
Assistant
The reporter confirmed "Yes it works" and attached fresh diagnostics taken right after a controlled failed set. Let me diff them against the earlier snapshot.
Assistant
Identical values — and lastSeen is byte-identical too. That's suspicious. Let me check whether these are actually two distinct dumps.
Assistant
The files are distinct, and the node statistics change everything. Between the two dumps: +39 commands sent, +6 received, +19 response timeouts.
Assistant
~49% of every command to this lock times out — sustained, and 19 of the 39 commands during the controlled test itself. Let me corroborate against the LCM diagnostics.
Assistant
Confirmed — slot_suspended on both locks, and the reason text already hedges "or experiencing communication issues." That's now the answer, not a hedge. One last check: the codebase already has a degraded-lock concept.
Assistant
I have the complete picture now, and it's a different root cause than either earlier hypothesis. Updating memory first.
Assistant
The controlled test was decisive — but the answer was in the node statistics, not the user codes. Correcting my earlier reading: it's not that the lock refuses to report the code; it's that the lock's replies don't make it back.
~49% of every command to this lock times out
commandsTX
commandsRX
timeoutResponse
rtt
dump 1 (13:06)
217
34
107 (49%)
1326 ms
dump 2 (00:05)
256
40
126 (49%)
1072 ms
delta
+39
+6
+19
—
19 of the 39 commands during the failed-set test itself timed out. Route is via repeater node 11 at repeaterRSSI-88/-89, and dump 1 recorded routeFailedBetween: [11, 2].
The mechanism, end to end
This lock advertises no Supervision CC (0x6C is absent from its 21 CCs). So setCredential takes the result == undefined branch (AccessControl.ts:666) and must verify by read-back — api.get(userId).
The SET reaches the lock. That's why the PIN works on the keypad.
The verification GET times out (~50% odds). verified never arrives → succeeded = false → driver returns Error_Unknown → HA credential_rejected_unknown → LCM OPTIMISTIC. (If it throws instead, it's LockOperationFailed — sync.py:781 trips the breaker on either.)
Because that GET never returned, the value DB was never updated — so userIdStatus[5] keeps serving Available from the original interview. Byte-identical across both dumps, 11 hours and one write attempt apart.
LCM can never confirm → 3 laps → suspend. Both locks, slot 5.
Everything else falls out of this:
Slots 1–4 read fine — written/read during the ~51% of windows that worked; once in the value DB they persist.
Slot 7's phantom (code present, status Available) is a partial value-DB update — precisely what a lossy link produces. Same family as #1307's slot 10.
User
how would we detect a degraded link and what would we do?
Assistant
This is designing new behavior, so let me use the brainstorming skill to structure it — but first let me ground it in what signals we actually have available.
Assistant
Now I can see the existing machinery clearly. Let me confirm one thing that determines whether detection is half-built already.
Assistant
Confirmed the gap precisely. Here's the shape of it:
LockDisconnected → note_connectivity_failure() → feeds the lock breaker → converges to unreachable (sync.py:832)
Everything else — including a write that returns OPTIMISTIC and then never confirms — charges only the slot breaker → suspends that slot
In #1397 the write raised no exception at all (ERROR_UNKNOWN → OPTIMISTIC), so LCM got zero connectivity signal. The lock-level link problem was invisible, and the per-slot breaker absorbed it.
The architectural gap in one line: LCM treats only a hard transport exception as evidence about the link, but an unconfirmable write is equally strong evidence — and that evidence currently goes nowhere.
Before I propose approaches, one question that shapes everything downstream:
Assistant
Good instinct — and it's worth checking what zwave_js already surfaces before deciding. Let me verify.
Assistant
Confirmed — zwave_js already exposes timeout_response and rtt as node-statistics sensors, and has a repairs.py. Two details that decide your question:
Assistant
Good question to push on — and the answer is fairly clear once you look at the precedent. I'd say too heavy-handed for core, for three concrete reasons:
1. It's off-pattern for zwave_js repairs. Core has exactly two repair flows: device_config_file_changed and migrate_unique_id. Both are discrete, one-time events with a specific fix action. A link-quality repair is a continuous, fluctuating, thresholded condition — "your RF is mediocre" has no fix flow.
2. Thresholds don't generalize, and this very node proves it. The Front Door Lock is isFrequentListening: 1000ms, canSleep: False — a FLiRS node. Its ~1.1s rtt is normal beam latency, not a symptom. Any naive rtt or timeout-ratio threshold would fire on every healthy FLiRS and sleeping device in every mesh. Calibrating one threshold across mains routers, FLiRS locks, and sleeping sensors is a research project, not a PR.
3. Core already made this call.timeout_response, rtt, rssi, last_seen, commands_tx/rx, commands_dropped all exist as node-statistics sensors — entity_registry_enabled_default = False. The decision was surface the data, don't editorialize. A repair would relitigate that.
★ Insight ─────────────────────────────────────
The FLiRS detail is a nice trap: I'd been reading rtt >1s as corroborating evidence of a bad link, and it isn't — it's exactly what a 1000ms-beam node should do. The timeout ratio (49%) and the weak repeaterRSSI (-88) are the real signals; rtt is a red herring here. Battery is also at 63%, worth a mention but not a cause.
That's a good argument for why the detection belongs in LCM rather than core: core would have to be right about thresholds for every device class, whereas LCM only has to be right about its own writes.
─────────────────────────────────────────────────
Where it does belong: LCM — because LCM has something core doesn't: intent. Core sees "a command timed out." LCM knows "I tried to write this specific code three times and could never confirm it." That's not a generic RF metric, it's a first-person, actionable failure — and it needs zero Z-Wave-specific plumbing, so it works identically for Matter and z2m.
If we later want richer copy for Z-Wave, we can read those already-exposed statistics as supporting detail in the repair text, never as the trigger.
So, back to the fork that shapes the rest — now scoped to LCM only:
Assistant
Noted — and I want to flag a refinement to that option, because I think my own phrasing of it was slightly wrong. Let me check one thing first.
Assistant
That's the seam — sync.py:747-755:
python
if still_wanted:
# Genuine timeout: the write we still want never confirmed.
self._slot_breaker.record_failure()
This is exactly "we wrote it and could never confirm it," already correctly distinguished from a stale entry. It currently charges only the slot breaker. One call site.
First, a correction to my own option text: I said "feed the existing per-lock breaker." Having read it, that's wrong. Charging _lock_breaker sets unreachable = True, which raises the lock_offline repair — telling the user the lock is offline when it demonstrably isn't. That defeats the entire point of honest messaging.
So, three approaches:
A — Reuse note_connectivity_failure verbatim. Free backoff and recovery-probing, no new machinery. But it conflates "offline" with "reachable but unverifiable" and ships a false repair message. Rejected on the messaging grounds that motivated this.
B — Separate per-lock verification breaker.(Recommended.) Coordinator gains a _verify_breaker charged from that one site, a writes_unverifiable property, and a distinct lock_writes_unverifiable repair. Any confirmed write resets it. Sync consults it so slots stop individually suspending for a lock-wide cause. Reuses the breaker primitive, not the instance — so backoff/recovery logic is shared but the two states stay distinct.
C — Just make the repair lock-scoped when several slots suspend for the same reason. Smallest change, but it would not have fired here: only slot 5 was syncing on each lock, so there was never more than one suspension to aggregate. The actual case disqualifies it.
★ Insight ─────────────────────────────────────
The reason B beats A isn't cosmetic. unreachable gates whether to attempt writes at all (sync.py:768); "unverifiable" shouldn't — the writes are landing, we just can't confirm them. Same trigger, opposite prescription. Collapsing them would stop LCM from writing codes that were actually working.
C failing on the real case is a good reminder to test a proposed heuristic against the incident that motivated it before designing around it.
─────────────────────────────────────────────────
Two judgment calls in B are genuinely yours, and they're where your domain knowledge beats mine:
User
I don't think adding yet another set of flags and properties is the answer. We've already made things more complex than they need to be I think and I think we're getting burned by the extra complexity
Assistant
You're right, and I think the evidence backs you up more strongly than I was treating it.
The #1397 loop isn't a missing feature — it's an emergent product of state we already have. Look at the asymmetry:
CONFIRMED write + empty read-back → tolerated, via the _last_set_pin escape hatch (sync.py:428)
OPTIMISTIC write + empty read-back → retried forever, because the is_verified gate (sync.py:418) returns first
That's backwards, and nobody designed it. "The lock said yes" gets leniency; "we couldn't tell" gets an infinite loop. The bug lives in the seam between two mechanisms that each make sense alone. A third breaker would add a seam, not close one.
So let me withdraw approach B. The fix should delete a path, not add one.
The state we need already exists.SlotCredential.unreadable() means precisely "something is here, we can't read it back." And the sync predicate already knows what to do with it (sync.py:432):
python
if not credential.is_readable:
return slot_state.pin_state == self._last_set_pin
So an unconfirmable write is already modeled. When a pending optimistic write times out, instead of charging the slot breaker and re-syncing, the slot could simply settle as unreadable — and everything downstream already works: a PIN change re-writes it, a restart re-writes it once, a clear still confirms normally. That's a deletion at sync.py:747-755 and no new flags, properties, or breakers.
But this collides with a decision you made deliberately, and I don't want to quietly reverse it. sync.py:722 says:
On timeout, count a breaker failure and fall through to re-sync — so a write the lock never committed ends in a visible suspend, never a silent in-sync.
The counter-argument is that unreadable isn't a silent in-sync — it's a distinct, visible state that says exactly the true thing. But that's your call, not mine.
And the genuinely simplest option deserves saying out loud: maybe nothing should change. LCM detected an unsyncable slot and told the user, and the existing text already reads "may be rejecting the code silently or experiencing communication issues." That was correct. The reporter's actual problem is a 49%-loss RF link. A reasonable outcome here is: reply to the issue, change no code.
So — which is it:
No code change. Close #1397 as a mesh problem; maybe sharpen the repair wording.
Delete the retry path, letting unconfirmable writes settle into the existing unreadable state — revisiting the "visible suspend" decision on purpose.
I lean 2 only if you think that decision is worth revisiting; otherwise 1 is honest and free.
User
wait so I thought the idea was an optimistic write should be unreadable - best case scenario we get a real value back, worst case scenario it stays unreadable. If we can't get the value back but the write was successful, the value will recover on a poll eventually right? so what scenario are we possibly false positiving with this approach?
Assistant
Sharp question — let me answer it directly by enumerating.
The key fact: unreadable and empty are different reads, and the false positive lives entirely in which one a failed write produces.
write landed?
what the read returns
today
under "optimistic ⇒ unreadable"
1
yes, lock reports it
known(pin)
in sync ✓
in sync ✓
2
yes, lock masks it (****)
unreadable()
in sync ✓
in sync ✓
3
yes, lock won't report it (#1397)
empty()
suspend ✗
in sync ✓
4
no — never landed
empty()
suspend ✓
in sync ✗
Scenarios 1 and 2 already work today — _pin_state maps a masked value to unreadable(), and sync.py:432 handles it. Your model is already implemented for those.
The false positive is row 4, and it's invisible because rows 3 and 4 produce an identical read. A lock that won't report a code it holds, and a lock that never took the code, both come back empty(). That's precisely why #1397 took this long — I couldn't separate them from the LCM diagnostics either, and it took the node statistics to do it.
On "the value will recover on a poll eventually" — that's the assumption #1397 falsifies. It did not recover:
The value DB served stale userIdStatus[5] = Available across 11 hours, multiple hard refreshes, and a fresh write attempt — byte-identical between the two dumps.
It couldn't recover, because recovery requires a successful read, and the reads are what's failing (~49% timeout). The failure mode kills its own recovery path.
So the recovery guarantee holds only when the link is healthy — which is exactly when we didn't need it.
★ Insight ─────────────────────────────────────
This is the same shape as your feedback_retry_recovery_signal_must_match_failure note: the recovery mechanism (poll until we see it) depends on the very channel that's broken. Any design that leans on "a later read will sort it out" inherits that circularity.
User
that could be interesting if we feel confident that we can tell when it is one scenario or the other
Assistant
That's the right bar to set. And I think the confidence question gets easier when you notice we don't need to separate rows 3 and 4 — we need to separate "comms" from "rejection," which is a different and much more tractable question, because transport health is directly observable rather than inferred from the slot.
Let me check what's actually available.
Assistant
Confirmed available live: node.statistics.timeout_response, commands_tx, commands_dropped_tx/rx, rtt, refreshed via handle_statistics_updated.
On your confidence bar — I think it's clearable, but only if we're careful about what we claim. Two versions, and the simpler one is better:
A — Report the measurement, don't classify.(Recommended.) The repair text gains one provider-supplied line of fact:
Z-Wave link: 126 of 256 commands to this lock timed out; last round-trip 1072 ms; route via node 11 at −88 dBm.
No threshold, no classification, no new state, no control-flow change — the provider hook is consulted only when composing text that already exists. Every other provider returns None and gets today's wording verbatim. Worst case it degrades to the status quo.
The reason I'd stop here: "126 of 256 timed out" is self-evidently damning to anyone reading it, and it would have collapsed this entire investigation into one glance. We don't need LCM to be right about the diagnosis if it just shows the number that makes the diagnosis obvious.
B — Classify (comms vs rejection). Sample timeout_response before the write and again at suspension, and branch the message on the delta. Higher confidence than a cumulative ratio, because a delta over our own window sidesteps both the FLiRS-baseline problem and stale history. But it needs a stored snapshot — i.e. exactly the new state you don't want — and the attribution is imperfect anyway, since the counters are node-wide and HA's own lock polling increments them too.
★ Insight ─────────────────────────────────────
The cumulative-vs-delta distinction matters more than it looks: 126/256 is lifetime since driver start, so a node that was bad last week and is fine now still reads 49%. A/B differ mainly in whether we're willing to store a snapshot to get a windowed number — and A dodges it by not asserting a conclusion.
Reporting raw facts also degrades gracefully in a way classification doesn't: if the numbers are ambiguous, a human sees ambiguity. A classifier would have to pick, and picking wrong is exactly the false-positive risk you've been guarding against all along.
─────────────────────────────────────────────────
Where I'd still hedge honestly: zero timeouts does not confidently mean "the lock rejected it." That's why A never says it — it shows the link numbers and leaves the existing hedged sentence alone. B would have to make that claim, and I don't think we can back it.
So my recommendation is A, and to leave the suspension logic entirely untouched.
User
we can just implement in a new branch and push a PR
Assistant
Approved — implementing A. Let me gather the exact details first.
Assistant
Scope: only the breaker-trip suspension (sync.py:790) — that's the one whose text hedges. The other two have definite causes. Setting up:
Assistant
Now the implementation — base hook first:
Assistant
Now the Z-Wave implementation:
Assistant
Now tests. Let me match the existing patterns.
Assistant
Now the tests — base default first:
Assistant
Now the Z-Wave provider tests:
Assistant
3 passing. Now the sync-side test — let me find how existing tests trip the breaker.
Assistant
All new tests pass. Now the full suite plus coverage, per your rule about not trusting a curated subset:
Assistant
100% coverage held, 1426 passed. Now pre-commit:
Assistant
All green — prek exit 0, 1426 passed. Committing:
Assistant
.entire/.gitignore was already modified before I started — unrelated, so I'll leave it out to keep the PR focused.
Appends it to the breaker-trip suspension repair (one call site)
Net: +207 lines, 4 of them production logic. No new state, no thresholds, no flags any decision reads — the hook is consulted only when composing text that already existed, so a provider returning None gets today's wording byte-for-byte.
The Z-Wave output reads:
Z-Wave link: 126 of 256 commands sent to this lock went unanswered since Z-Wave JS last started, and the last round trip took 1072 ms. A large proportion of unanswered commands points to a Z-Wave range or mesh problem rather than the lock refusing the code.
Scoped to the breaker-trip suspension only — the LockOperationUnsupported and unexpected-error suspensions already name their cause, so link stats would be noise there.
★ Insight ─────────────────────────────────────
The FLiRS discovery is what killed the classifier design: this lock's ~1s round trip is normal 1000 ms beam latency, not a symptom. Any fixed rtt threshold would have flagged every healthy FLiRS lock in every mesh. Reporting the measurement sidesteps calibration entirely — and degrades honestly, since ambiguous numbers read as ambiguous rather than forcing a wrong verdict.
Stating "cumulative since Z-Wave JS last started" in the copy matters more than it looks: 126/256 is lifetime, so a node that was bad last week and is fine now still reads 49%. Without that clause the message would mislead in exactly the cases it's meant to clarify.
─────────────────────────────────────────────────
Verification: 1426 passed / 3 skipped, coverage 100.00% (unchanged), prek --all-files exit 0. The formatter reflowed one line of mine on the first pass; re-run is clean.
Two things I deliberately did not do, so they're your call:
The PR doesn't close #1397. The reporter's actual problem is their mesh — a ~49% loss rate — not integration logic. I marked it "related to," not "fixes."
User
run code review on this PR. While that's going on, can we look at other places in the codebase where we may have overcomplicated an implementation detail when taking a step back like we did here was the better answer?
Assistant
I'll kick off the review first so it runs while we dig.
Assistant
Review is running as @code-review. Now the complexity audit — let me gather data rather than guess.
Assistant
_async_tick_impl at 278 lines is an outlier — and it's the function that contained the #1397 loop. Let me look for the specific pattern: mechanisms that accreted around a case the general model already covers.
Assistant
usercode_scan_interval shows only one reference — possibly vestigial. Let me check.
Assistant
All hooks are live — my regex undercounted. Let me focus on the strongest candidate: the write-confirmation lifecycle, which is what actually produced #1397.
Assistant
Confirmed a clean one. Let me check whether the same shape appears elsewhere.
Assistant
Here's the audit, with evidence. The review is still running as @code-review; I'll relay it when it lands.
Finding 1 — _verified is a set wearing a dict costume
coordinator.py:69 declares self._verified: dict[int, bool] = {}, but is_verified() (:177) is:
python
return self._verified.get(slot, True)
Absent and True are indistinguishable. So every self._verified[slot] = True (:157, and :267 when optimistic=False) is a no-op relative to .pop(). The dict encodes three states to represent two, and the two lockstep-filter comprehensions (:165, :269) exist to prune a map that only ever needs one kind of entry.
python
self._unverified: set[int] = set()
def is_verified(self, slot: int) -> bool:
return slot not in self._unverified
That turns "absent means verified" from a documented convention into a structural fact, and collapses the three branches of _apply_read into two. It's the only instance of this shape in the codebase — I checked, and zha.OPERATION_TO_LOCKED is a genuine lookup table, not state.
Finding 2 — _pending_writes is a private field with three mutators in three files
File
Operation
providers/_base.py:432
writes the entry
providers/_base.py:452, 1186, 1281
pops it
domain/coordinator.py:152
del self._lock._pending_writes[slot]
domain/sync.py:746
del self._lock._pending_writes[self._slot_num]
Two modules reach through self._lock. into another object's underscore-private and delete from it. Nobody owns the invariant, and the "did our write land?" decision is spread across BaseLock, LockUsercodeUpdateCoordinator, and SlotSyncManager — each holding one third of it.
Assistant
Review is in. Before acting on any of it, let me verify the factual claims — several are assertions about driver internals I can check directly.
Assistant
Before implementing, let me verify the claim — and check whether this is pre-existing or only in #1410's code, since that determines what a separate PR can even branch from.
Assistant
Confirmed — self.node raises LockDisconnected by design. Now the call path:
Assistant
Finding 1 is confirmed: _async_tick has only try/finally (no except), and describe_link_health() is called at line 786 — before the try at 807. An exception there means _suspend_slot never runs.
One complication before I open a PR — let me check whether this is pre-existing anywhere:
User
[Request interrupted by user]
User
when I say do finding 1 in a new PR, I am talking about changing the verified dict to a set. Let's table everything I've asked you to do except for the review for now just to keep things less complicated
Assistant
Understood — tabling the _verified→set PR and the other-provider research. Focusing only on the review of #1410.
I've confirmed review finding 1 is real. Now let me verify findings 2–5, which are all factual claims about driver internals:
Assistant
All five findings verify against the source of truth:
Claim
Verdict
Evidence (NodeStatistics.ts)
2 — commandsTX excludes unsent
Confirmed
:47 "commands successfully sent"; :54 dropped "because they could not be sent"
3 — rtt is an EMA average
Confirmed
:59-61 "Average… exponential moving average"
4 — numerator is Get-only
Confirmed
:55 "No. of Get-type commands"
5 — window overstated
Confirmed
:44 "since the last reset or driver startup"
Finding 2 is the serious one: on an out-of-range lock the failures land in commandsDroppedTX, so my sentence would print "0 of 20 unanswered" and then assert a mesh problem — pointing the reader at the wrong cause in exactly the scenario the feature exists for. Fixing:
Assistant
The working tree got switched back to main — that's why the method vanished. Let me restore the branch:
Assistant
Back on the branch (the review agent had created a pr-1410 checkout). Now applying the fixes:
Assistant
Now updating the tests to match, plus the two new cases the review exposed:
Assistant
Let me simplify that last test — the property-throwing lambda is unnecessarily clever:
Assistant
All 5 pass. Now the full suite, coverage, and pre-commit:
Assistant
Review addressed and pushed to #1410. All five findings were legitimate — I verified each against NodeStatistics.ts rather than taking them on faith, and all four factual claims about driver internals held up.
What changed
Finding 2 was the serious one.commandsTX counts only commands successfully sent (:47); one that can't be sent increments commandsDroppedTX (:54). So an out-of-range lock — the exact scenario this feature exists to expose — would either return None (early return keyed on commandsTX) or print "0 of N unanswered" followed by an assertion that the mesh is fine. It steered the reader to the wrong cause at the worst moment.
Both counters are now reported and either one alone triggers a description.
Findings 3–5 were accuracy problems in the copy, which matters unusually much here since the sentence's only job is settling a diagnosis:
rtt is an EMA (:59-61), so "the last round trip took" was plain wrong — one old outlier holds it up long after recovery. Now "recent round trips averaged".
timeoutResponse is Get-only (:55), so the ratio mixed populations and understated failures on a write-heavy lock. The ratio is gone; counters stand alone.
Counters reset on demand too (:44), so the window wording was too narrow.
Finding 1 — the crash path — was real and I confirmed the trace independently: describe_link_health() is called at sync.py:786, ahead of _async_tick_impl's try at 807, and _async_tick has only try/finally with no except. A LockDisconnected there skips _suspend_slot entirely: no repair created, state stuck OUT_OF_SYNC, same failure every tick. Now guarded, matching async_is_device_available's existing pattern.
New output:
Z-Wave link, counted since Z-Wave JS started or the statistics were last reset: 256 commands reached this lock, 4 could not be sent at all, and 126 read requests went unanswered; recent round trips averaged 1072 ms.
★ Insight ─────────────────────────────────────
Finding 2 is a sharp instance of a general trap: I picked commandsTX as a denominator because the name reads like "commands we tried to send," but it means "commands that succeeded." Any metric whose name describes intent while its implementation records outcome will silently invert exactly when things go wrong.
User
ok now research other provider link health stuff and add it if we have it
Assistant
Let me research each provider concretely rather than assume.
Assistant
Right — reachability from the provider matters as much as existence. Let me check the libraries directly.
Assistant
ZHA is reachable — the provider already resolves zigpy_device. Let me confirm what that object actually carries, then check the others.
Assistant
ZHA confirmed. For Matter the real question is whether those attributes are actually populated in practice — let me check against a real node fixture.
Assistant
Matter nodes carry real diagnostics clusters (68 Thread attributes on this lock fixture). Let me see which are actually populated and useful:
Assistant
Matter has the counters but they're optional per spec (gated on PKTCNT/ERRCNT feature bits) and all-zero in the only fixture — I can't validate semantics without a real device. Let me check the remaining providers.
Assistant
Conclusion is forming. Let me confirm the ZHA reach path and the exact semantics of those attributes before writing anything.
Assistant
The cached cluster gives me the device for free — let me verify the zigpy object graph:
Assistant
cluster.endpoint.device is fully public — no new state needed. Checking for an HA helper to express staleness:
Assistant
Everything verified. Implementing ZHA only:
Assistant
Let me use the public setter instead of reaching into a private:
Assistant
Researched all six providers against their underlying libraries. One had usable data; I added it. Three didn't; one I deliberately skipped.
Added — ZHA
Zigbee has no per-node failure counters (zigpy keeps counters on the radio application, not per device), so it reports the other honest signal:
Zigbee link, from the last frame this lock sent: signal quality 12 of 255, −89 dBm, last heard from 3 hours ago.
Reachable with no new state: cluster.endpoint.device off the already-cached DoorLock cluster — both accessors verified public in zigpy. lqi/rssi/last_seen all live on zigpy.Device (:98, :99, :222).
Staleness does the real work here. A lock unheard-from for hours while LCM is writing to it is the Zigbee equivalent of an unanswered-command count, and it survives radios that report no signal metrics — so each value is emitted only if present.
Deliberately skipped — Matter
This is the judgment call worth flagging. Thread/WiFi diagnostics clusters are subscribed — the lock fixture carries 68 Thread attributes including TxAckRequestedCount/TxAckedCount, which is exactly the sent-vs-acknowledged signal I'd want. But:
the packet/error counters are optional per spec, gated on the PKTCNT/ERRCNT feature bits
every one reads 0 in the only fixture available, and WiFiNetworkDiagnostics has just WiFiVersion populated
I can't tell whether that's the mock or real device behavior. Shipping on it would risk printing "0 of 0 commands" plus a confident mesh assertion — the precise failure the review just caught in the Z-Wave version. Needs real hardware to validate first.
Not available
zigbee2mqtt — publishes linkquality, but the provider doesn't retain it; capturing means new per-lock state for a point-in-time value with no staleness signal
Schlage / Akuvox — cloud APIs, no radio telemetry
virtual — nothing to measure
★ Insight ─────────────────────────────────────
The three transports give structurally different evidence: Z-Wave gives cumulative failure counts, Zigbee gives a point-in-time sample plus staleness, Matter would give . That's why a shared numeric metric on would have been wrong — a field would have forced all three into one scale that means something different in each. Returning a sentence lets each say the true thing.
User
you could get info from my matter lock in my HA production instance
Assistant
Good — that would settle whether those counters are real. Let me look, read-only.
Assistant
Matter Server 9.2.0 plus an OpenThread Border Router — so the lock is likely Thread, exactly the diagnostics cluster in question. Let me query the Matter server directly, read-only.
Assistant
Let me use both — MCP for the device identity, SSH for the raw node attributes (which aren't exposed as entities).
Assistant
snapshot.json.gz holds the node state. Pulling it to analyze locally — I'll only read diagnostics clusters, not credential data.
Assistant
peer2 = the lock (cluster 257 DoorLock) on Thread (cluster 53). Let me read its Thread diagnostics:
Assistant
Real hardware, and the counters are not zero — this settles it. But before drawing conclusions, let me check freshness (the WAL has 15k updates after this snapshot):
Assistant
Snapshot ts is 00:04:14 — written minutes ago and newer than the WAL's last entry, so this is current. Let me verify the attribute IDs against the spec library rather than trusting my memory of the numbering:
Assistant
Verified against the spec library — and the user's lock shows genuinely interesting numbers (228 detachments, 3,216 unacknowledged transmissions). Matter is viable. Let me check the provider's attribute-read API:
Assistant
That's the authoritative HA-side view — Aqara Smart Lock U300, Thread, and 0/53/65532 = FeatureMap 15 (all counter features present). It confirms the snapshot exactly.
Let me find how the provider reads attributes:
Assistant
_resolve() never raises — ideal seam. Let me check the attribute-read signature:
Assistant
Let me use typed attribute classes rather than magic ints — safer and self-documenting. Checking how the provider already references clusters:
Assistant
cluster=None requires a class, and this file uses raw cluster IDs by convention. Matching that style:
Assistant
Now tests, using the real values from your lock:
Assistant
The trailing explanatory sentence contains "unacknowledged", so my assertion was too broad. Fixing the assertion:
Assistant
Coverage dropped to 99.94% — 3 uncovered lines. Let me find them:
Assistant
Lines 1141-1147 are the exception handler. Adding a test for it:
Assistant
The matter provider uses LOGGER, not _LOGGER — the exception path was broken and only the coverage gap revealed it:
Assistant
Back to 100%. Committing:
Assistant
The formatter conflicted with the unstaged .entire/.gitignore. Let me format explicitly, then commit:
Assistant
Your production instance settled it — Matter is viable, and my earlier "skip it" call was wrong.
What your lock actually reports
Aqara Smart Lock U300, node 3, Thread. 0/53/65532 = FeatureMap 15 — all four counter features present. The counters are richly populated:
Attribute
Value
TxAckRequestedCount (0/53/25)
3,611,401
TxAckedCount (0/53/26)
3,608,185
DetachedRoleCount (0/53/14)
228
AttachAttemptCount (0/53/18)
1,925
NeighborTable
LQI 3/3, avg RSSI −77 dBm, frame error rate 10
I cross-checked two independent sources — the Matter Server's own snapshot.json.gz (pulled read-only over SSH) and the device diagnostics you pasted — and they agree exactly, so this isn't a stale artifact.
Implemented as:
Thread link, from the lock's own radio counters since it last restarted: 3608185 of 3611401 transmissions that asked to be acknowledged were acknowledged, and the lock has dropped off the Thread network 228 times.
★ Insight ─────────────────────────────────────
The acknowledgement pair is the one clean ratio in that cluster: TxAckRequested and TxAcked are drawn from the same population, so dividing them is legitimate. Most other pairs there (TxTotalCount vs anything) count different traffic — the identical trap the review caught in the Z-Wave version. I only paired the two that survive that check.
I read each counter independently and drop absent ones, rather than decoding FeatureMap bits. Your lock has all four features so I couldn't have empirically validated a bit→attribute mapping anyway — reading and checking for None sidesteps a table I'd have been guessing at.
─────────────────────────────────────────────────
One real bug caught by chasing coverage: the matter provider uses LOGGER, not _LOGGER. My exception handler referenced _LOGGER and would have raised NameError — turning a swallowed diagnostics failure into the exact crash-instead-of-repair defect the review flagged for Z-Wave. Coverage dropped to 99.94%, the missing lines were the handler, and writing the test exposed it.
Also worth noting for your mesh: 228 detachments and 1,925 attach attempts is a lot of Thread instability on that lock, and its parent link sits at −77 dBm. Unrelated to LCM, but it's the sort of thing this feature is meant to make visible.
Verification: 1,439 passed / 3 skipped, coverage 100.00%, prek exit 0. Four commits on #1410, description updated.
if code_slot.get(ATTR_IN_USE) is not True: continue
in_use
False
A load-bearing assumption in the code is falsified in the field.zwave_js.py:625-635 justifies mapping credential_rejected_unknown → OPTIMISTIC with: "there the write actually succeeded (userIdStatus -> Enabled)". This lock returns ERROR_UNKNOWN and leaves userIdStatus at Available. So LCM grants optimistic-success to a write that genuinely did not land, then loops to the breaker.
Their driver is 15.24.2 — below both thresholds the provider documents: 15.24.3 (UC dispatch #8879, delete cache-clear #8866) and 15.25.2 (supervised UC writes persist, #8927). zwave_js.py:427 already tells users to update, but only fires when num_slots == 0.
★ Insight ─────────────────────────────────────
Your earlier self-correction on the issue was the right call: the two hypotheses were genuinely indistinguishable in the LCM diagnostics, and this one field separated them. #1408 is still a real fix — just for a different lock's failure mode, not this one.
The bug now has the shape your memory flagged in feedback_retry_recovery_signal_must_match_failure: the recovery signal (optimistic-then-verify) doesn't match the failure mode (write silently not landing), so retrying can never converge.
─────────────────────────────────────────────────
One thing I'd verify with the reporter before building anything: their "it does work" is ambiguous — it may mean the slot works in LCM's UI rather than the PIN opening the door. If the PIN was never actually keypad-tested, the write is simply failing and the real bug is that LCM reports it as a breaker trip instead of a rejection.
I have not posted anything to the issue — that's yours to send. The fix direction is a real fork:
not
★ Insight ─────────────────────────────────────
The absence of Supervision CC is what makes this lock fragile: supervised locks get an authoritative success/fail from the device, while unsupervised ones are judged by an immediate read-back — so a lock that's slow or lies on read-back is structurally unconfirmable.
This also sharpens why the zwave_js.py:625-635 comment is wrong. It assumes ERROR_UNKNOWN implies "write succeeded, userIdStatus → Enabled." But for a v2 lock, ERROR_UNKNOWN fires when either status or code mismatches — so "status went Enabled" is precisely what it does not guarantee. _uc_slot_in_use() already distinguishes the two cases.
─────────────────────────────────────────────────
So the fix is LCM-side, and it isn't driver-version-scoped
It targets a device-behavior class — locks that fail post-write read-back verification — not old drivers. Any driver version, present or future, hands LCM the same Error_Unknown for this lock.
One fork still genuinely open, and it decides which fix: does slot 5's PIN actually open the door? The reporter's "it does work" may just mean the slot renders in LCM.
If the PIN works → the lock accepts codes it won't report. Fix = tolerate: don't let an unconfirmable slot run to suspension.
If the PIN doesn't work → the write is genuinely failing and LCM is disguising a real rejection as a retry loop. Fix = fail loudly: when _uc_slot_in_use() is False after ERROR_UNKNOWN, raise CodeRejectedError instead of returning OPTIMISTIC.
Both are one-line-ish changes in the same branch, but they're opposite behaviors, so it's worth one question to the reporter. Want me to draft that reply — short, in your voice — or start on one of the fixes?
4.4.2 can't help: _overlay_uc_occupancy needs in_use is True, and the stale value DB says Available.
A driver upgrade won't help either — none of #8884 / #8927 / #8879 / #8866 touch a timed-out verification GET.
★ Insight ─────────────────────────────────────
The absence of Supervision CC is what makes this lock fragile on a bad link. A supervised lock gets an authoritative success/fail from the device in the same transaction; an unsupervised one is judged by a second round trip — so a 49% loss rate becomes a ~49% chance of "unverifiable" on every single write, no matter how healthy the lock is.
Diagnostics were pointing at the wrong layer the whole time. The user-code table looked like a lock/firmware story; the statistics block three keys over said "your mesh is dropping half the traffic." Worth reading node statistics first on any never-converges report.
─────────────────────────────────────────────────
Two separate outcomes
For the reporter: the fix is their mesh, not our code. rtt >1s, repeater RSSI -88, a recorded route failure, and 49% sustained timeouts is a marginal link. Better repeater placement / re-running a network heal should resolve it outright.
For LCM: there's still a real gap. coordinator.unreachable is binary and this node is Alive, so the degraded-lock path (_base.py:542) never engages for a node that's reachable but drops half its responses — LCM converts a transient comms problem into a permanent slot suspension. The suspension text already hedges ("may be rejecting the code silently or experiencing communication issues"); we have the data to know which, and shouldn't be guessing in user-facing copy. That connects to your existing project_degraded_lock_followups thread.
Memory updated with the full trace. Want me to draft the reply to flyize (short, mesh-focused, in your voice), or start scoping the degraded-link handling as its own issue?
The trip threshold and window. The slot breaker is 3-in-5-min. Should the lock-level verify breaker be the same, or slower (this should be rarer and more confident before it accuses someone's mesh)?
What the slot does while the lock is flagged. Stop retrying entirely, retry on the lock backoff, or keep the current per-slot behavior and only change the messaging?
Want me to write these up as a spec (locally, uncommitted per your usual practice) with my recommendation on both, or would you rather settle those two now so the spec reflects your call?
Also worth noting: OPTIMISTIC doesn't mean "the write succeeded." In #1397 it came from the driver's verification GET timing out — pure absence of information. The code comment at zwave_js.py:625 that claims it implies userIdStatus → Enabled is the falsified assumption underneath this whole thread.
─────────────────────────────────────────────────
So the real decision is which error you'd rather ship, since LCM can't tell 3 from 4:
False "it's fine" (row 4 masked): someone's code silently doesn't work and LCM reports synced. On a door lock, that's someone locked out with no signal.
False "it's broken" (row 3 today): a working code shows a repair. Annoying, safe, and self-correcting once the mesh is fixed.
That asymmetry is why I'd keep it loud — and it's the same instinct behind your existing fail-loud-on-unencodable-identifier rule.
Which suggests the minimal, no-new-state change is just to make the message earn its keep: today it guesses ("may be rejecting the code silently or experiencing communication issues"). Want me to look at whether the provider can cheaply say which — Z-Wave already has timeout_response/rtt on hand — so the repair names the real cause instead of hedging?
Want me to write that up as a spec (locally, uncommitted per your usual practice), or is this small enough to go straight to a plan?
No reply posted to the issue. flyize is still waiting, and the substance is ready: the write reaches the lock (PIN works), the driver's verification read times out, the value DB keeps serving stale Available, 4.4.2's fix can't fire because it needs in_use is True, and a driver upgrade won't help since none of #8884/#8927/#8879/#8866 touch a timed-out verification GET. Want me to draft that — short, mesh-focused?
One note: .entire/.gitignore was already modified before this session, so I left it out of the commit. It's still uncommitted in your tree.
That is exactly the seam #1397 lived in. Tracing the non-convergence required reading all three files and reconstructing an interaction none of them state.
Finding 3 — the is_verified gate is ordered ahead of the escape hatches it should compose with
calculate_in_sync (sync.py:418) short-circuits before the credential logic at :423-433:
python
if not self._coordinator.is_verified(self._slot_num):
return False # <- returns here
...
if credential.is_empty:
return self._last_set_pin is not None and slot_state.pin_state == self._last_set_pin
Same physical situation — we wrote PIN P and the lock reads empty — resolves two ways:
after a CONFIRMED write → mark_verified pops the flag → reaches the escape hatch → in sync
after an OPTIMISTIC write → flag is False → returns at the gate → re-sync → breaker → suspend
The escape hatch exists for eventual consistency ("the lock hasn't caught up"). That rationale applies identically in both cases. What actually differs is how confident the provider was — and the gate's placement lets that override the eventual-consistency rule entirely. Nobody designed this; it fell out of the ordering.
★ Insight ─────────────────────────────────────
Findings 2 and 3 are the same disease: the write-confirmation lifecycle has no single owner, so its rules got expressed as guards at whatever call site noticed them. Guards compose by ordering, and ordering is invisible when the pieces live in three files.
Note that finding 3 is the one we actually stepped back on today — and the step-back answer wasn't "add a rule," it was "these two paths should never have disagreed."
─────────────────────────────────────────────────
Two negative results worth recording
No dead provider hooks. All 9 overridable BaseLock properties have live consumers; my first pass undercounted usercode_scan_interval because of a regex, and it's used at coordinator.py:53.
_async_tick_impl is long but not tangled. 278 lines and 15 returns, but the skeleton is flat guard clauses at depth 0–1, max nesting 3. Long ≠ complex; I wouldn't touch it, and splitting it would likely make the ordering harder to see.
Also worth leaving alone: the User Code CC report shim. It looks like accidental complexity but it's the opposite — documented sunset condition, removal recipe in the block comment, and it self-deactivates upstream. That's complexity being managed properly.
If you want to act on any of these, Finding 1 is a contained mechanical refactor (~6 sites, no behavior change) and would make a clean standalone PR. Findings 2 and 3 are the substantive ones but they change convergence behavior, so they'd want their own design pass — and 3 in particular is the open question we deferred earlier about whether an unconfirmable write should settle rather than suspend.
Note that findings 2 and 4 both dissolved with the same fix — dropping the ratio. Two distortions in a derived number, zero in the raw counters. That's the same "report the measurement, don't classify" principle the design started from; I'd half-abandoned it by computing a rate.
─────────────────────────────────────────────────
Verification: 1428 passed / 3 skipped, coverage 100.00%, prek exit 0. Two new tests cover the cases the review exposed — out-of-range (commandsTX=0, dropped>0) and an unresolvable node.
Also worth flagging: the working tree had been switched to main by the review agent's pr-1410 checkout, so my branch's changes briefly appeared missing. Restored; nothing lost.
Still tabled per your instruction: the _verified dict→set PR, and the other-provider link-health research.
device-side self-report
BaseLock
link_quality: float
Skipping Matter is the same discipline as dropping the ratio: the review's lesson was that a number whose semantics you haven't verified is worse than no number, because it arrives wearing the authority of a measurement.
─────────────────────────────────────────────────
Verification: 1432 passed / 3 skipped, coverage 100.00%, prek exit 0. Four new ZHA tests (full metrics, staleness-only, nothing-measured, unresolvable cluster). PR description updated to document both implementations and the exclusions with reasoning.