Repository navigation
Stop the lock fingerprint retry loop instead of slowing it - #12461
alanwcurry-dev wants to merge 1 commit into
Conversation
Automated AI review
Verified: in source review, the change bounds the fingerprint retry loop as described. Remaining points are the pause notice presentation, a narrower re-arm than the code comment states, and one suspend/resume path worth testing on hardware. Details, from head
Pause notice is cut off in the password field
The estimate uses JetBrains Mono's 0.6 em advance. The exact cut point depends on installed font metrics and was not checked in a running lock; at default sizing the notice fits only if glyphs average about 0.30 em or less. The notice also drives Impact: the user sees that fingerprint paused but not how to resume it, and an unattended lock looks like a failed login. Suggested change: shorten the in-field text to about 24 characters (for example "Fingerprint paused"), or show the notice as a separate line outside the field with neutral styling. Deliberate input refreshes the budget only after it is exhaustedThe comment on Impact: a user who returns during the last session can see the pause notice appear shortly after interacting. Suggested change: reset Worth testing: suspend and resume can end in the paused stateTraced in source; how often it happens depends on timing and was not observed:
Impact if it occurs: after closing and reopening the lid, touching the reader does nothing until a key press or click. Suggested change: check the journal for Documentation note: the comment on Click re-arm note: a left click on the password input itself is accepted by the Design note: the lock blanks displays 5 s after locking. After about 3 minutes on a press reader, touching the reader on a dark screen does nothing until a key press, click or typing. This follows from the stop-instead-of-slow design; stating it in the description would help maintainers weigh it against a capped slow re-arm. Review informationTest scope: source review of head AI process: Opus 5.5 Medium coordination and synthesis; independent Opus 5.5 Xhigh and GPT 6 Sol Xhigh technical assessments, with targeted follow-ups to cross-check single-reviewer points; Opus 5.5 Medium editorial check. Opt out: To stop receiving these reviews, reply to this comment saying so. |
|
Merged #7158 resolves repeated immediate-error storms with capped backoff and unavailable feedback. It preserves healthy scan-timeout retries, so the proposed six-attempt terminal state and deliberate-input re-arm policy remain distinct. Keeping this open for the unattended scanning policy; please rebase the shared retry path. GPT-6 in Codex and Claude Opus 5.5 Medium checked the coverage against the landed source; Claude's agreement does not guarantee independence. This closure review was read-only and did not rerun runtime tests. |
|
A data point for the unattended-scanning policy, from a 2017 Touch Bar MacBook Pro (MacBookPro14,3) where Touch ID goes through T1Bridge. There, the healthy scan-timeout retries that #7158 deliberately keeps are exactly what breaks the reader. Each lock-fingerprint session makes T1Bridge stop and restore its keybag relay, which reloads the keybag into the T1's Secure Enclave. With the lock left alone, it starts a new session every ~31 s. Twice on Oct 9, with nobody touching the machine and no suspend, the Secure Enclave started rejecting the keybag after 23 and 34 minutes of lock (43 and 65 clean rounds). After that every fingerprint request fails instantly (the Touch Bar prompt either flashes and disappears or doesn't show at all), and it took a full power-off to bring the Secure Enclave back both times. Details are in standardagents/t1bridge#14 (comment). That's a T1Bridge bug, but the trigger is the endless re-arm. Tuning PAM didn't help: setting A budget like this PR's would cap an unattended lock at six sessions, well short of where the wedge shows up. I haven't run this branch myself. |
|
Following up on my earlier comment: I tested this on that MacBookPro14,3 (T1Bridge Touch ID), and it kept the wedge away. I applied this PR's diff at Then I locked it and left it alone for just over an hour, no suspend, no lid events:
So on T1 hardware the budget is the difference between Touch ID working in the morning and needing a full power-off. I haven't tested the suspend/resume path the community review flagged. |
f5124c9 to
e84c778
Compare
|
Rebased onto the current This is a rework rather than a literal conflict resolution. The shared retry path is now The review items, in order:
One thing the seeded tests caught and this commit carries: the lock service's Quickshell harness asserted that a long run of reached attempts keeps retrying, which is exactly what the budget ends. It now asserts the pause instead (spends the budget, leaves the sensor unarmed, spends nothing on an attempt that never reached the reader, and does not arm a retry from a settle while paused). Also: @makoni — thank you for the T1Bridge measurement; it is the strongest evidence in the thread and it is why the budget stays this narrow: reached-device attempts only, so a reader that is genuinely unavailable is still found again. What this does not have: a re-taken runtime trace on hardware after the rewrite. The unit tests, the lint comparison and the preview render are what I have; the measured session counts are from the original build. |
|
| if (fingerprintPaused) { | ||
| fingerprintPaused = false | ||
| fingerprintUnattended = 0 | ||
| logEvent("fingerprint-rearmed: resume") | ||
| } |
There was a problem hiding this comment.
restartFingerprintAfterSleep() clears the pause after any timer gap over three seconds, not just suspend. If waking a blanked display stalls the compositor past that threshold, the paused reader gets another six attempts without deliberate input. Repeated stalls can keep granting fresh attempts.
Keep timer gaps from clearing the unattended budget; use a confirmed resume event for that exception.
| if (fingerprintPaused) { | ||
| fingerprintPaused = false | ||
| fingerprintUnattended = 0 |
There was a problem hiding this comment.
The resume path resets fingerprintUnattended only when the reader was already paused. If five attempts have finished and the sixth has prompted when the machine suspends, resume aborts that session and calls settleFingerprintAttempt(). That spends the sixth slot and immediately pauses the reader instead of restarting it. The user must press a key or click before trying their finger.
Reset the count before settling a session interrupted by suspend.
| anchors.top: inputField.bottom | ||
| anchors.topMargin: 18 | ||
| anchors.horizontalCenter: inputField.horizontalCenter | ||
| visible: root.fingerprintPaused && !root.fingerprintUnavailable |
There was a problem hiding this comment.
Restart instructions disappear
fingerprintPausedNotice is hidden when fingerprintUnavailable is true, but those states can occur together. Six attempts that prompt and then fail quickly spend the budget while also marking the reader unavailable. Retries stop, and the visible message does not tell the user how to restart them—even after the reader recovers.
Show the restart instruction whenever fingerprintPaused is true.
omacom#7158 paced the failures that never reach the reader, but an attempt that *does* reach it and finds no finger is the healthy case there, so it keeps the fast retry and the loop never ends: a press-type reader is re-armed every scan window for as long as the machine stays locked. On the reference machine (FocalTech FT9365, press sensor) three unattended nights produced 70, 1348 and 3680 lock-PAM sessions, 2972 of them inside a single hour (omacom#9905), and the same endless re-arm wedges T1Bridge readers until the machine is power cycled (standardagents/t1bridge#14). Bound the loop at the reader instead of slowing it: - attempts that reached the reader are counted (UNATTENDED_BUDGET, 6), and the budget is terminal: the sensor pauses and stops being armed; - deliberate input - a click, a tap or click in the password field, a keystroke, typing - hands it a fresh budget, rate-limited to one decision per cooldown so a typing run does not count as a new decision per keystroke, and it clears the count whether or not the sensor had paused, so a budget spent before the user came back cannot pause in front of them; - a resume clears a pause: the machine comes back under someone who is about to touch the reader, and one budget per wake keeps the bound across a night of suspends; - while paused the lock says so, below the field rather than inside it, because the field's single line elides the sentence and its error styling would read as a failed login on a lock that is only waiting. An attempt that never reached the reader is unchanged: it keeps its backoff and its unavailable notice, and keeps retrying, because that is how a reader that comes back is found again. The policy is unit-tested in test/shell.d/lock-fingerprint-retry-test.sh, including an unattended reader that must stop after exactly the budget and an unreached reader that must not, and the lock service's own quickshell harness (spends the budget and pauses) carries the same two cases.
e84c778 to
c439beb
Compare
The problem
shell/plugins/lock/Service.qmlat the currentquattrotip still armsomarchy-lock-fingerprintevery scan window for as long as the machine is locked, whatever #7158 did in between: an attempt that reaches the reader and finds no finger is the healthy case there, so it keepsMATCH_RETRY_MS(250 ms) and the loop never ends. On a press-type reader each arm waits ~30 s for a finger, so an unattended lock is never idle.Measured on the reference machine (ASUS ExpertBook, FocalTech FT9365
2808:a57a, press sensor, one enrolled finger), fromjournalctl:The last night contains a single hour with 2972 sessions; 71% of consecutive sessions are under 0.5 s apart, the rest ~30 s apart — burst plus idle wait, the same shape @CoreyH reported in #11918 and the same loop @kirkules1000010 traced into a battery that flattened overnight. @makoni reports the same endless re-arm wedging a T1Bridge reader's Secure Enclave until the machine is power cycled (standardagents/t1bridge#14).
The change
Bound the loop at the reader instead of slowing it. An attempt that never reaches the reader already has its own pacing, so this only ends the scanning loop:
FingerprintModel.UNATTENDED_BUDGET, 6). Spent, the sensor pauses and is no longer armed.INTERACTION_COOLDOWN_MS) so a typing run is one decision rather than one per keystroke, and clearing the count even when the sensor is not paused, so a budget spent while the user was away cannot pause in front of them the moment they come back.status()gainsfingerprintPausedandfingerprintUnattended.Unchanged on purpose: an attempt that never reached the reader keeps its backoff, its unavailable notice and its retries, because that is how a reader that comes back is found again, and #12420's blank gate is the right fix for a display that is blanked regardless. This PR no longer makes promptless failures terminal — that is the one part of the original proposal that #7158's settled model covers differently.
Cases
fingerprint-paused: budget exhausted after 6 attempts(unit-tested)fingerprint-rearmed: interaction, fresh budgetWhat was verified
test/shell.d/lock-fingerprint-retry-test.sh(extended, not a new file): an unattended reader must stop after exactly the budget and an unreached one must not, deliberate input refreshes once per cooldown, and a static check holds pointer motion off the re-arm path.test/shell.d/fixtures/lock-fingerprint-service/shell.qml) was updated for the pause and passes its 41 checks: a run of attempts that reached the reader must spend the budget and leave the sensor unarmed, an attempt that never reached the reader must spend nothing of it, and a settle while paused must not arm a retry.common the category lists is empty;LockView's six warnings are its unresolved project types under a bareqmllint).TapHandlerpolicy, which takes only a passive grab on press (qquicktaphandler.cppcallssetPassiveGrabforDragThreshold, andsetExclusiveGrabonly for the other policies), so the input keeps the press for its own cursor placement.Not verified: a full locked cycle on hardware after this rewrite. The session counts above are from the original build of this change, measured while it lived in a plugin clone; the accounting and pause logic are the same, but the running trace has not been re-taken, and I would rather say so than imply otherwise.