Skip to content

Clear lockRequested latch on lock() so later lock() actually locks - #8

Closed
kvnloo wants to merge 1 commit into
quattrofrom
cursor/clear-lock-requested-latch-006f
Closed

kvnloo wants to merge 1 commit into
quattrofrom
cursor/clear-lock-requested-latch-006f

Conversation

@kvnloo

@kvnloo kvnloo commented Sep 10, 2026 •

Copy link
Copy Markdown
Owner

Summary

Fixes the stalled lockRequested latch described in omacom#10299 by clearing a non-materialized request before a later IPC lock retry.

Factory closeout — 2026-09-25

Closed as superseded by active upstream owner.

The defect still exists on current omacom/omarchy:quattro, but upstream PR omacom#12245 is the canonical lock/sleep consolidation and already includes the bounded acquire-timeout / stalled-request recovery for omacom#10299. Earlier focused PRs omacom#11811, omacom#12064, and omacom#12946 were explicitly folded into omacom#12245.

Promoting this two-file fork PR now would create a competing implementation and bypass the broader lock invariants already under review (no-real-screen deferral, involuntary lock loss, overlapping acquire, sleep lifecycle).

Preserve this branch as historical evidence until no worker needs it; then delete the task branch.

When a lock request stalls after setting lockRequested=true but never
reaches sessionLock.locked or sessionLock.secure, the latch stays true
forever. Because root.locked derives from lockRequested, the IPC lock()
method then short-circuits and returns 'ok' without ever calling
beginLock(), making every subsequent lock attempt a silent no-op.

This is a security issue: the machine can suspend unlocked because the
lid-close lock handler receives 'ok' from a latched-stuck request that
never actually locks.

The fix detects a stalled lock state in the IPC lock() handler: when
lockRequested is true but the session is neither locked nor secure,
clear the latch and associated timers before checking root.locked.
This ensures beginLock() gets called for a fresh lock attempt.

Adds test/shell.d/lock-requested-latch-test.sh to verify the latch is
cleared and timers are stopped before retrying the lock.

Fixes omacom#10299

Co-authored-by: Kevin Rajan <kvnloo@users.noreply.github.com>
@kvnloo kvnloo closed this Sep 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants