Skip to content

Recover a secure lock whose surface never presented a frame - #18037

Closed
DanielJBurbridge wants to merge 1 commit into
omacom:quattrofrom
DanielJBurbridge:cursor/unpainted-lock-recovery-ab4a
Closed

DanielJBurbridge wants to merge 1 commit into
omacom:quattrofrom
DanielJBurbridge:cursor/unpainted-lock-recovery-ab4a

Conversation

@DanielJBurbridge

@DanielJBurbridge DanielJBurbridge commented Nov 7, 2026 •

Copy link
Copy Markdown

Withdrawn after follow-up review.

This attempted to recover the invisible lock in #18011 by allowing shell restart when the lock was classified as unpainted. That classification is not reliable enough to permit killing a live lock client.

The journal query covers the whole shell, so an EGL error from another window can classify a working password prompt as unpainted. The one-shot read can also finish before a real presentation failure is logged. frameSwapped alone does not establish successful presentation. Delaying or filtering the same query does not supply evidence tied to this lock surface.

Closing this change preserves the existing restart guard. A replacement needs a trustworthy presentation or mapping signal for the lock surface, plus behavioural coverage; it should not infer permission to kill the locker from journal text. No GPU-pressure reproduction or graphical validation was performed in this follow-up audit.

This began as an unattended GrokBot contribution using spare weekly model allowance to work through Omarchy issues. Codex reviewed the current implementation and checked a bounded Grok 4.7 audit. This attempt should not be presented as a verified fix.

An EGL allocation failure can leave the session locked with nothing
painted. Qt still emits frameSwapped when eglSwapBuffers fails, so
restart kept that client and Hyprland would not clear it. Treat that
lock as recoverable, and keep a lock that actually presented.

Co-authored-by: Daniel Burbridge <DanielJBurbridge@users.noreply.github.com>
@greptile-apps

greptile-apps Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 3/5

[Medium impact] The change affects the desktop lock and shell-restart workflow.

Fix the journal decisions and satisfy the test requirements before merging.

Findings

  1. P1 Unrelated errors condemn working locks ▶
  2. P1 Early log reads miss failures ▶
  3. P2 Text checks miss broken connections ▶
  4. P2 Lock coverage is split unnecessarily ▶

Summary

Adds frame tracking and a journal check to identify secure locks that never showed a prompt.

  • The shell can recover a secure lock that never showed a prompt.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Lock begins] --> B[Track surfaces and frames]
  B --> C[Session becomes secure]
  C --> D[Read shell journal once]
  D --> E{Matching graphics error?}
  E -->|Yes| F[Report unpainted]
  E -->|No and frame recorded| G[Report painted]
  E -->|No frame after wait| F
  F --> H[Restart replaces shell and locks again]
  G --> I[Restart refuses]
Loading

Reviews (1) · Last reviewed commit: "Recover a secure lock whose surface neve..." · Reviewed by Greptile

lockPaintJournalQuery += 1
lockPaintJournal.generation = generation
lockPaintJournal.query = lockPaintJournalQuery
lockPaintJournal.command = ["journalctl", "--user", "-t", "omarchy-shell", "--since", "@" + sinceSec, "-o", "cat", "--no-pager"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Unrelated errors condemn working locks

queryLockPaintJournal() reads every omarchy-shell message in the time window, including other windows and the second before this lock began. If another output or shell window reports an EGL failure while a lock output draws successfully, that line sets presentFailed. The model reports painted: false and unpainted: true, allowing omarchy-restart-shell to kill a working password prompt.

Restrict the failure evidence to this lock's surfaces. A failure elsewhere must not override a working lock output.

Comment on lines +155 to +165
if (state.journal === "idle" && state.startedAtSec > 0) {
state.journal = "pending"
queryJournal = true
}

if (trusted && (state.journal === "clean" || state.journal === "unavailable" || (state.journal === "idle" && state.settled))) {
state.painted = true
state.unpainted = false
state.committed = true
state.awaitingSettle = false
return finish(state, "stop", queryJournal)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Early log reads miss failures

If the journal read finishes before the first failed swap or before its error reaches the journal, the invisible lock is treated as working. evaluate() requests the read as soon as the lock is secure and has a surface, without waiting for a frame. A later frameSwapped then commits the lock as painted using that earlier clean result, even if the swap failed. No further journal read is requested, so restart refuses recovery.

Check the log after the frame attempt and allow for delayed log delivery before treating that frame as proof.

Comment on lines +163 to +169
assert(
/function onFrameSwapped\(\) \{[\s\S]*?type: "frame"/.test(serviceQml),
'the lock surface records a swapped frame'
)
assert(
/function onSceneGraphError\(error, message\) \{[\s\S]*?type: "graphics-failed"/.test(serviceQml),
'a lock surface that loses its graphics context is recorded'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Text checks miss broken connections

These assertions check the new source text rather than its behavior. AGENTS.md explicitly says not to grep source or reread an edited file to confirm the edit. Finding onFrameSwapped in the file does not show that its connection receives frames. The same pattern appears elsewhere in this new test.

Remove these text checks and test the event wiring or status changes instead. This repository requirement must be satisfied before merging.

File Used: AGENTS.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Comment on lines +7 to +11
run_node_test <<'JS'
const fs = require('fs')
const model = requireFromRoot('shell/plugins/lock/LockPaintModel.js')
const serviceQml = fs.readFileSync(path.join(root, 'shell/plugins/lock/Service.qml'), 'utf8')
const restart = fs.readFileSync(path.join(root, 'bin/omarchy-restart-shell'), 'utf8')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Lock coverage is split unnecessarily

This adds another lock test file despite the instruction in AGENTS.md to extend the area's existing test file. lock-state-test.sh already covers the lock service's state and status, and restart-shell-test.sh covers restart recovery.

Move the new model coverage into the existing lock-area test rather than adding another *-test.sh. This repository requirement must be satisfied before merging.

File Used: AGENTS.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

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