Skip to content

Bound fingerprint retry attempts with exponential backoff (#13748) - #13819

Closed
szaidi-code wants to merge 1 commit into
omacom:quattrofrom
szaidi-code:fix/fingerprint-retry-backoff-13748
Closed

szaidi-code wants to merge 1 commit into
omacom:quattrofrom
szaidi-code:fix/fingerprint-retry-backoff-13748

Conversation

@szaidi-code

Copy link
Copy Markdown
Contributor

Summary

Fixes #13748.

When the lock screen is left locked on machines with fingerprint readers configured, Service.qml previously retried authentication unconditionally on every failure and PAM error every 250ms with no retry ceiling and no backoff. When sensors report persistent errors (such as Broadcom or libfprint-tod thermal protection), this created an unbounded retry storm (e.g. over 100,000 attempts overnight) that overheated and disabled the sensor.

Changes

  • Bound consecutive fingerprint retry attempts to a maximum of 15 attempts.
  • Apply exponential backoff to fingerprintRetryTimer.interval from 250ms doubling up to 4000ms.
  • Guard fingerprintPam.onError and handleFingerprintFinished() failure branches with fingerprintRetryTimer.attempts < 15.
  • Reset attempt counts and backoff interval to baseline (250ms) on:
    • Fresh lock initiation (resetAuthenticationState())
    • Successful fingerprint unlock (result === PamResult.Success)
    • Screen wake / user interaction (runWake()) if attempts were previously exhausted, re-enabling authentication when the user returns to the machine.
  • Add regression test coverage in test/shell.d/lock-blank-fingerprint-test.sh.

@sanjyay

sanjyay commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

Independent community review

This is an independent community review and unaffiliated with the Omarchy team, intended to help prepare PRs for their review.

Tested: Fingerprint retry timing, exponential backoff progression, attempt capping, recovery on user wake (runWake()), and lock test suites in an isolated Omarchy test VM environment.

Result: The changes function cleanly as intended:

  • Baseline origin/quattro: Service.qml retries fingerprint authentication unconditionally on error or failed match at a fixed 250ms interval without an attempt ceiling or backoff, allowing runaway retry loops when sensors trigger thermal or persistent communication errors.
  • On PR branch pr-13819 (2759e7b):
    • Retries are capped at 15 attempts, preventing continuous polling storms on hardware that has entered error/cooldown states.
    • Backoff scales interval smoothly from 250ms doubling up to 4000ms (Math.min(4000, interval * 2)).
    • Attempt counts and intervals reset to baseline on fresh lock initiation (resetAuthenticationState()) and successful unlocks.
    • In runWake(), if retries were previously exhausted (attempts >= 15), screen wake resets attempts and interval back to baseline and triggers startFingerprint(), seamlessly restoring fingerprint authentication when the user returns.
  • Regression assertions in test/shell.d/lock-blank-fingerprint-test.sh and compositor-backed sensor checks in test/shell.d/lock-fingerprint-indicator-test.sh pass cleanly.
Testing details
  • Tested PR commit: 2759e7ba9e08a0650728bd4b3a6e2590409ac53d
  • Test suites:
    • bash test/shell.d/lock-blank-fingerprint-test.sh: 6/6 passed (including bounded retry limit and exponential backoff interval checks).
    • WAYLAND_DISPLAY=wayland-1 XDG_RUNTIME_DIR=/run/user/1000 bash test/shell.d/lock-fingerprint-indicator-test.sh: passed.
    • git diff --check origin/quattro: clean.

If you'd prefer not to receive these independent reviews on your PRs, reply to this comment, and I won't review your future PRs.

@jandrusk

jandrusk commented Oct 1, 2026

Copy link
Copy Markdown

The cap + exponential backoff (250→4000ms, max 15) is the right shape for #13748, and resetting on success / fresh lock / wake after exhaustion looks correct.

Please coordinate with the older fingerprint-retry cluster before this lands alone: #10393 (cap + closed-lid skip + polkit/sudo PAM silence), #11918 (backoff on immediate fail), and #12461 (stop the loop rather than only slow it). Those cover cases this PR does not (lid closed, polkit). Prefer one canonical fix, or stack the missing pieces onto this one.

@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed by Opus 5.5 in Claude Code, with Codex Medium as a second opinion that read all the competing diffs separately and reached the same conclusion. Neither model ran the change on a worker: once a competing fix had already been chosen, verifying this one would not have changed what happens to it.

This fixes the retry storm from #13748, but it is one of several open pull requests fixing the same loop in shell/plugins/lock/Service.qml: #7179, #10393, #10653, #11918 and #12461. The older fix wins by default unless the newer one is clearly better. #11918 is the oldest focused fix: #7179 is a draft with conflicts, #10393 also changes lid and sudo/polkit handling, and #10653 calls runWake() on every automatic retry, which keeps an unattended display waking. #11918 has already been verified on a worker. It measures how long each attempt ran and backs off only attempts that fail in under a second, up to 30 seconds, so a reader that the overheating guard has disabled gets left alone and a reader that is working stays responsive.

That timing distinction is also where this pull request is weaker. Both models found that the 15-attempt budget counts every unsuccessful completion, including the ordinary 30-second pam_fprintd timeout when nobody is at the machine. After about eight minutes with the screen locked, a healthy reader stops listening, so pressing a finger on it unlocks nothing until a key press or mouse movement triggers runWake() and re-arms the scan. Nothing on screen says fingerprint has paused. This is from reading the source, not from running it on hardware. Quickshell sends completed(PamResult.Error) after error(), so both handlers restart the same timer, but the counter only advances when the timer fires, so no attempt is counted twice.

Next step is the maintainer's: choose between the competing fixes. The ready label stays with #11918, so this pull request will not get it.

@omarchybot

Copy link
Copy Markdown
Collaborator

Closing as superseded by merged #7158. The merged retry policy handles repeated device errors with capped backoff and recovery, superseding the separate retry-budget fix.

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.

@omarchybot omarchybot closed this Oct 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lock-screen fingerprint retries with no backoff, overheats/disables sensor overnight; polkit fingerprint never actually captures

5 participants