Skip to content

A tiny friend in your Mac's notch and on your iPhone that keeps an eye on your AI coding agents: Claude Code, Codex, Cursor, Gemini CLI, Antigravity and more. Approve from the notch or your Lock Screen.

fix(macos): keep questions queued during view transitions instead of cancelling (#852)

Ohualtexef25bd70810a
diff --git a/NotchBuddy/Sources/App/HookServer.swift b/NotchBuddy/Sources/App/HookServer.swift
index e785c34b..199cba0a 100644
--- a/NotchBuddy/Sources/App/HookServer.swift
+++ b/NotchBuddy/Sources/App/HookServer.swift
@@ -159,6 +159,10 @@ final class HookServer: @unchecked Sendable {
withAnimation(.spring(response: 0.5, dampingFraction: 0.72)) { state.focusId = prev }
}
}
+ if questions.head != nil {
+ showQuestionHead()
+ return
+ }
if let note {
state.noteMessage = note
state.view = .note
@@ -301,7 +305,9 @@ final class HookServer: @unchecked Sendable {
private func showQuestionHead() {
let state = AppState.shared
state.waitingQuestions = questions.entries
- guard let head = questions.head, shownQuestion != head.id else { return }
+ guard let head = questions.head else { return }
+ let needsDisplay = shownQuestion != head.id || state.view != .question
+ guard needsDisplay else { return }
shownQuestion = head.id
state.pendingQuestion = head.question
state.isPinned = true
@@ -412,9 +418,13 @@ final class HookServer: @unchecked Sendable {
}
}
shownQuestion = nil
+ focusBeforeQuestion = nil
state.waitingQuestions = []
state.pendingQuestion = nil
- for pill in Set(gone.map(\.pillId)) { syncPill(pill) }
+ for pill in Set(gone.map(\.pillId)) {
+ syncPill(pill)
+ clearPillBadge(id: pill)
+ }
}
/// Called by QuestionView "Reply in terminal" button: question `id` (the card's when nil)
diff --git a/NotchBuddy/Sources/App/IslandViewContent.swift b/NotchBuddy/Sources/App/IslandViewContent.swift
index f88489c8..160c568e 100644
--- a/NotchBuddy/Sources/App/IslandViewContent.swift
+++ b/NotchBuddy/Sources/App/IslandViewContent.swift
@@ -624,7 +624,6 @@ struct QuestionView: View {
.onChange(of: state.pendingQuestion) { _, _ in resetQuestionState() }
// The next session's question can read the same as the one just answered.
.onChange(of: state.waitingQuestions.first?.id) { _, _ in resetQuestionState() }
- .onDisappear { HookServer.shared.releaseQuestionFD() }
}
private func resetQuestionState() {