GhosttyNSView.desiredFocus and TerminalSurface.desiredFocusState (Sources/GhosttyTerminalView.swift) both track intended focus and are mutated on different paths. A becomeFirstResponder early-return can update one without the other; an adjacent comment in the file already warns about this exact divergence.
Fix: make one of the two the single source of truth and derive the other, or route all writes through one setter. Note: this is adjacent to the protected typing-latency paths; the fix should not add work to forceRefresh or the keyDown path.
From the 2026-07-09 nuclear review (10 module reviewers + Codex cross-model pass, disprove-first). Line refs are against the reductive-audit branch (PR #81).
GhosttyNSView.desiredFocusandTerminalSurface.desiredFocusState(Sources/GhosttyTerminalView.swift) both track intended focus and are mutated on different paths. AbecomeFirstResponderearly-return can update one without the other; an adjacent comment in the file already warns about this exact divergence.Fix: make one of the two the single source of truth and derive the other, or route all writes through one setter. Note: this is adjacent to the protected typing-latency paths; the fix should not add work to
forceRefreshor the keyDown path.From the 2026-07-09 nuclear review (10 module reviewers + Codex cross-model pass, disprove-first). Line refs are against the
reductive-auditbranch (PR #81).